浏览代码

feat: 完成菜单路由的配置

louhangfei 11 月之前
父节点
当前提交
4e8c9aa004
共有 6 个文件被更改,包括 103 次插入66 次删除
  1. 2 2
      mock/login/routers.ts
  2. 0 6
      package.json
  3. 85 49
      src/router/full-routes.ts
  4. 10 3
      src/router/index.ts
  5. 5 5
      src/views/system/menu/MenuForm.vue
  6. 1 1
      src/views/system/menu/menu.vue

+ 2 - 2
mock/login/routers.ts

@@ -52,7 +52,7 @@ const list = [
               activeMenu: '/disaster-prevention/disaster-warning',
               alwaysShow: false,
               frameSrc: '',
-              hidden: true,
+              hidden: false,
               icon: '',
               isFrame: 0,
               isRoot: false,
@@ -214,7 +214,7 @@ const list = [
               activeMenu: '/disaster-prevention/disaster-precaution/task-execution',
               alwaysShow: false,
               frameSrc: '',
-              hidden: true,
+              hidden: false,
               icon: '',
               isFrame: 0,
               isRoot: false,

+ 0 - 6
package.json

@@ -155,12 +155,6 @@
         "rollup",
         "webpack"
       ]
-    },
-    "patchedDependencies": {
-      "@vue-office/excel": "patches/@vue-office__excel.patch",
-      "@vue-office/pdf": "patches/@vue-office__pdf.patch",
-      "@vue-office/pptx": "patches/@vue-office__pptx.patch",
-      "@vue-office/docx": "patches/@vue-office__docx.patch"
     }
   }
 }

+ 85 - 49
src/router/full-routes.ts

@@ -42,7 +42,7 @@ export const disasterPreventionRoute = {
         activeMenu: null,
         alwaysShow: false,
         frameSrc: '',
-        hidden: true,
+        hidden: false,
         icon: 'OverviewIcon',
         isFrame: 0,
         isRoot: false,
@@ -84,7 +84,7 @@ export const disasterPreventionRoute = {
             activeMenu: '/disaster-prevention/disaster-warning',
             alwaysShow: false,
             frameSrc: '',
-            hidden: true,
+            hidden: false,
             icon: '',
             isFrame: 0,
             isRoot: false,
@@ -117,6 +117,26 @@ export const disasterPreventionRoute = {
           path: 'defense-notice',
           redirect: '',
         },
+        {
+          component: '/disaster/disaster-warning/PageDefenseNoticeItem',
+          id: 1038,
+          meta: {
+            activeMenu: null,
+            alwaysShow: false,
+            frameSrc: '',
+            hidden: false,
+            icon: '',
+            isFrame: 0,
+            isRoot: false,
+            noCache: false,
+            query: '',
+            title: '防御通知详情',
+          },
+          name: '/disaster-prevention/disaster-warning/defense-notice-item',
+          parentId: 1027,
+          path: 'defense-notice-item',
+          redirect: '',
+        },
       ],
       component: '',
       id: 1027,
@@ -146,7 +166,7 @@ export const disasterPreventionRoute = {
             activeMenu: null,
             alwaysShow: false,
             frameSrc: '',
-            hidden: true,
+            hidden: false,
             icon: '',
             isFrame: 0,
             isRoot: false,
@@ -159,6 +179,26 @@ export const disasterPreventionRoute = {
           path: 'task-management',
           redirect: '',
         },
+        {
+          component: '/disaster/disaster-precaution/PageTaskItem',
+          id: 1033,
+          meta: {
+            activeMenu: null,
+            alwaysShow: false,
+            frameSrc: '',
+            hidden: true,
+            icon: '',
+            isFrame: 0,
+            isRoot: false,
+            noCache: false,
+            query: '',
+            title: '任务列表详情',
+          },
+          name: '/disaster-prevention/disaster-precaution/task-item',
+          parentId: 1028,
+          path: 'task-item',
+          redirect: '',
+        },
         {
           component: '/disaster/disaster-precaution/PageTaskExecution',
           id: 1030,
@@ -186,7 +226,7 @@ export const disasterPreventionRoute = {
             activeMenu: '/disaster-prevention/disaster-precaution/task-execution',
             alwaysShow: false,
             frameSrc: '',
-            hidden: true,
+            hidden: false,
             icon: '',
             isFrame: 0,
             isRoot: false,
@@ -213,7 +253,6 @@ export const disasterPreventionRoute = {
             noCache: false,
             query: '',
             title: '任务模板详情',
-            isHidden: true,
           },
           name: '/disaster-prevention/disaster-precaution/template-detail',
           parentId: 1028,
@@ -234,6 +273,9 @@ export const disasterPreventionRoute = {
         noCache: false,
         query: '',
         title: '预防检查',
+        // OverviewIcon: renderSvg('overview'),
+        // DisasterWarningIcon: renderSvg('disaster-warning'),
+        // DisasterControlIcon: renderSvg('disaster-control'),
       },
       name: '/disaster-prevention/disaster-precaution',
       parentId: 1022,
@@ -435,6 +477,44 @@ export const systemRoutes =
     ],
   };
 
+export const exceptionRouters =
+  /**
+   * 异常页面
+   */
+  {
+    path: '/exception',
+    name: 'Exception',
+    component: 'LAYOUT',
+    redirect: '/exception/403',
+    meta: {
+      icon: 'ExclamationCircleOutlined',
+      title: '异常页面',
+      ignoreAuth: true,
+    },
+    children: [
+      {
+        // 403,
+        path: '403',
+        name: 'Exception403',
+        component: '/exception/403',
+        meta: {
+          icon: '',
+          title: '403',
+        },
+      },
+
+      {
+        path: '500',
+        name: 'Exception500',
+        component: '/exception/500',
+        meta: {
+          icon: '',
+          title: '500',
+        },
+      },
+    ],
+  };
+
 export const fullRoutes: AppRouteRecordRaw[] = [
   disasterPreventionRoute,
 
@@ -584,50 +664,6 @@ export const fullRoutes: AppRouteRecordRaw[] = [
       },
     ],
   },
-
-  /**
-   * 异常页面
-   */
-  {
-    path: '/exception',
-    name: 'Exception',
-    component: 'LAYOUT',
-    redirect: '/exception/403',
-    meta: {
-      icon: 'ExclamationCircleOutlined',
-      title: '异常页面',
-    },
-    children: [
-      {
-        // 403,
-        path: '403',
-        name: 'Exception403',
-        component: '/exception/403',
-        meta: {
-          icon: '',
-          title: '403',
-        },
-      },
-      {
-        path: '404',
-        name: '/exception/404',
-        component: '/exception/404',
-        meta: {
-          icon: '',
-          title: '404',
-        },
-      },
-      {
-        path: '500',
-        name: 'Exception500',
-        component: '/exception/500',
-        meta: {
-          icon: '',
-          title: '500',
-        },
-      },
-    ],
-  },
 ] as const;
 
 /**

+ 10 - 3
src/router/index.ts

@@ -3,7 +3,7 @@ import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
 import { RedirectRoute } from '@/router/base';
 import { PageEnum } from '@/enums/pageEnum';
 import { createRouterGuards } from './router-guards';
-import { disasterPreventionRoute, fullRoutes, HOME_PAGE, RootRoute } from './full-routes';
+import { disasterPreventionRoute, exceptionRouters, fullRoutes, HOME_PAGE, RootRoute } from './full-routes';
 import { asyncImportRoute, routerGenerator } from './generator-routers';
 
 const modules: any = import.meta.glob('./modules/**/*.ts', { eager: true });
@@ -23,12 +23,19 @@ function sortRoute(a, b) {
 routeModuleList.sort(sortRoute);
 
 const { children, ...disasterPreventionTopRoute } = disasterPreventionRoute;
-const navRoutes = [RootRoute, HOME_PAGE, disasterPreventionTopRoute, RedirectRoute, ...fullRoutes];
+const constantRoutes = [
+  RootRoute,
+  HOME_PAGE,
+  disasterPreventionTopRoute,
+  RedirectRoute,
+  exceptionRouters,
+  ...fullRoutes,
+];
 
 //需要验证权限
 export const asyncRoutes = [...routeModuleList];
 
-const routeList = routerGenerator(navRoutes);
+const routeList = routerGenerator(constantRoutes);
 asyncImportRoute(routeList);
 
 //普通路由 无需验证权限

+ 5 - 5
src/views/system/menu/MenuForm.vue

@@ -310,11 +310,11 @@
       message: '路由地址不能为空',
       trigger: 'blur',
     },
-    component: {
-      required: true,
-      message: '组件路径不能为空',
-      trigger: 'blur',
-    },
+    // component: {
+    //   required: true,
+    //   message: '组件路径不能为空',
+    //   trigger: 'blur',
+    // },
     routeName: {
       required: true,
       message: '路由名称不能为空',

+ 1 - 1
src/views/system/menu/menu.vue

@@ -60,7 +60,7 @@
                 :title="`确定要删除菜单${treeItemTitle}吗?`"
               >
                 <template #reference>
-                  <el-button type="danger" size="small">删除菜单</el-button>
+                  <el-button type="danger" size="small" style="margin-left: 50px">删除菜单</el-button>
                 </template>
               </el-popconfirm>
             </div>