Browse Source

提交代码

Lijy 1 tháng trước cách đây
mục cha
commit
1535d0a8e4

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