yxk-20260610-审批历史页面
优先调用 /sys/sysDepart/queryAffiliatedDepts?userName=${userInfo.username} 获取当前用户所属全部部门。
This commit is contained in:
+5
-15
@@ -119,16 +119,6 @@
|
|||||||
return typeof value === 'string' ? value.trim() : '';
|
return typeof value === 'string' ? value.trim() : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function splitValue(value: unknown): string[] {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
return value.map((item) => normalizeText(item)).filter(Boolean);
|
|
||||||
}
|
|
||||||
return normalizeText(value)
|
|
||||||
.split(',')
|
|
||||||
.map((item) => item.trim())
|
|
||||||
.filter(Boolean);
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveRecords(res: any): ApprovalHistoryRecord[] {
|
function resolveRecords(res: any): ApprovalHistoryRecord[] {
|
||||||
if (Array.isArray(res)) {
|
if (Array.isArray(res)) {
|
||||||
return res;
|
return res;
|
||||||
@@ -237,13 +227,13 @@
|
|||||||
async function doLoadCurrentUserDeptList() {
|
async function doLoadCurrentUserDeptList() {
|
||||||
const userInfo = (userStore.getUserInfo || {}) as Record<string, any>;
|
const userInfo = (userStore.getUserInfo || {}) as Record<string, any>;
|
||||||
const loginInfo = (userStore.getLoginInfo || {}) as Record<string, any>;
|
const loginInfo = (userStore.getLoginInfo || {}) as Record<string, any>;
|
||||||
const departIds = splitValue(userInfo.departIds);
|
|
||||||
const fallbackDeptList = getFallbackCurrentUserDeptList(userInfo, loginInfo);
|
const fallbackDeptList = getFallbackCurrentUserDeptList(userInfo, loginInfo);
|
||||||
|
const username = normalizeText(userInfo.username);
|
||||||
|
|
||||||
// 本部门按用户全部部门处理,优先用部门ID批量补齐编码和名称,避免只按当前登录部门筛选。
|
// 本部门按用户所属全部部门处理;departIds 是管理部门,不适合作为审批意见筛选口径。
|
||||||
if (departIds.length > 0) {
|
if (username) {
|
||||||
try {
|
try {
|
||||||
const res = await defHttp.get({ url: '/sys/sysDepart/listAll', params: { id: departIds.join(',') } });
|
const res = await defHttp.get({ url: '/sys/sysDepart/queryAffiliatedDepts', params: { userName: username } });
|
||||||
const deptList = resolveDeptList(res);
|
const deptList = resolveDeptList(res);
|
||||||
setCurrentUserDeptList(deptList.length > 0 ? deptList : fallbackDeptList);
|
setCurrentUserDeptList(deptList.length > 0 ? deptList : fallbackDeptList);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -262,7 +252,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const orgCode = normalizeText(userInfo.orgCode);
|
const orgCode = normalizeText(userInfo.orgCode);
|
||||||
const departName = normalizeText(userInfo.orgCodeTxt || userInfo.departIds_dictText);
|
const departName = normalizeText(userInfo.orgCodeTxt);
|
||||||
if (orgCode || departName) {
|
if (orgCode || departName) {
|
||||||
return [{ orgCode, departName }];
|
return [{ orgCode, departName }];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user