فهرست منبع

[Mod 0000] 修改组织树结构

houzekong 2 ماه پیش
والد
کامیت
f3169846af
2فایلهای تغییر یافته به همراه8 افزوده شده و 3 حذف شده
  1. 5 2
      src/api/sys/menu.ts
  2. 3 1
      src/store/modules/mine.ts

+ 5 - 2
src/api/sys/menu.ts

@@ -9,7 +9,7 @@ import { getFormattedText } from '/@/components/Configurable/hooks/helper';
 // import { listToTree } from '/@/utils/helper/treeHelper';
 import { MineDepartment, useMineDepartmentStore } from '/@/store/modules/mine';
 import { AppRouteRecordRaw } from '/@/router/types';
-import { cloneDeep } from 'lodash';
+import { cloneDeep } from 'lodash-es';
 
 enum Api {
   GetMenuList = '/sys/permission/getUserPermissionByToken',
@@ -79,7 +79,10 @@ export const getMenuList: () => Promise<getMenuListResultModel> = () => {
       menu: processStaticRoutes(cloneDeep(__STATIC_ROUTES__), mineStore).map((route) => {
         if (route.meta?.generation && route.children && route.children.length) {
           const template = route.children[0];
-          route.children = generateStaticSealedMonitorRoute(template, mineStore.getDepartTree);
+          route.children = generateStaticSealedMonitorRoute(
+            template,
+            mineStore.getRoot?.isLeaf ? mineStore.getDepartTree : mineStore.getRoot?.childDepart || []
+          );
         }
         return route;
       }),

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

@@ -110,7 +110,9 @@ export const useMineDepartmentStore = defineStore('mine-department-store', () =>
       );
 
       root.value = res;
-      departTree.value = res.isLeaf ? [res] : res.childDepart;
+      depart.value = res;
+      departTree.value = [res];
+      // departTree.value = res.isLeaf ? [res] : res.childDepart;
       // 深拷贝保存原始数据,用于过滤后恢复
       // rawTree.value = JSON.parse(JSON.stringify(tree));