From e1951f3e3f35f583ea55795175412d2ac2ec8e92 Mon Sep 17 00:00:00 2001
From: 13404089107 <puwei@sinata.cn>
Date: 星期四, 26 六月 2025 15:37:56 +0800
Subject: [PATCH] Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory

---
 culture/src/router/index.js |   54 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/culture/src/router/index.js b/culture/src/router/index.js
index 2c1bdaf..4e858a4 100644
--- a/culture/src/router/index.js
+++ b/culture/src/router/index.js
@@ -42,6 +42,7 @@
     meta: {
         title: "中台",
         middleground: true,
+        privilege:'middleground'
         // hide: true,
     },
     component: () => import("../views/middleground"),
@@ -50,6 +51,7 @@
     path: "/projectList",
     meta: {
       title: "项目组管理",
+      privilege:'projectList'
     },
     component: Layouts,
     children: [
@@ -58,6 +60,7 @@
         name: "ProjectList",
         meta: {
           title: "菌种库项目组管理",
+          privilege:'projectList_list'
         },
         component: () => import("../views/projectList"),
       },
@@ -95,6 +98,7 @@
     path: "/system",
     meta: {
       title: "系统管理",
+       privilege:'system'
     },
     component: Layouts,
     children: [
@@ -103,6 +107,7 @@
         name: "User",
         meta: {
           title: "人员管理",
+           privilege:'system_user'
         },
         component: () => import("../views/system/user"),
       },
@@ -111,6 +116,7 @@
         name: "Role",
         meta: {
           title: "角色管理",
+           privilege:'system_role'
         },
         component: () => import("../views/system/role"),
       },
@@ -145,6 +151,7 @@
         path: "operation-log",
         meta: {
           title: "操作日志",
+           privilege:'system_operation-log'
         },
         component: () => import("../views/system/operation-log"),
       },
@@ -155,6 +162,7 @@
     component: Layouts,
     meta: {
       title: "菌种库",
+      privilege:'strain'
     },
     children: [
       {
@@ -162,6 +170,7 @@
         component: Parent,
         meta: {
           title: "菌种库管理",
+          privilege:'strain_library'
         },
         children: [
           {
@@ -169,6 +178,7 @@
             name: "StrainLibraryManage",
             meta: {
               title: "原始细胞库",
+              privilege:'strain_library_strain_library_manage'
             },
             component: () =>
               import("../views/strain-library/strain-library-manage"),
@@ -210,6 +220,7 @@
             name: "MainCellLibrary",
             meta: {
               title: "主细胞库",
+              privilege:'strain_library_main_cell_library'
             },
             component: () =>
               import("../views/strain-library/main-cell-library"),
@@ -239,6 +250,7 @@
             name: "ProductionCellLibrary",
             meta: {
               title: "生产细胞库",
+              privilege:'strain_library_production_cell_library'
             },
             component: () =>
               import("../views/strain-library/production-cell-library"),
@@ -270,6 +282,7 @@
         name: "PedigreeChart",
         meta: {
           title: "菌种传代生产谱系图",
+          privilege:'strain_pedigree_vhart'
         },
         component: () => import("../views/pedigree-chart"),
       },
@@ -323,6 +336,7 @@
         name: "BreedingRecord",
         meta: {
           title: "菌种选育保藏记录",
+          privilege:'strain_breeding_record'
         },
         component: () => import("../views/strain-library/breeding-record"),
       },
@@ -357,6 +371,7 @@
         path: "validation",
         meta: {
           title: "菌种验证数据资料",
+          privilege:'strain_validation'
         },
         component: Parent,
         children: [
@@ -365,6 +380,7 @@
             name: "PrimitiveCell",
             meta: {
               title: "原始细胞库资料",
+              privilege:'strain_validation_primitive_cell'
             },
             component: () =>
               import(
@@ -412,6 +428,7 @@
             name: "ChiefCell",
             meta: {
               title: "主细胞库资料",
+              privilege:'strain_validation_chief_cell'
             },
             component: () =>
               import("../views/strain-library/validation/chief-cell"),
@@ -457,6 +474,7 @@
     component: Layouts,
     meta: {
       title: "菌种报告库",
+      privilege:'strainReportLibrary'
     },
     children: [
       {
@@ -464,6 +482,7 @@
         meta: {
           title: "报告库一",
           keepAlive: true,
+          privilege:'strainReportLibrary_reportLibraryOne'
         },
         component: () =>
           import("../views/strainReportLibrary/reportLibraryOne/index.vue"),
@@ -493,6 +512,7 @@
         meta: {
           title: "报告库二",
           keepAlive: true,
+          privilege:'strainReportLibrary_reportLibraryTwo'
         },
         component: () =>
           import("../views/strainReportLibrary/reportLibraryOneTWO/index.vue"),
@@ -522,6 +542,7 @@
         meta: {
           title: "报告库三",
           keepAlive: true,
+          privilege:'strainReportLibrary_reportLibraryThree'
         },
         component: () =>
           import(
@@ -553,6 +574,7 @@
         meta: {
           title: "报告库四",
           keepAlive: true,
+          privilege:'strainReportLibrary_reportLibraryFour'
         },
         component: () =>
           import("../views/strainReportLibrary/reportLibraryOneFour/index.vue"),
@@ -584,12 +606,14 @@
     component: Layouts,
     meta: {
       title: "菌种库操作评定",
+      privilege:'strainOperationAssessment'
     },
     children: [
       {
         path: "list",
         meta: {
           title: "评定列表",
+          privilege:'strainOperationAssessment_list'
         },
         component: () =>
           import("../views/strainOperationAssessment/index.vue"),
@@ -601,12 +625,14 @@
     component: Layouts,
     meta: {
       title: "菌种报告评定",
+      privilege:'deliveryAssessment'
     },
     children: [
       {
         path: "projectTeamIntegral",
         meta: {
           title: "菌种项目组评定表",
+          privilege:'deliveryAssessment_projectTeamIntegral'
         },
         component: () =>
           import("../views/deliveryAssessment/projectTeamIntegral"),
@@ -654,12 +680,28 @@
   }
 
   // 判断是否拥有要跳转菜单权限
-  let menus = store.state.menus;
-  if (
-    to.meta.hasOwnProperty("privilege") &&
-    !menus.includes(to.meta.privilege)
-  ) {
-    return;
+  // let menus = store.state.menus;
+  // if (
+  //   to.meta.hasOwnProperty("privilege") &&
+  //   !menus.includes(to.meta.privilege)
+  // ) {
+  //   return;
+  // }
+
+  let flatMenus = store.state.flatMenus
+  if (!flatMenus || flatMenus.length === 0) {
+      // 刷新后从sessionStorage恢复
+      const menus = JSON.parse(sessionStorage.getItem('menus') || '[]')
+      const flat = JSON.parse(sessionStorage.getItem('flatMenus') || '[]')
+      store.commit('SET_MENUS', menus)
+      store.commit('SET_FLAT_MENUS', flat)
+      flatMenus = flat
+  }
+  if (to.meta && to.meta.privilege) {
+      if (!flatMenus.includes(to.meta.privilege)) {
+          next('/403') // 无权限跳转403
+          return
+      }
   }
 
   // 设置标签列表

--
Gitblit v1.7.1