Commit 83f779ac by Sendya

fix: update RoleList2

parent d860f308
......@@ -8,46 +8,46 @@ const PERMISSION_ENUM = {
'disable': { key: 'disable', label: '禁用' },
'import': { key: 'import', label: '导入' },
'export': { key: 'import', label: '导入' },
};
}
function plugin(Vue) {
if (plugin.installed) {
return;
return
}
!Vue.prototype.$auth && Object.defineProperties(Vue.prototype, {
$auth: {
get() {
const _this = this;
const _this = this
return (permissions) => {
let [permission, action] = permissions.split('.');
const permissionList = _this.$store.getters.roles.permissions;
const [permission, action] = permissions.split('.')
const permissionList = _this.$store.getters.roles.permissions
permissionList.find((val) => {
return val.permissionId === permission
}).actionList.findIndex((val) => {
return val === action
});
})
return false
}
}
}
});
})
!Vue.prototype.$enum && Object.defineProperties(Vue.prototype, {
$enum: {
get() {
// const _this = this;
return (val) => {
let result = PERMISSION_ENUM;
let result = PERMISSION_ENUM
val && val.split('.').forEach(v => {
result = result && result[v] || null
});
})
return result
}
}
}
});
})
}
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