Commit 83f779ac by Sendya

fix: update RoleList2

parent d860f308
...@@ -8,46 +8,46 @@ const PERMISSION_ENUM = { ...@@ -8,46 +8,46 @@ const PERMISSION_ENUM = {
'disable': { key: 'disable', label: '禁用' }, 'disable': { key: 'disable', label: '禁用' },
'import': { key: 'import', label: '导入' }, 'import': { key: 'import', label: '导入' },
'export': { key: 'import', label: '导入' }, 'export': { key: 'import', label: '导入' },
}; }
function plugin(Vue) { function plugin(Vue) {
if (plugin.installed) { if (plugin.installed) {
return; return
} }
!Vue.prototype.$auth && Object.defineProperties(Vue.prototype, { !Vue.prototype.$auth && Object.defineProperties(Vue.prototype, {
$auth: { $auth: {
get() { get() {
const _this = this; const _this = this
return (permissions) => { return (permissions) => {
let [permission, action] = permissions.split('.'); const [permission, action] = permissions.split('.')
const permissionList = _this.$store.getters.roles.permissions; const permissionList = _this.$store.getters.roles.permissions
permissionList.find((val) => { permissionList.find((val) => {
return val.permissionId === permission return val.permissionId === permission
}).actionList.findIndex((val) => { }).actionList.findIndex((val) => {
return val === action return val === action
}); })
return false return false
} }
} }
} }
}); })
!Vue.prototype.$enum && Object.defineProperties(Vue.prototype, { !Vue.prototype.$enum && Object.defineProperties(Vue.prototype, {
$enum: { $enum: {
get() { get() {
// const _this = this; // const _this = this;
return (val) => { return (val) => {
let result = PERMISSION_ENUM; let result = PERMISSION_ENUM
val && val.split('.').forEach(v => { val && val.split('.').forEach(v => {
result = result && result[v] || null result = result && result[v] || null
}); })
return result return result
} }
} }
} }
}); })
} }
export default plugin export default plugin
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment