Преглед изворни кода

[Fix 0000] 修复了矿井接口处理后根节点定位错误的问题

houzekong пре 3 месеци
родитељ
комит
e4209a2ca5
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      src/store/modules/mine.ts

+ 3 - 2
src/store/modules/mine.ts

@@ -4,7 +4,7 @@ import { ref, computed } from 'vue';
 // import { getEnfMineTree } from '/@/api/sys/menu';
 // import { getUserMinePermissionData } from '/@/components/Form/src/jeecg/components/MineCascader/mineData.api';
 import { findNode, findNodeAll, findPath, listToTree, treeToList, forEach } from '/@/utils/helper/treeHelper';
-import { isArray, isFunction, isNil } from 'lodash';
+import { isArray, isFunction, isNil, minBy, get } from 'lodash-es';
 import { getEnfMineTree } from '/@/api/sys/menu';
 import { EnfMineTreeItem } from '/@/api/sys/model/menuModel';
 
@@ -101,7 +101,8 @@ export const useMineDepartmentStore = defineStore('mine-department-store', () =>
       // 并行请求两个接口
       const r2 = await getEnfMineTree();
       if (!r2.length) return;
-      const [TOP_LEVEL_ORG = '1', __, LEAF_LEVEL_ORG = '4'] = r2[0].memoDesc;
+      const TOP_LEVEL_ORG = minBy(r2, (e) => parseInt(e.orgType))?.orgType;
+      const LEAF_LEVEL_ORG = get(r2, '[0].memoDesc[2]', '4');
 
       const r1 = r2.reduce((arr: MineDepartment[], node) => {
         const isRoot = node.orgType === TOP_LEVEL_ORG;