From 8eb9e890c4c30020fd88b3c878f6059189c9d9e4 Mon Sep 17 00:00:00 2001 From: Joel <479214531@qq.com> Date: Tue, 9 Nov 2021 11:45:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E6=88=90=E5=A4=9A=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/user/list/index.vue | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/pages/user/list/index.vue b/src/pages/user/list/index.vue index a5f915f..cef6836 100644 --- a/src/pages/user/list/index.vue +++ b/src/pages/user/list/index.vue @@ -88,11 +88,11 @@ - - + + 用户 @@ -187,7 +187,7 @@ export default { userId: '', accountId: '', userName: '', - roleId: ['user'], + roleIds: ['user'], phone: '', uniqueIdentification: '', workNumber: '', @@ -305,6 +305,7 @@ export default { this.page = 1 this.getData() }, + // 获取全部角色 getRole(){ this.$get(`${this.api.listRole}?page=1&size=1000&name=&platformId=${Setting.platformId}`).then(res => { this.roleList = res.rolePage.records @@ -388,9 +389,6 @@ export default { this.isDetail = true this.getDetail(row.accountId) }, - changeRole(val){ - console.log(11,val) - }, confirm(){ this.$refs.form.validate((valid) => { if (valid) { @@ -404,11 +402,11 @@ export default { // 每个用户都有个默认的角色,就是"用户",这是个基础角色,而"用户"的roleId是0,这是写死的 // 如果没选择任何角色,则只有一个不可勾选的"用户"角色,则把roleId赋值为0 - if(data.roleId.length == 1){ - data.roleId = '0' + if(data.roleIds.length == 1){ + data.roleIds = ['0'] }else{ - // 目前的用户角色只支持勾选一个角色,如果固定取索引为1的角色id - data.roleId = data.roleId[1] + // 第一个角色是用户,该角色不用传给后端,只需要传非用户的角色 + data.roleIds = data.roleIds.slice(1) } if(this.form.userId){ this.$post(this.api.modifyUser,data).then(res => { @@ -441,7 +439,7 @@ export default { account: row.account, accountId: row.accountId, isEnable: val, - roleId: row.roleId, + roleIds: row.roleId, userId: row.userId, userName: row.userName, workNumber: row.workNumber,