[update] 修改操作列只显示一个按钮,其他显示在更多
This commit is contained in:
@@ -127,4 +127,70 @@ export function filterGlobalPermission (el, binding) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据授权标识是否拥有该权限,用于tab页签的权限
|
||||
*/
|
||||
export function isHasPermission (permissionIdentifier) {
|
||||
const permissionList = []
|
||||
const allPermissionList = []
|
||||
|
||||
// let authList = Vue.ls.get(USER_AUTH);
|
||||
const authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]')
|
||||
for (const auth of authList) {
|
||||
if (auth.type + '' !== '2') {
|
||||
permissionList.push(auth)
|
||||
}
|
||||
}
|
||||
// console.log("页面权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH));
|
||||
const allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]')
|
||||
for (const gauth of allAuthList) {
|
||||
if (gauth.type + '' !== '2') {
|
||||
allPermissionList.push(gauth)
|
||||
}
|
||||
}
|
||||
// 设置全局配置是否有命中
|
||||
let invalidFlag = false// 无效命中
|
||||
if (allPermissionList && allPermissionList.length > 0) {
|
||||
for (const itemG of allPermissionList) {
|
||||
if (permissionIdentifier === itemG.action) {
|
||||
if (itemG.status + '' === '0') {
|
||||
invalidFlag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (invalidFlag) {
|
||||
return
|
||||
}
|
||||
if (permissionList === null || permissionList === '' || permissionList === undefined || permissionList.length <= 0) {
|
||||
return false
|
||||
}
|
||||
const permissions = []
|
||||
for (const item of permissionList) {
|
||||
// 权限策略1显示2禁用
|
||||
if (item.type + '' !== '2') {
|
||||
// update--begin--autor:wangshuai-----date:20200729------for:按钮权限,授权标识的提示信息是多个用逗号分隔逻辑处理 gitee#I1OUGU-------
|
||||
if (item.action) {
|
||||
if (item.action.includes(',')) {
|
||||
const split = item.action.split(',')
|
||||
for (let i = 0; i < split.length; i++) {
|
||||
if (!split[i] || split[i].length === 0) {
|
||||
continue
|
||||
}
|
||||
permissions.push(split[i])
|
||||
}
|
||||
} else {
|
||||
permissions.push(item.action)
|
||||
}
|
||||
}
|
||||
// update--end--autor:wangshuai-----date:20200729------for:按钮权限,授权标识的提示信息是多个用逗号分隔逻辑处理 gitee#I1OUGU------
|
||||
}
|
||||
}
|
||||
if (!permissions.includes(permissionIdentifier)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
export default hasPermission
|
||||
|
||||
Reference in New Issue
Block a user