From d645df58c2b41cb6d0e8b4daa5e9b21c52582929 Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Thu, 26 Dec 2024 14:13:20 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AB=AF=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=AE=E6=94=B9=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/admin.js | 9 +++ src/views/system/user/components/UserInfo.vue | 59 +++++++++++++++++-- src/views/system/user/components/roleList.vue | 48 +++++++++------ 3 files changed, 95 insertions(+), 21 deletions(-) diff --git a/src/api/admin.js b/src/api/admin.js index 3f8c1073..71a658c3 100644 --- a/src/api/admin.js +++ b/src/api/admin.js @@ -325,3 +325,12 @@ export function useUserIDGetDoctorID(data) { data }) } + +// 管理端修改用户角色 +export function updateUserRoleInfo(data) { + return request({ + url: `/User/updateUserRoleInfo`, + method: 'put', + data + }) +} diff --git a/src/views/system/user/components/UserInfo.vue b/src/views/system/user/components/UserInfo.vue index 1f8de2ec..db0d0c04 100644 --- a/src/views/system/user/components/UserInfo.vue +++ b/src/views/system/user/components/UserInfo.vue @@ -85,11 +85,32 @@ style="width: 100%" :disabled="user.CanEditUserType === false || type === 1" @change="handleChange" + v-if="type === 0" > - + + + + + + @@ -162,9 +183,10 @@ @@ -193,6 +215,10 @@ export default { }, methods: { openRoleList() { + this.userRoleList = [] + this.user.UserRoleList.forEach((item) => { + this.userRoleList.push(Object.assign({}, item)) + }) this.visible = true }, handleChange(val) { @@ -274,10 +300,33 @@ export default { IdentityUserId: this.userId, }).then((res) => { this.user = res.Result + this.Roles = [] this.user.Roles = [] this.user.UserRoleList = [] res.Result.AccountList.forEach((item) => { if (!item.IsUserRoleDisabled) { + this.Roles.push(item.UserTypeId) + this.user.Roles.push(item.UserTypeId) + } + this.user.UserRoleList.push({ + UserTypeEnum: item.UserTypeEnum, + UserTypeId: item.UserTypeId, + IsUserRoleDisabled: item.IsUserRoleDisabled, + UserTypeShortName: item.UserTypeShortName, + }) + }) + }) + }, + getRoleList() { + getUser({ + IdentityUserId: this.userId, + }).then((res) => { + this.Roles = [] + this.user.Roles = [] + this.user.UserRoleList = [] + res.Result.AccountList.forEach((item) => { + if (!item.IsUserRoleDisabled) { + this.Roles.push(item.UserTypeId) this.user.Roles.push(item.UserTypeId) } this.user.UserRoleList.push({ @@ -315,6 +364,8 @@ export default { } } return { + userRoleList: [], + Roles: [], user: { Roles: [], UserRoleList: [], diff --git a/src/views/system/user/components/roleList.vue b/src/views/system/user/components/roleList.vue index f79c7e92..4a619881 100644 --- a/src/views/system/user/components/roleList.vue +++ b/src/views/system/user/components/roleList.vue @@ -7,7 +7,6 @@ :close-on-click-modal="false" :close-on-press-escape="false" append-to-body - :show-close="false" :title="$t('system:userlist:roleList:title')" :before-close="cancel" > @@ -19,7 +18,12 @@ > {{ $t('common:button:new') }} - + - + {{ $t('common:button:confirm') }} + + + {{ $t('common:button:cancel') }} +