From 3156606c9027e043ee28c8cc4f13b44fe6b44f68 Mon Sep 17 00:00:00 2001 From: gexinzhineng/gxzn27 <1348660141@qq.com> Date: Thu, 2 Mar 2023 15:34:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=94=A8=E6=88=B7=E9=9C=80=E8=A6=81=E5=A1=AB=E5=86=99?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=EF=BC=88=E5=B7=A5=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=9C=80=E8=A6=81=EF=BC=8C=E4=B8=8D=E7=84=B6?= =?UTF-8?q?=E4=BC=9A=E6=8A=A5=E9=94=99=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/user/index.vue | 39 +++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index d125112d..bccab852 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -386,24 +386,31 @@ const handleDetail = async (rowId: number) => { // 提交按钮 const submitForm = async () => { - loading.value = true // 提交请求 - try { - const data = unref(formRef)?.formModel as UserApi.UserVO - if (actionType.value === 'create') { - await UserApi.createUserApi(data) - message.success(t('common.createSuccess')) - } else { - await UserApi.updateUserApi(data) - message.success(t('common.updateSuccess')) + const elForm = unref(formRef)?.getElFormRef() + if (!elForm) return + elForm.validate(async (valid) => { + if (valid) { + try { + const data = unref(formRef)?.formModel as UserApi.UserVO + if (actionType.value === 'create') { + await UserApi.createUserApi(data) + loading.value = true + message.success(t('common.createSuccess')) + } else { + await UserApi.updateUserApi(data) + loading.value = true + message.success(t('common.updateSuccess')) + } + dialogVisible.value = false + } finally { + // unref(formRef)?.setSchema(allSchemas.formSchema) + // 刷新列表 + await reload() + loading.value = false + } } - dialogVisible.value = false - } finally { - // unref(formRef)?.setSchema(allSchemas.formSchema) - // 刷新列表 - await reload() - loading.value = false - } + }) } // 改变用户状态操作 const handleStatusChange = async (row: UserApi.UserVO) => {