角色权限修改

dev
yujialong 3 years ago
parent 7d23ffd562
commit ccb9b1882b
  1. 9
      src/layouts/header/index.vue
  2. 8
      src/layouts/navbar/index.vue
  3. 6
      src/pages/role/list/index.vue

@ -7,7 +7,7 @@
<div style="height: 64px;"></div> <div style="height: 64px;"></div>
<navbar ref="nav"></navbar> <navbar ref="nav"></navbar>
<div class="action" v-if="token"> <div class="action" v-if="token">
<img v-if="showSetting && isCustomer" class="icon m-r-20" src="../../assets/img/setting.png" alt="" @click="toManager"> <img v-if="showSetting" class="icon m-r-20" src="../../assets/img/setting.png" alt="" @click="toManager">
<el-dropdown class="user-wrap" @command="userCommand"> <el-dropdown class="user-wrap" @command="userCommand">
<div class="user"> <div class="user">
<el-avatar :size="40" :src="avatar"></el-avatar> <el-avatar :size="40" :src="avatar"></el-avatar>
@ -119,8 +119,11 @@ export default {
userName && this.setInfo({ userName && this.setInfo({
userName userName
}) })
} else {
// 3/data/list
if (this.routes.length && !this.routes.find(e => e.name !== '/data/list')) this.showSetting = false
} }
// , // ,
setTimeout(() => { setTimeout(() => {
this.token && !this.isCustomer && this.getUserInfo() this.token && !this.isCustomer && this.getUserInfo()
}, 1000) }, 1000)
@ -177,7 +180,7 @@ export default {
}) })
window.open(route.href) window.open(route.href)
} else { } else {
// ,, // ,,
util.warningMsg('该角色未开放模块,请联系管理员') util.warningMsg('该角色未开放模块,请联系管理员')
} }
}, },

@ -90,8 +90,12 @@ export default {
this.menus = this.defaultMenus this.menus = this.defaultMenus
} }
} else { } else {
// , // ,
this.menus = [...this.defaultMenus, ...this.dataMenu] if (this.routes.find(e => e.name === '/data/list')) {
this.menus = this.dataMenu
} else {
this.menus = this.dataMenu[0]
}
} }
}, },
jump(item) { jump(item) {

@ -148,7 +148,7 @@ export default {
getPer(){ getPer(){
if(!this.permissions.length){ if(!this.permissions.length){
this.$get(`${this.api.queryAllMenus}?platformId=${Setting.platformId}`).then(res => { this.$get(`${this.api.queryAllMenus}?platformId=${Setting.platformId}`).then(res => {
this.permissions = res.children[0].children this.permissions = res.children
}).catch(res => {}) }).catch(res => {})
} }
}, },
@ -166,7 +166,7 @@ export default {
permissions.map(e => { permissions.map(e => {
if(result.includes(e.id) && e.children.length){ if(result.includes(e.id) && e.children.length){
// ,idid,,, // ,idid,,,
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id),1) e.children.every(n => result.includes(n.id)) || result.splice(result.indexOf(e.id),1)
} }
e.children.length && this.handleRolePer(data,e.children) e.children.length && this.handleRolePer(data,e.children)
}) })
@ -175,11 +175,13 @@ export default {
}, },
async getDetail(row){ async getDetail(row){
this.getPer() this.getPer()
setTimeout(() => {
this.$get(`${this.api.getRole}?id=${row.id}`).then(res => { this.$get(`${this.api.getRole}?id=${row.id}`).then(res => {
this.form = res.role this.form = res.role
this.checkedIds = this.handleRolePer(res.permissionList,this.permissions) this.checkedIds = this.handleRolePer(res.permissionList,this.permissions)
this.$refs.per.setCheckedNodes(this.checkedIds) this.$refs.per.setCheckedNodes(this.checkedIds)
}).catch(res => {}) }).catch(res => {})
}, 100)
}, },
showRole(row){ showRole(row){
this.isDetail = true this.isDetail = true

Loading…
Cancel
Save