@@ -119,8 +119,11 @@ export default {
userName && this.setInfo({
userName
})
+ } else {
+ // 如果权限里没有后台的3个菜单,则隐藏进入后台的图标。/data/list是前台数据列表,仅在前台展示
+ if (this.routes.length && !this.routes.find(e => e.name !== '/data/list')) this.showSetting = false
}
- // 如果登录了,并且非客户,才调用用户信息的接口(客户是没有用户信息的,但是能进入后台)
+ // 如果登录了,并且非客户,才调用用户信息的接口。客户是没有用户信息的,但是能进入后台(如果有权限菜单)
setTimeout(() => {
this.token && !this.isCustomer && this.getUserInfo()
}, 1000)
@@ -177,7 +180,7 @@ export default {
})
window.open(route.href)
} else {
- // 如果接口返回的角色权限为空,则表示没有给该角色开放任何模块权限,直接提示用户未开放
+ // 如果接口返回的后台角色权限为空,则表示没有给该角色开放任何模块权限,直接提示用户未开放
util.warningMsg('该角色未开放模块,请联系管理员')
}
},
diff --git a/src/layouts/navbar/index.vue b/src/layouts/navbar/index.vue
index 2713740..3999366 100644
--- a/src/layouts/navbar/index.vue
+++ b/src/layouts/navbar/index.vue
@@ -90,8 +90,12 @@ export default {
this.menus = this.defaultMenus
}
} 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) {
diff --git a/src/pages/role/list/index.vue b/src/pages/role/list/index.vue
index 8f1f464..37a2df6 100644
--- a/src/pages/role/list/index.vue
+++ b/src/pages/role/list/index.vue
@@ -148,7 +148,7 @@ export default {
getPer(){
if(!this.permissions.length){
this.$get(`${this.api.queryAllMenus}?platformId=${Setting.platformId}`).then(res => {
- this.permissions = res.children[0].children
+ this.permissions = res.children
}).catch(res => {})
}
},
@@ -166,7 +166,7 @@ export default {
permissions.map(e => {
if(result.includes(e.id) && e.children.length){
// 如果该权限下的子权限不是每个都勾选了,就把该权限的id从已勾选的id集合里去除,因为如果不去除的话,这个权限就会勾选,同时会把该权限下的所有子权限都一起勾选
- 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)
})
@@ -175,11 +175,13 @@ export default {
},
async getDetail(row){
this.getPer()
- this.$get(`${this.api.getRole}?id=${row.id}`).then(res => {
- this.form = res.role
- this.checkedIds = this.handleRolePer(res.permissionList,this.permissions)
- this.$refs.per.setCheckedNodes(this.checkedIds)
- }).catch(res => {})
+ setTimeout(() => {
+ this.$get(`${this.api.getRole}?id=${row.id}`).then(res => {
+ this.form = res.role
+ this.checkedIds = this.handleRolePer(res.permissionList,this.permissions)
+ this.$refs.per.setCheckedNodes(this.checkedIds)
+ }).catch(res => {})
+ }, 100)
},
showRole(row){
this.isDetail = true