irc_web/src/utils/hasPermi.js

27 lines
712 B
JavaScript

/**
* 获取权限布尔值
* Copyright (c) 2019 ruoyi
*/
import store from '@/store'
export function xfHasPermi(Premis, qorh) {
var value = Premis
if (value && value instanceof Array && value.length > 0) {
const permissionFlag = value
const permissions = ( store.getters && store.getters.permissions ) || []
let hasPermissions
if (qorh && qorh === '&&') {
hasPermissions = permissionFlag.every(v => {
return permissions.includes(v)
})
} else {
hasPermissions = permissions.some(permission => {
return permissionFlag.includes(permission)
})
}
return hasPermissions
} else {
throw new Error(`请设置操作权限标签值`)
}
}