Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
21f7a854
Commit
21f7a854
authored
Jun 08, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(demo): account list page validate and save
parent
8e4f486f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
AccountModal.vue
src/views/demo/system/account/AccountModal.vue
+3
-1
account.data.ts
src/views/demo/system/account/account.data.ts
+1
-1
index.vue
src/views/demo/system/account/index.vue
+11
-3
No files found.
src/views/demo/system/account/AccountModal.vue
View file @
21f7a854
...
...
@@ -16,6 +16,7 @@
emits
:
[
'
success
'
,
'
register
'
],
setup
(
_
,
{
emit
})
{
const
isUpdate
=
ref
(
true
);
const
rowId
=
ref
(
''
);
const
[
registerForm
,
{
setFieldsValue
,
updateSchema
,
resetFields
,
validate
}]
=
useForm
({
labelWidth
:
100
,
...
...
@@ -32,6 +33,7 @@
isUpdate
.
value
=
!!
data
?.
isUpdate
;
if
(
unref
(
isUpdate
))
{
rowId
.
value
=
data
.
record
.
id
;
setFieldsValue
({
...
data
.
record
,
});
...
...
@@ -59,7 +61,7 @@
// TODO custom api
console
.
log
(
values
);
closeModal
();
emit
(
'
success
'
);
emit
(
'
success
'
,
{
isUpdate
:
unref
(
isUpdate
),
values
:
{
...
values
,
id
:
rowId
.
value
}
}
);
}
finally
{
setModalProps
({
confirmLoading
:
false
});
}
...
...
src/views/demo/system/account/account.data.ts
View file @
21f7a854
...
...
@@ -61,7 +61,7 @@ export const accountFormSchema: FormSchema[] = [
label
:
'
密码
'
,
component
:
'
InputPassword
'
,
required
:
true
,
s
how
:
false
,
ifS
how
:
false
,
},
{
label
:
'
角色
'
,
...
...
src/views/demo/system/account/index.vue
View file @
21f7a854
...
...
@@ -45,9 +45,10 @@
components
:
{
BasicTable
,
PageWrapper
,
DeptTree
,
AccountModal
,
TableAction
},
setup
()
{
const
[
registerModal
,
{
openModal
}]
=
useModal
();
const
[
registerTable
,
{
reload
}]
=
useTable
({
const
[
registerTable
,
{
reload
,
updateTableDataRecord
}]
=
useTable
({
title
:
'
账号列表
'
,
api
:
getAccountList
,
rowKey
:
'
id
'
,
columns
,
formConfig
:
{
labelWidth
:
120
,
...
...
@@ -82,8 +83,15 @@
console
.
log
(
record
);
}
function
handleSuccess
()
{
reload
();
function
handleSuccess
({
isUpdate
,
values
})
{
if
(
isUpdate
)
{
// 演示不刷新表格直接更新内部数据。
// 注意:updateTableDataRecord要求表格的rowKey属性为string并且存在于每一行的record的keys中
const
result
=
updateTableDataRecord
(
values
.
id
,
values
);
console
.
log
(
result
);
}
else
{
reload
();
}
}
function
handleSelect
(
deptId
=
''
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment