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();