|
|
@ -19,7 +19,6 @@ |
|
|
|
<label style="width: auto;">角色:</label> |
|
|
|
<label style="width: auto;">角色:</label> |
|
|
|
<el-select v-model="role" placeholder="请选择角色" size="small" clearable @change="initData"> |
|
|
|
<el-select v-model="role" placeholder="请选择角色" size="small" clearable @change="initData"> |
|
|
|
<el-option label="不限" value=""></el-option> |
|
|
|
<el-option label="不限" value=""></el-option> |
|
|
|
<el-option label="用户" value="0"></el-option> |
|
|
|
|
|
|
|
<el-option v-for="(item,index) in roleList" :key="index" :label="item.roleName" :value="item.id"></el-option> |
|
|
|
<el-option v-for="(item,index) in roleList" :key="index" :label="item.roleName" :value="item.id"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
</li> |
|
|
|
</li> |
|
|
@ -55,18 +54,14 @@ |
|
|
|
{{scope.row.isEnable ? '启用' : '禁用'}} |
|
|
|
{{scope.row.isEnable ? '启用' : '禁用'}} |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="账号角色" align="center"> |
|
|
|
<el-table-column prop="roleName" label="账号角色" align="center"></el-table-column> |
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
|
|
{{scope.row.roleId == '0' ? '用户' : (roleList.find(n => n.id == scope.row.roleId) ? roleList.find(n => n.id == scope.row.roleId).roleName : '')}} |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column prop="loginNumber" label="登录次数" align="center"> |
|
|
|
<el-table-column prop="loginNumber" label="登录次数" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
{{scope.row.loginNumber ? scope.row.loginNumber : 0}} |
|
|
|
{{scope.row.loginNumber ? scope.row.loginNumber : 0}} |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="lastLoginTime" label="上次登录时间" width="160" align="center"></el-table-column> |
|
|
|
<el-table-column prop="lastLoginTime" label="上次登录时间" width="160" align="center"></el-table-column> |
|
|
|
<el-table-column label="操作" align="center"> |
|
|
|
<el-table-column width="300" label="操作" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button type="text" @click="show(scope.row)" v-auth>查看</el-button> |
|
|
|
<el-button type="text" @click="show(scope.row)" v-auth>查看</el-button> |
|
|
|
<el-button type="text" @click="edit(scope.row)" v-auth>编辑</el-button> |
|
|
|
<el-button type="text" @click="edit(scope.row)" v-auth>编辑</el-button> |
|
|
@ -90,7 +85,6 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="roleIds" label="账号角色"> |
|
|
|
<el-form-item prop="roleIds" label="账号角色"> |
|
|
|
<el-checkbox-group v-model="form.roleIds"> |
|
|
|
<el-checkbox-group v-model="form.roleIds"> |
|
|
|
<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'">{{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> |
|
|
@ -187,7 +181,7 @@ export default { |
|
|
|
userId: '', |
|
|
|
userId: '', |
|
|
|
accountId: '', |
|
|
|
accountId: '', |
|
|
|
userName: '', |
|
|
|
userName: '', |
|
|
|
roleIds: ['user'], |
|
|
|
roleIds: [], |
|
|
|
phone: '', |
|
|
|
phone: '', |
|
|
|
uniqueIdentification: '', |
|
|
|
uniqueIdentification: '', |
|
|
|
workNumber: '', |
|
|
|
workNumber: '', |
|
|
@ -330,7 +324,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
accountChange(){ |
|
|
|
accountChange(){ |
|
|
|
if(this.form.account !== this.originalAccount){ |
|
|
|
if(this.form.account !== this.originalAccount){ |
|
|
|
this.$get(`${this.api.checkAccount}?account=${this.form.account}&type=1&platformId=${Setting.platformId}`).then(res => { |
|
|
|
this.$post(`${this.api.checkAccount}?account=${this.form.account}&type=1&platformId=${Setting.platformId}${this.form.userId ? '&accountId=' + this.form.account : ''}`).then(res => { |
|
|
|
this.accountRepeat = false |
|
|
|
this.accountRepeat = false |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
this.accountRepeat = true |
|
|
|
this.accountRepeat = true |
|
|
@ -341,7 +335,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
workNumberChange(){ |
|
|
|
workNumberChange(){ |
|
|
|
if(this.form.workNumber !== this.originalWorkNumber){ |
|
|
|
if(this.form.workNumber !== this.originalWorkNumber){ |
|
|
|
this.$get(`${this.api.checkAccount}?workNumber=${this.form.workNumber}&type=2&platformId=${Setting.platformId}`).then(res => { |
|
|
|
this.$post(`${this.api.checkAccount}?workNumber=${this.form.workNumber}&type=1&platformId=${Setting.platformId}`).then(res => { |
|
|
|
this.workNumberRepeat = false |
|
|
|
this.workNumberRepeat = false |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
this.workNumberRepeat = true |
|
|
|
this.workNumberRepeat = true |
|
|
@ -370,7 +364,7 @@ export default { |
|
|
|
userId: data.userId, |
|
|
|
userId: data.userId, |
|
|
|
accountId, |
|
|
|
accountId, |
|
|
|
userName: data.userName, |
|
|
|
userName: data.userName, |
|
|
|
roleId: data.roleId, |
|
|
|
roleIds: data.roleId.map(e => e.roleId), |
|
|
|
phone: data.phone ? data.phone : '暂未绑定', |
|
|
|
phone: data.phone ? data.phone : '暂未绑定', |
|
|
|
workNumber: data.workNumber, |
|
|
|
workNumber: data.workNumber, |
|
|
|
email: data.email, |
|
|
|
email: data.email, |
|
|
@ -400,14 +394,7 @@ export default { |
|
|
|
// 如果是新增,则生成个时间戳作为唯一标识 |
|
|
|
// 如果是新增,则生成个时间戳作为唯一标识 |
|
|
|
if(!data.userId) data.uniqueIdentification = new Date().getTime() |
|
|
|
if(!data.userId) data.uniqueIdentification = new Date().getTime() |
|
|
|
|
|
|
|
|
|
|
|
// 每个用户都有个默认的角色,就是"用户",这是个基础角色,而"用户"的roleId是0,这是写死的 |
|
|
|
if(!data.roleIds.length) return util.errorMsg('请至少选择一个角色') |
|
|
|
// 如果没选择任何角色,则只有一个不可勾选的"用户"角色,则把roleId赋值为0 |
|
|
|
|
|
|
|
if(data.roleIds.length == 1){ |
|
|
|
|
|
|
|
data.roleIds = ['0'] |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
// 第一个角色是用户,该角色不用传给后端,只需要传非用户的角色 |
|
|
|
|
|
|
|
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 => { |
|
|
|
this.userVisible = false |
|
|
|
this.userVisible = false |
|
|
|