一单n制等功能,接入随手拍之前我先提交一版本

This commit is contained in:
王利强
2026-08-12 14:43:53 +08:00
parent ec76d588e2
commit 47deeedb22
664 changed files with 1429 additions and 2894 deletions

View File

@@ -43,6 +43,26 @@ export function resolveUserIdentityRoleKey(userInfo) {
return normalizeRoleKey(identity?.roleKey);
}
/** 从 userInfo 中读取组织实体类型0/1=政府2/3=企业及企业下部门 */
export function resolveOrganizationEntityType(userInfo) {
if (!userInfo) return null;
const identity = normalizeUserIdentity(userInfo.userIdentity);
const currentIdentity = getCurrentIdentityFromStorage();
const merged = identity || currentIdentity;
if (merged?.organizationEntityType == null || merged?.organizationEntityType === '') return null;
const entityType = Number(merged.organizationEntityType);
return Number.isNaN(entityType) ? null : entityType;
}
const MANAGER_ROLE_KEYS = ['admin', 'manage'];
/** 是否为政府类型组织的管理员organizationEntityType=0/1 且 roleKey 为 admin/manage */
export function isGovernmentEntityAdmin(userInfo) {
const entityType = resolveOrganizationEntityType(userInfo);
if (entityType !== 0 && entityType !== 1) return false;
return MANAGER_ROLE_KEYS.includes(resolveUserIdentityRoleKey(userInfo));
}
/** 解析用于权限判断的角色标识,优先当前身份 roleKey */
export function resolveUserRoleKey(userInfo) {
if (!userInfo) return '';