From 06b2be3bbb48e0275fbd25624c1cce54a7cac2b1 Mon Sep 17 00:00:00 2001 From: 董国庆 <364620639@qq.com> Date: 星期二, 20 五月 2025 16:44:34 +0800 Subject: [PATCH] Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory --- culture/src/router/index.js | 904 +++++++++++++++++++++++++++++--------------------------- 1 files changed, 471 insertions(+), 433 deletions(-) diff --git a/culture/src/router/index.js b/culture/src/router/index.js index 2d85a1d..e433d4a 100644 --- a/culture/src/router/index.js +++ b/culture/src/router/index.js @@ -1,14 +1,14 @@ import Vue from "vue"; import VueRouter from "vue-router"; import Layouts from "../layouts"; -import Parent from "../layouts/components/AppContent" +import Parent from "../layouts/components/AppContent"; import store from "../store"; Vue.use(VueRouter); -const originalPush = VueRouter.prototype.push +const originalPush = VueRouter.prototype.push; VueRouter.prototype.push = function push(location) { - return originalPush.call(this, location).catch(err => err) -} + return originalPush.call(this, location).catch((err) => err); +}; /** * path: "/login", ------页面地址 @@ -24,471 +24,509 @@ */ const routes = [ - { - path: "/", - redirect: "/login", + { + path: "/", + redirect: "/login", + }, + { + path: "/login", + meta: { + title: "登录", + oneself: true, + hide: true, }, - { - path: "/login", + component: () => import("../views/login"), + }, + { + path: "/projectList", + meta: { + title: "项目组管理", + }, + component: Layouts, + children: [ + { + path: "list", + name: "ProjectList", meta: { - title: "登录", - oneself: true, - hide: true, + title: "菌种库项目组管理", }, - component: () => import("../views/login"), - }, - { - path: "/projectList", + component: () => import("../views/projectList"), + }, + { + path: "addProject", + name: "AddProject", meta: { - title: "项目组管理", + title: "新增菌种库项目组", + hide: true, + keepAlive: true, }, - component: Layouts, - children: [ - { - path: "list", - name: "ProjectList", - meta: { - title: "菌种库项目组管理", - }, - component: () => import("../views/projectList"), - }, - { - path: "addProject", - name: "AddProject", - meta: { - title: "新增菌种库项目组", - hide: true, - keepAlive: true, - }, - component: () => import("../views/projectList/addProject"), - }, - { - path: "editProject", - name: "EditProject", - meta: { - title: "编辑菌种库项目组", - hide: true, - }, - component: () => import("../views/projectList/editProject"), - }, - { - path: "detailProject", - name: "DetailProject", - meta: { - title: "菌种库项目组详情", - hide: true, - }, - component: () => import("../views/projectList/detailProject"), - } - ] - }, - { - path: "/system", + component: () => import("../views/projectList/addProject"), + }, + { + path: "editProject", + name: "EditProject", meta: { - title: "系统管理", + title: "编辑菌种库项目组", + hide: true, }, - component: Layouts, - children: [ - { - path: "user", - name: "User", - meta: { - title: "人员管理", - }, - component: () => import("../views/system/user"), - }, - { - path: "role", - name: "Role", - meta: { - title: "角色管理", - }, - component: () => import("../views/system/role"), - }, - { - path: "add-role", - name: "AddRole", - meta: { - title: "新增角色", - hide: true, - }, - component: () => import("../views/system/role/add"), - }, - { - path: "edit-role", - name: "EditRole", - meta: { - title: "编辑角色", - hide: true, - }, - component: () => import("../views/system/role/edit"), - }, - { - path: "detail-role", - name: "DetailRole", - meta: { - title: "角色详情", - hide: true, - }, - component: () => import("../views/system/role/detail"), - }, - { - path: "operation-log", - meta: { - title: "操作日志", - }, - component: () => import("../views/system/operation-log"), - }, - ] - }, - { - path: "/strain", - component: Layouts, + component: () => import("../views/projectList/editProject"), + }, + { + path: "detailProject", + name: "DetailProject", meta: { - title: "菌种库", + title: "菌种库项目组详情", + hide: true, + }, + component: () => import("../views/projectList/detailProject"), + }, + ], + }, + { + path: "/system", + meta: { + title: "系统管理", + }, + component: Layouts, + children: [ + { + path: "user", + name: "User", + meta: { + title: "人员管理", + }, + component: () => import("../views/system/user"), + }, + { + path: "role", + name: "Role", + meta: { + title: "角色管理", + }, + component: () => import("../views/system/role"), + }, + { + path: "add-role", + name: "AddRole", + meta: { + title: "新增角色", + hide: true, + }, + component: () => import("../views/system/role/add"), + }, + { + path: "edit-role", + name: "EditRole", + meta: { + title: "编辑角色", + hide: true, + }, + component: () => import("../views/system/role/edit"), + }, + { + path: "detail-role", + name: "DetailRole", + meta: { + title: "角色详情", + hide: true, + }, + component: () => import("../views/system/role/detail"), + }, + { + path: "operation-log", + meta: { + title: "操作日志", + }, + component: () => import("../views/system/operation-log"), + }, + ], + }, + { + path: "/strain", + component: Layouts, + meta: { + title: "菌种库", + }, + children: [ + { + path: "/strain-library", + component: Parent, + meta: { + title: "菌种库管理", }, children: [ - { - path: "/strain-library", - component: Parent, - meta: { - title: "菌种库管理", - }, - children: [ - { - path: "strain-library-manage", - name: "StrainLibraryManage", - meta: { - title: "原始细胞库", - keepAlive: true, - }, - component: () => import("../views/strain-library/strain-library-manage"), - }, - { - path: "strain-library-manage/add", - name: "StrainLibraryManageAdd", - meta: { - title: "新增原始细胞库", - keepAlive: true, - hide: true - }, - component: () => import("../views/strain-library/strain-library-manage/add.vue"), - }, - { - path: "strain-library-manage/record", - name: "StrainRecord", - meta: { - title: "出入库记录", - keepAlive: true, - hide: true - }, - component: () => import("../views/strain-library/strain-library-manage/record.vue"), - }, - { - path: "main-cell-library", - name: "MainCellLibrary", - meta: { - title: "主细胞库", - keepAlive: true, - }, - component: () => import("../views/strain-library/main-cell-library"), - }, - { - path: "main-cell-library/add", - name: "MainCellLibraryAdd", - meta: { - title: "新增主细胞", - keepAlive: true, - hide: true - }, - component: () => import("../views/strain-library/main-cell-library/add.vue"), - }, - { - path: "production-cell-library", - name: "ProductionCellLibrary", - meta: { - title: "生产细胞库", - keepAlive: true, - }, - component: () => import("../views/strain-library/production-cell-library"), - }, - { - path: "production-cell-library/add", - name: "ProductionCellLibraryAdd", - meta: { - title: "新增生产细胞", - keepAlive: true, - hide: true - }, - component: () => import("../views/strain-library/production-cell-library/add.vue"), - } - ] - }, - { - path: 'pedigree-vhart', - name: 'PedigreeChart', - meta: { - title: "菌种传代生产谱系图", - }, - component: () => import("../views/pedigree-chart"), - }, - { - path: 'add-pedigree', - name: 'AddPedigree', - meta: { - title: "新增母代菌种传代生产谱系图", - hide: true - }, - component: () => import("../views/pedigree-chart/add"), - }, - { - path: 'add-progenitor', - name: 'AddProgenitor', - meta: { - title: "新增祖代菌种传代生产谱系图", - hide: true - }, - component: () => import("../views/pedigree-chart/addProgenitor"), - }, - // { - // path: "strain-flow-chart", - // name: "StrainFlowChart", - // meta: { - // title: "菌种传代产生流程图", - // keepAlive: true, - // }, - // component: () => import("../views/strain-library/strain-flow-chart"), - // }, - { - path: 'breeding-record', - name: 'BreedingRecord', - meta: { - title: "菌种选育保藏记录", - }, - component: () => import("../views/strain-library/breeding-record"), - }, - { - path: 'add-breeding-record', - name: 'AddBreedingRecord', - meta: { - title: "新增菌种选育保藏记录", - hide: true, - }, - component: () => import("../views/strain-library/breeding-record/add"), - }, - { - path: 'validation', - meta: { - title: "菌种验证数据资料", - }, - component: Parent, - children: [ - { - path: 'primitive-cell', - name: 'PrimitiveCell', - meta: { - title: '原始细胞库资料', - }, - component: () => import("../views/strain-library/validation/primitive-cell/index.vue") - }, - { - path: 'add-primitive-cell', - name: 'AddPrimitiveCell', - meta: { - title: '新增原始细胞库资料', - hide: true - }, - component: () => import("../views/strain-library/validation/primitive-cell/add.vue") - }, - { - path: 'confirm-detail', - name: 'ConfirmDetail', - meta: { - title: '确认原始细胞库资料', - hide: true - }, - component: () => import("../views/strain-library/validation/primitive-cell/confirm-detail.vue") - }, - { - path: 'chief-cell', - name: 'ChiefCell', - meta: { - title: '主细胞库资料' - }, - component: () => import("../views/strain-library/validation/chief-cell") - } - ] - }, - ] - }, { - path: "/strainReportLibrary", - component: Layouts, - meta: { - title: "菌种报告库", - }, - children: [{ - path: "reportLibraryOne", + { + path: "strain-library-manage", + name: "StrainLibraryManage", meta: { - title: "报告库一", - keepAlive: true, + title: "原始细胞库", + keepAlive: true, }, - component: () => import("../views/strainReportLibrary/reportLibraryOne/index.vue"), - }, - { - path: "add", + component: () => + import("../views/strain-library/strain-library-manage"), + }, + { + path: "strain-library-manage/add", + name: "StrainLibraryManageAdd", meta: { - title: "新增报告", - hide: true, - keepAlive: true, - }, - component: () => import("../views/strainReportLibrary/reportLibraryOne/add.vue"), - }, - { - path: "reportLibraryTwo", - meta: { - title: "报告库二", - keepAlive: true, - }, - component: () => import("../views/strainReportLibrary/reportLibraryOneTWO/index.vue"), - }, - { - path: "addTwo", - meta: { - title: "新增报告", - hide: true, - keepAlive: true, - }, - component: () => import("../views/strainReportLibrary/reportLibraryOneTWO/add.vue"), - }, - { - path: "reportLibraryThree", - meta: { - title: "报告库三", - keepAlive: true, - }, - component: () => import("../views/strainReportLibrary/reportLibraryOneThree/index.vue"), - }, - { - path: "addThree", - meta: { - title: "新增报告", - hide: true, - keepAlive: true, - }, - component: () => import("../views/strainReportLibrary/reportLibraryOneThree/add.vue"), - }, - { - path: "reportLibraryFour", - meta: { - title: "报告库四", - keepAlive: true, - }, - component: () => import("../views/strainReportLibrary/reportLibraryOneFour/index.vue"), - }, - { - path: "addFour", - meta: { - title: "新增报告", - hide: true, - keepAlive: true, - }, - component: () => import("../views/strainReportLibrary/reportLibraryOneFour/add.vue"), - }, + title: "新增原始细胞库", + keepAlive: true, + hide: true, + }, + component: () => + import("../views/strain-library/strain-library-manage/add.vue"), + }, + { + path: "strain-library-manage/record", + name: "StrainRecord", + meta: { + title: "出入库记录", + hide: true, + }, + component: () => + import( + "../views/strain-library/strain-library-manage/record.vue" + ), + }, + { + path: "main-cell-library", + name: "MainCellLibrary", + meta: { + title: "主细胞库", + keepAlive: true, + }, + component: () => + import("../views/strain-library/main-cell-library"), + }, + { + path: "main-cell-library/add", + name: "MainCellLibraryAdd", + meta: { + title: "新增主细胞", + keepAlive: true, + hide: true, + }, + component: () => + import("../views/strain-library/main-cell-library/add.vue"), + }, + { + path: "production-cell-library", + name: "ProductionCellLibrary", + meta: { + title: "生产细胞库", + keepAlive: true, + }, + component: () => + import("../views/strain-library/production-cell-library"), + }, + { + path: "production-cell-library/add", + name: "ProductionCellLibraryAdd", + meta: { + title: "新增生产细胞", + keepAlive: true, + hide: true, + }, + component: () => + import("../views/strain-library/production-cell-library/add.vue"), + }, ], - }, - { - path: "/deliveryAssessment", - component: Layouts, + }, + { + path: "pedigree-vhart", + name: "PedigreeChart", meta: { - title: "菌种报告评定", + title: "菌种传代生产谱系图", }, - children: [{ - path: "projectTeamIntegral", + component: () => import("../views/pedigree-chart"), + }, + { + path: "add-pedigree", + name: "AddPedigree", + meta: { + title: "新增母代菌种传代生产谱系图", + hide: true, + }, + component: () => import("../views/pedigree-chart/add"), + }, + { + path: "add-progenitor", + name: "AddProgenitor", + meta: { + title: "新增祖代菌种传代生产谱系图", + hide: true, + }, + component: () => import("../views/pedigree-chart/addProgenitor"), + }, + // { + // path: "strain-flow-chart", + // name: "StrainFlowChart", + // meta: { + // title: "菌种传代产生流程图", + // keepAlive: true, + // }, + // component: () => import("../views/strain-library/strain-flow-chart"), + // }, + { + path: "breeding-record", + name: "BreedingRecord", + meta: { + title: "菌种选育保藏记录", + }, + component: () => import("../views/strain-library/breeding-record"), + }, + { + path: "add-breeding-record", + name: "AddBreedingRecord", + meta: { + title: "新增菌种选育保藏记录", + hide: true, + }, + component: () => import("../views/strain-library/breeding-record/add"), + }, + { + path: "validation", + meta: { + title: "菌种验证数据资料", + }, + component: Parent, + children: [ + { + path: "primitive-cell", + name: "PrimitiveCell", meta: { - title: "菌种项目组评定表", + title: "原始细胞库资料", }, - component: () => import("../views/deliveryAssessment/projectTeamIntegral"), - }, - { - path: "projectTeamIntegral-detail", + component: () => + import( + "../views/strain-library/validation/primitive-cell/index.vue" + ), + }, + { + path: "add-primitive-cell", + name: "AddPrimitiveCell", meta: { - title: "评定详情", - hide: true + title: "新增原始细胞库资料", + hide: true, }, - component: () => import("../views/deliveryAssessment/projectTeamIntegral/detail.vue"), + component: () => + import( + "../views/strain-library/validation/primitive-cell/add.vue" + ), + }, + { + path: "confirm-detail", + name: "ConfirmDetail", + meta: { + title: "确认原始细胞库资料", + hide: true, + }, + component: () => + import( + "../views/strain-library/validation/primitive-cell/confirm-detail.vue" + ), + }, + { + path: "chief-cell", + name: "ChiefCell", + meta: { + title: "主细胞库资料", + }, + component: () => + import("../views/strain-library/validation/chief-cell"), + }, + ], + }, + ], + }, + { + path: "/strainReportLibrary", + component: Layouts, + meta: { + title: "菌种报告库", + }, + children: [ + { + path: "reportLibraryOne", + meta: { + title: "报告库一", + keepAlive: true, }, - ] - } + component: () => + import("../views/strainReportLibrary/reportLibraryOne/index.vue"), + }, + { + path: "add", + meta: { + title: "新增报告", + hide: true, + keepAlive: true, + }, + component: () => + import("../views/strainReportLibrary/reportLibraryOne/add.vue"), + }, + { + path: "reportLibraryTwo", + meta: { + title: "报告库二", + keepAlive: true, + }, + component: () => + import("../views/strainReportLibrary/reportLibraryOneTWO/index.vue"), + }, + { + path: "addTwo", + meta: { + title: "新增报告", + hide: true, + keepAlive: true, + }, + component: () => + import("../views/strainReportLibrary/reportLibraryOneTWO/add.vue"), + }, + { + path: "reportLibraryThree", + meta: { + title: "报告库三", + keepAlive: true, + }, + component: () => + import( + "../views/strainReportLibrary/reportLibraryOneThree/index.vue" + ), + }, + { + path: "addThree", + meta: { + title: "新增报告", + hide: true, + keepAlive: true, + }, + component: () => + import("../views/strainReportLibrary/reportLibraryOneThree/add.vue"), + }, + { + path: "reportLibraryFour", + meta: { + title: "报告库四", + keepAlive: true, + }, + component: () => + import("../views/strainReportLibrary/reportLibraryOneFour/index.vue"), + }, + { + path: "addFour", + meta: { + title: "新增报告", + hide: true, + keepAlive: true, + }, + component: () => + import("../views/strainReportLibrary/reportLibraryOneFour/add.vue"), + }, + ], + }, + { + path: "/deliveryAssessment", + component: Layouts, + meta: { + title: "菌种报告评定", + }, + children: [ + { + path: "projectTeamIntegral", + meta: { + title: "菌种项目组评定表", + }, + component: () => + import("../views/deliveryAssessment/projectTeamIntegral"), + }, + { + path: "projectTeamIntegral-detail", + meta: { + title: "评定详情", + hide: true, + }, + component: () => + import("../views/deliveryAssessment/projectTeamIntegral/detail.vue"), + }, + ], + }, ]; const router = new VueRouter({ - mode: "hash", - base: process.env.BASE_URL, - routes, + mode: "hash", + base: process.env.BASE_URL, + routes, }); // 前置路由拦截器 router.beforeEach((to, from, next) => { - // 设置当前页签名称 - document.title = to.meta.title || '实验室流程'; + // 设置当前页签名称 + document.title = to.meta.title || "实验室流程"; - // 登录验证 - // 排除登录页的校验 - if (to.path === "/login") { - if (sessionStorage.getItem('token')) { - next('/projectList'); // 已登录状态访问登录页时重定向到系统首页 - return; - } - next(); - return; + // 登录验证 + // 排除登录页的校验 + if (to.path === "/login") { + if (sessionStorage.getItem("token")) { + next("/projectList"); // 已登录状态访问登录页时重定向到系统首页 + return; } + next(); + return; + } - // 登录状态校验 - const isAuthenticated = sessionStorage.getItem('token'); - if (!isAuthenticated) { - next('/login'); // 未登录用户重定向到登录页 - return; + // 登录状态校验 + const isAuthenticated = sessionStorage.getItem("token"); + if (!isAuthenticated) { + next("/login"); // 未登录用户重定向到登录页 + return; + } + + // 判断是否拥有要跳转菜单权限 + let menus = store.state.menus; + if ( + to.meta.hasOwnProperty("privilege") && + !menus.includes(to.meta.privilege) + ) { + return; + } + + // 设置标签列表 + if (!to.meta.hide || !to.meta.oneself) { + let tagList = JSON.parse(sessionStorage.getItem("tagList") || "[]"); + // 判断是否存在 + let isExist = tagList.some((item) => item.path === to.path); + if (!isExist) { + // 只保存必要的信息 + const tagInfo = { + path: to.path, + name: to.name, + meta: to.meta, + query: to.query, + }; + tagList.push(tagInfo); + sessionStorage.setItem("tagList", JSON.stringify(tagList)); + store.commit("SET_TAGLIST", tagList); } + } - // 判断是否拥有要跳转菜单权限 - let menus = store.state.menus - if (to.meta.hasOwnProperty('privilege') && !menus.includes(to.meta.privilege)) { - return + // 判断是否需要缓存 + if (to.meta.keepAlive) { + let keepAliveList = JSON.parse( + sessionStorage.getItem("keepAliveList") || "[]" + ); + // 判断是否已经缓存 + let isExist = keepAliveList.includes(to.name); + if (!isExist) { + keepAliveList.push(to.name); + sessionStorage.setItem("keepAliveList", JSON.stringify(keepAliveList)); + store.commit("SET_KEEPALIVELIST", keepAliveList); } + } - // 设置标签列表 - if (!to.meta.hide || !to.meta.oneself) { - let tagList = JSON.parse(sessionStorage.getItem('tagList') || '[]') - // 判断是否存在 - let isExist = tagList.some(item => item.path === to.path) - if (!isExist) { - // 只保存必要的信息 - const tagInfo = { - path: to.path, - name: to.name, - meta: to.meta, - query: to.query, - } - tagList.push(tagInfo) - sessionStorage.setItem('tagList', JSON.stringify(tagList)) - store.commit('SET_TAGLIST', tagList) - } - } - - // 判断是否需要缓存 - if (to.meta.keepAlive) { - let keepAliveList = JSON.parse(sessionStorage.getItem('keepAliveList') || '[]') - // 判断是否已经缓存 - let isExist = keepAliveList.includes(to.name) - if (!isExist) { - keepAliveList.push(to.name) - sessionStorage.setItem('keepAliveList', JSON.stringify(keepAliveList)) - store.commit('SET_KEEPALIVELIST', keepAliveList) - } - } - - next() + next(); }); export default router; -- Gitblit v1.7.1