2021-03-10 18:26:53 +08:00
|
|
|
import store from '@/store'
|
|
|
|
export function checkPermission(pers) {
|
|
|
|
const permissions = store.getters.permissions
|
|
|
|
const hasPermission = pers.every(needP => {
|
|
|
|
const result = permissions.includes(needP)
|
|
|
|
return result
|
|
|
|
})
|
|
|
|
return hasPermission
|
|
|
|
}
|
2021-06-07 14:47:27 +08:00
|
|
|
|
|
|
|
export function hasDataPermission(pTarget, pSource) {
|
2021-06-11 14:04:30 +08:00
|
|
|
if (store.state.user.user.isAdmin) {
|
|
|
|
return true
|
|
|
|
}
|
2021-06-07 14:47:27 +08:00
|
|
|
if (pSource && pTarget) {
|
|
|
|
return pSource.indexOf(pTarget) > -1
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|