feat: 权限备用
This commit is contained in:
@ -83,17 +83,24 @@ export function isShiQingZhi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** 获取当前角色 */
|
/** 获取当前用户角色信息 */
|
||||||
export function getRole() {
|
export function getRole() {
|
||||||
const { deptBizType, deptLevel } = getItem('deptId')[0]
|
const roleList = Array.isArray(getItem('roleList')) ? getItem('roleList') : []
|
||||||
/** 是否是市情指领导 */
|
|
||||||
const isShiQzLeader = getItem('roleList').find(item => item.roleCode == 'JS_666666') != undefined
|
/** 角色配置映射表 */
|
||||||
if (isShiQzLeader) return {label: '市情指领导',value:'01',ename: 'shiQzLeader'}
|
const ROLE_MAP = [
|
||||||
/** 是否是市情指人员 */
|
{ code: 'JS_666666', label: '市情指领导', value: '01', ename: 'shiQzLeader' },
|
||||||
const isShiQz = getItem('roleList').find(item => item.roleCode == 'JS_777777') != undefined
|
{ code: 'JS_777777', label: '市情指挥人员', value: '02', ename: 'shiQz' },
|
||||||
if (isShiQz) return {label: '市情指挥人员',value:'02', ename: 'shiQz'}
|
{ code: 'JS_888888', label: '县情指人员', value: '03', ename: 'xianQz' }
|
||||||
/** 是否是县情指人员 */
|
]
|
||||||
const isXianQz = getItem('roleList').find(item => item.roleCode == 'JS_888888') != undefined
|
|
||||||
if (isXianQz) return {label: '县情指人员',value:'03', ename: 'xianQz'}
|
/** 按优先级匹配角色 */
|
||||||
return {label: '普通用户',value:'04', ename: 'common'}
|
for (const role of ROLE_MAP) {
|
||||||
|
if (roleList.some(item => item.roleCode === role.code)) {
|
||||||
|
return { label: role.label, value: role.value, ename: role.ename }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 默认返回普通用户 */
|
||||||
|
return { label: '普通用户', value: '04', ename: 'common' }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user