改成多角色

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-form-item prop="userName" label="用户姓名">
<el-input v-model="form.userName" placeholder="请输入员工姓名"></el-input> <el-input v-model="form.userName" placeholder="请输入员工姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="roleId" label="账号角色"> <el-form-item prop="roleIds" label="账号角色">
<el-checkbox-group v-model="form.roleId" :max="2"> <el-checkbox-group v-model="form.roleIds">
<el-checkbox label="user" disabled>用户</el-checkbox> <el-checkbox label="user" disabled>用户</el-checkbox>
<template v-for="(item,index) in roleList"> <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> </template>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
@ -187,7 +187,7 @@ export default {
userId: '', userId: '',
accountId: '', accountId: '',
userName: '', userName: '',
roleId: ['user'], roleIds: ['user'],
phone: '', phone: '',
uniqueIdentification: '', uniqueIdentification: '',
workNumber: '', workNumber: '',
@ -305,6 +305,7 @@ export default {
this.page = 1 this.page = 1
this.getData() this.getData()
}, },
//
getRole(){ getRole(){
this.$get(`${this.api.listRole}?page=1&size=1000&name=&platformId=${Setting.platformId}`).then(res => { this.$get(`${this.api.listRole}?page=1&size=1000&name=&platformId=${Setting.platformId}`).then(res => {
this.roleList = res.rolePage.records this.roleList = res.rolePage.records
@ -388,9 +389,6 @@ export default {
this.isDetail = true this.isDetail = true
this.getDetail(row.accountId) this.getDetail(row.accountId)
}, },
changeRole(val){
console.log(11,val)
},
confirm(){ confirm(){
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
@ -404,11 +402,11 @@ export default {
// ,"",,""roleId0, // ,"",,""roleId0,
// ,"",roleId0 // ,"",roleId0
if(data.roleId.length == 1){ if(data.roleIds.length == 1){
data.roleId = '0' data.roleIds = ['0']
}else{ }else{
// ,1id //
data.roleId = data.roleId[1] data.roleIds = data.roleIds.slice(1)
} }
if(this.form.userId){ if(this.form.userId){
this.$post(this.api.modifyUser,data).then(res => { this.$post(this.api.modifyUser,data).then(res => {
@ -441,7 +439,7 @@ export default {
account: row.account, account: row.account,
accountId: row.accountId, accountId: row.accountId,
isEnable: val, isEnable: val,
roleId: row.roleId, roleIds: row.roleId,
userId: row.userId, userId: row.userId,
userName: row.userName, userName: row.userName,
workNumber: row.workNumber, workNumber: row.workNumber,

Loading…
Cancel
Save