改成多角色

dev
Joel 3 years ago
parent fc8f44b6d8
commit 8eb9e890c4
  1. 22
      src/pages/user/list/index.vue

@ -88,11 +88,11 @@
<el-form-item prop="userName" label="用户姓名">
<el-input v-model="form.userName" placeholder="请输入员工姓名"></el-input>
</el-form-item>
<el-form-item prop="roleId" label="账号角色">
<el-checkbox-group v-model="form.roleId" :max="2">
<el-form-item prop="roleIds" label="账号角色">
<el-checkbox-group v-model="form.roleIds">
<el-checkbox label="user" disabled>用户</el-checkbox>
<template v-for="(item,index) in roleList">
<el-checkbox v-if="item.roleName != '超级管理员'" :key="index" :label="item.id" :disabled="item.id == 'user'" @change="changeRole">{{item.roleName}}</el-checkbox>
<el-checkbox v-if="item.roleName != '超级管理员'" :key="index" :label="item.id" :disabled="item.id == 'user'">{{item.roleName}}</el-checkbox>
</template>
</el-checkbox-group>
</el-form-item>
@ -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 {
// ,"",,""roleId0,
// ,"",roleId0
if(data.roleId.length == 1){
data.roleId = '0'
if(data.roleIds.length == 1){
data.roleIds = ['0']
}else{
// ,1id
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,

Loading…
Cancel
Save