admin 初始化

This commit is contained in:
zoujiandong
2023-06-05 09:25:16 +08:00
parent 12ecc21e37
commit 51d369d4c1
82 changed files with 7662 additions and 11 deletions
+22
View File
@@ -0,0 +1,22 @@
import { useUserStore } from '@/store/userInfo';
export default {
checkPermission(el, binding) {
const store = useUserStore();
const { value } = binding;
const all_permission = '*:*:*'
const permissions = store.userInfo && store.userInfo.permissions;
if (typeof value === 'string') {
const hasPermission = permissions.some((permission) => {
return all_permission === permission || value === permission;
})
if (!hasPermission) {
el.parentNode && el.parentNode.removeChild(el);
}
} else {
throw new Error(`请设置操作权限标签值`)
}
}
}