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