新增编辑角色修改

dev
yujialong 3 years ago
parent 8eb9e890c4
commit 706b7653ac
  1. 2
      src/api/index.js
  2. 27
      src/pages/user/list/index.vue
  3. 2
      src/setting.js

@ -35,7 +35,7 @@ export default {
saveUser: `/users/users/data/user/save`, saveUser: `/users/users/data/user/save`,
getUserList: `/users/users/data/user/getUserList`, getUserList: `/users/users/data/user/getUserList`,
getUserTotalBySchoolId: `/users/users/data/user/getUserTotalBySchoolId`, getUserTotalBySchoolId: `/users/users/data/user/getUserTotalBySchoolId`,
checkAccount:`/users/users/data/user/checkAccount`, checkAccount:`/occupationlab/architecture/checkWorkNumOrAccount`,
getDetail:`/users/users/data/user/getDetail`, getDetail:`/users/users/data/user/getDetail`,
modifyUser:`/users/users/data/user/modify`, modifyUser:`/users/users/data/user/modify`,
export_failure:`${Setting.apiBaseURL}/users/users/data/user/export_failure`, export_failure:`${Setting.apiBaseURL}/users/users/data/user/export_failure`,

@ -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()
// ,"",,""roleId0, if(!data.roleIds.length) return util.errorMsg('请至少选择一个角色')
// ,"",roleId0
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

@ -24,7 +24,7 @@ const Setting = {
showProgressBar: true, showProgressBar: true,
// 接口请求地址 // 接口请求地址
// apiBaseURL: env === 'development' ? 'http://192.168.31.125:9000' : 'http://39.108.250.202:9000',// 佳坤 // apiBaseURL: env === 'development' ? 'http://192.168.31.125:9000' : 'http://39.108.250.202:9000',// 佳坤
apiBaseURL: env === 'development' ? 'http://39.108.250.202:9000' : 'http://39.108.250.202:9000', apiBaseURL: env === 'development' ? 'http://192.168.31.151:9000' : 'http://39.108.250.202:9000',
// 接口请求返回错误时,弹窗的持续时间,单位:秒 // 接口请求返回错误时,弹窗的持续时间,单位:秒
modalDuration: 3, modalDuration: 3,
// 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice // 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice

Loading…
Cancel
Save