|
|
@@ -23,6 +23,7 @@ const generateStaticSealedMonitorRoute = (route: AppRouteRecordRaw, items: MineD
|
|
|
return items.reduce((arr: AppRouteRecordRaw[], item) => {
|
|
|
const [__, ___, LEAF_LEVEL_ORG] = item.memoDesc;
|
|
|
|
|
|
+ // 菜单生成到叶节点为止,不包括叶节点
|
|
|
if (item.orgType === LEAF_LEVEL_ORG) return arr;
|
|
|
|
|
|
const res: AppRouteRecordRaw = {
|
|
|
@@ -50,10 +51,6 @@ const processStaticRoutes = (routes: AppRouteRecordRaw[], mineStore: any) => {
|
|
|
return routes.reduce((arr: AppRouteRecordRaw[], route) => {
|
|
|
// 首先处理子菜单,因为子菜单的权限和父菜单是独立的,避免子菜单还有内容的情况下被父菜单过滤
|
|
|
if (route.children && route.children.length) {
|
|
|
- // 如果是生成式动态菜单,优先处理
|
|
|
- if (route.meta.generation) {
|
|
|
- route.children = generateStaticSealedMonitorRoute(route, mineStore.getDepartTree);
|
|
|
- }
|
|
|
// 如果子菜单有内容,则递归处理
|
|
|
route.children = processStaticRoutes(route.children, mineStore);
|
|
|
}
|
|
|
@@ -78,7 +75,13 @@ export const getMenuList: () => Promise<getMenuListResultModel> = () => {
|
|
|
auth: res.auth || [],
|
|
|
codeList: res.codeList || [],
|
|
|
// menu: __STATIC_ROUTES__,
|
|
|
- menu: processStaticRoutes(__STATIC_ROUTES__, mineStore),
|
|
|
+ menu: processStaticRoutes(__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);
|
|
|
+ }
|
|
|
+ return route;
|
|
|
+ }),
|
|
|
};
|
|
|
});
|
|
|
};
|