From f6d69e2bea15efd238fd7a54dc9bfe6cdc54d78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Fri, 4 Jul 2025 14:51:38 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/user/index.vue | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index d12aeed..82e594d 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -154,7 +154,7 @@ - + - + - + { Object.assign(form.value, data.user); postOptions.value = data.posts; roleOptions.value = data.roles; + roleOptions.value.push(...data.user.roles) form.value.postIds = data.postIds; form.value.roleIds = data.roleIds; form.value.password = ''; @@ -626,7 +626,17 @@ const handleUpdate = async (row?: UserForm) => { const submitForm = () => { userFormRef.value?.validate(async (valid: boolean) => { if (valid) { - form.value.userId ? await api.updateUser(form.value) : await api.addUser(form.value); + if (form.value.userId) { + // 自己编辑自己的情况下 不允许编辑角色部门岗位 + if (form.value.userId == useUserStore().userId) { + form.value.roleIds = null; + form.value.deptId = null; + form.value.postIds = null; + } + await api.updateUser(form.value); + } else { + await api.addUser(form.value); + } proxy?.$modal.msgSuccess('操作成功'); dialog.visible = false; await getList();