Lijy преди 1 месец
родител
ревизия
1535d0a8e4
променени са 1 файла, в които са добавени 13 реда и са изтрити 2 реда
  1. 13 2
      fhKeeper/formulahousekeeper/customerBuler-crm/src/router/routerGuards.ts

+ 13 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/router/routerGuards.ts

@@ -12,8 +12,6 @@ export function createRouterGuards(router: Router) {
     const skipPath = ["/login", "/register", "/test", "/testEcharts"];
     if (skipPath.includes(to.path)) {
       next();
-    } else if(to.path === '/biReport') {
-      next(`/biReport/cusReportForm`);
     } else {
       if (token && routerList && routerList.length > 0) {
         if (asyncRoutesMark) {
@@ -45,6 +43,7 @@ export function createRouterGuards(router: Router) {
                 name: item.name,
                 meta: {},
                 component: modules[`/src/pages/${filePath}/index.vue`],
+                redirect: item.path === '/biReport' ? `/biReport/cusReportForm` : ''
               });
               if(item.childrenList && item.childrenList.length > 0) {
                 addNewRouter.children[index + 1].children = item.childrenList.map((child: any) => {
@@ -58,6 +57,18 @@ export function createRouterGuards(router: Router) {
                 })
               }
             }
+
+            if(item.childrenList && item.childrenList.length > 0) {
+              item.childrenList.forEach((child: any) => {
+                let childFilePath = child.path.replace("/", "");
+                addNewRouter?.children.push({
+                  path: child.path,
+                  name: child.name,
+                  meta: {},
+                  component: modules[`/src/pages/${childFilePath}/index.vue`]
+                });
+              });
+            }
           });
           router.addRoute(addNewRouter);
           router.addRoute({