welfare-admin/src/utils/permissions.js

21 lines
398 B
JavaScript
Raw Normal View History

2021-09-02 11:04:14 +08:00
import store from '@/store'
2021-08-11 15:44:50 +08:00
export function actionToObject (json) {
try {
return JSON.parse(json)
} catch (e) {
console.log('err', e.message)
}
return []
}
2021-09-02 11:04:14 +08:00
/**
* 控制按钮是否显示
*/
export function hasBtnPermission (permission) {
const myBtns = store.getters.buttons
if (myBtns.indexOf('*:*:*') > -1) {
2021-09-02 11:04:14 +08:00
return true
}
return myBtns.indexOf(permission) > -1
}