File tree Expand file tree Collapse file tree 1 file changed +23
-16
lines changed Expand file tree Collapse file tree 1 file changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -386,24 +386,31 @@ const handleDetail = async (rowId: number) => {
386
386
387
387
// 提交按钮
388
388
const submitForm = async () => {
389
- loading .value = true
390
389
// 提交请求
391
- try {
392
- const data = unref (formRef )?.formModel as UserApi .UserVO
393
- if (actionType .value === ' create' ) {
394
- await UserApi .createUserApi (data )
395
- message .success (t (' common.createSuccess' ))
396
- } else {
397
- await UserApi .updateUserApi (data )
398
- message .success (t (' common.updateSuccess' ))
390
+ const elForm = unref (formRef )?.getElFormRef ()
391
+ if (! elForm ) return
392
+ elForm .validate (async (valid ) => {
393
+ if (valid ) {
394
+ try {
395
+ const data = unref (formRef )?.formModel as UserApi .UserVO
396
+ if (actionType .value === ' create' ) {
397
+ await UserApi .createUserApi (data )
398
+ loading .value = true
399
+ message .success (t (' common.createSuccess' ))
400
+ } else {
401
+ await UserApi .updateUserApi (data )
402
+ loading .value = true
403
+ message .success (t (' common.updateSuccess' ))
404
+ }
405
+ dialogVisible .value = false
406
+ } finally {
407
+ // unref(formRef)?.setSchema(allSchemas.formSchema)
408
+ // 刷新列表
409
+ await reload ()
410
+ loading .value = false
411
+ }
399
412
}
400
- dialogVisible .value = false
401
- } finally {
402
- // unref(formRef)?.setSchema(allSchemas.formSchema)
403
- // 刷新列表
404
- await reload ()
405
- loading .value = false
406
- }
413
+ })
407
414
}
408
415
// 改变用户状态操作
409
416
const handleStatusChange = async (row : UserApi .UserVO ) => {
You can’t perform that action at this time.
0 commit comments