| | |
| | | component: () => import("../views/login"), |
| | | }, |
| | | { |
| | | path: "/middleground", |
| | | meta: { |
| | | title: "中台", |
| | | middleground: true, |
| | | privilege:'middleground' |
| | | // hide: true, |
| | | }, |
| | | component: () => import("../views/middleground"), |
| | | }, |
| | | { |
| | | path: "/projectList", |
| | | meta: { |
| | | title: "项目组管理", |
| | | privilege:'projectList' |
| | | }, |
| | | component: Layouts, |
| | | children: [ |
| | |
| | | name: "ProjectList", |
| | | meta: { |
| | | title: "菌种库项目组管理", |
| | | privilege:'projectList_list', |
| | | }, |
| | | component: () => import("../views/projectList"), |
| | | }, |
| | |
| | | meta: { |
| | | title: "编辑菌种库项目组", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/projectList/editProject"), |
| | | }, |
| | |
| | | path: "/system", |
| | | meta: { |
| | | title: "系统管理", |
| | | privilege:'system' |
| | | }, |
| | | component: Layouts, |
| | | children: [ |
| | |
| | | name: "User", |
| | | meta: { |
| | | title: "人员管理", |
| | | privilege:'system_user' |
| | | }, |
| | | component: () => import("../views/system/user"), |
| | | }, |
| | |
| | | name: "Role", |
| | | meta: { |
| | | title: "角色管理", |
| | | privilege:'system_role' |
| | | }, |
| | | component: () => import("../views/system/role"), |
| | | }, |
| | |
| | | meta: { |
| | | title: "编辑角色", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/system/role/edit"), |
| | | }, |
| | |
| | | path: "operation-log", |
| | | meta: { |
| | | title: "操作日志", |
| | | privilege:'system_operation-log' |
| | | }, |
| | | component: () => import("../views/system/operation-log"), |
| | | }, |
| | |
| | | component: Layouts, |
| | | meta: { |
| | | title: "菌种库", |
| | | privilege:'strain' |
| | | }, |
| | | children: [ |
| | | { |
| | |
| | | component: Parent, |
| | | meta: { |
| | | title: "菌种库管理", |
| | | privilege:'strain_library' |
| | | }, |
| | | children: [ |
| | | { |
| | | path: "strain-library-manage", |
| | | name: "StrainLibraryManage", |
| | | meta: { |
| | | title: "原始细胞库", |
| | | keepAlive: true, |
| | | title: "原始细胞库(原种登记)", |
| | | privilege:'strain_library_strain_library_manage' |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/strain-library-manage"), |
| | |
| | | name: "StrainLibraryManageAdd", |
| | | meta: { |
| | | title: "新增原始细胞库", |
| | | keepAlive: true, |
| | | |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "StrainLibraryManageAdd", |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/strain-library-manage/add.vue"), |
| | | }, |
| | | { |
| | | path: "strain-library-manage/detail", |
| | | name: "StrainLibraryManageEdit", |
| | | meta: { |
| | | title: "编辑原始细胞库", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "StrainLibraryManageAdd", |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/strain-library-manage/add.vue"), |
| | |
| | | path: "main-cell-library", |
| | | name: "MainCellLibrary", |
| | | meta: { |
| | | title: "主细胞库", |
| | | keepAlive: true, |
| | | title: "主细胞库(祖传母)", |
| | | privilege:'strain_library_main_cell_library' |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/main-cell-library"), |
| | |
| | | name: "MainCellLibraryAdd", |
| | | meta: { |
| | | title: "新增主细胞", |
| | | keepAlive: true, |
| | | hide: true, |
| | | keepAlive: true, |
| | | formMode: "add", |
| | | componentName: "MainCellLibraryAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/main-cell-library/add.vue"), |
| | | }, |
| | | { |
| | | path: "main-cell-library/edit", |
| | | name: "MainCellLibraryEdit", |
| | | meta: { |
| | | title: "编辑主细胞", |
| | | hide: true, |
| | | keepAlive: true, |
| | | formMode: "edit", |
| | | componentName: "MainCellLibraryAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/main-cell-library/add.vue"), |
| | |
| | | path: "production-cell-library", |
| | | name: "ProductionCellLibrary", |
| | | meta: { |
| | | title: "生产细胞库", |
| | | keepAlive: true, |
| | | title: "子细胞库(母传子)", |
| | | privilege:'strain_library_production_cell_library' |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/production-cell-library"), |
| | |
| | | name: "ProductionCellLibraryAdd", |
| | | meta: { |
| | | title: "新增生产细胞", |
| | | keepAlive: true, |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ProductionCellLibraryAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/production-cell-library/add.vue"), |
| | | }, |
| | | { |
| | | path: "production-cell-grandson", |
| | | name: "ProductionCellGrandson", |
| | | meta: { |
| | | title: "孙细胞库(子传孙)", |
| | | privilege:'strain_library_production_cell_library' |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/production-cell-grandson"), |
| | | }, |
| | | { |
| | | path: "production-cell-grandson/add", |
| | | name: "ProductionCellGrandsonAdd", |
| | | meta: { |
| | | title: "新增生产细胞", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ProductionCellGrandsonAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/production-cell-grandson/add.vue"), |
| | | }, |
| | | { |
| | | path: "production-cell-grandson/edit", |
| | | name: "ProductionCellGrandsonEdit", |
| | | meta: { |
| | | title: "编辑生产细胞", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ProductionCellGrandsonAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/production-cell-grandson/add.vue"), |
| | | }, |
| | | { |
| | | path: "production-cell-library/edit", |
| | | name: "ProductionCellLibraryEdit", |
| | | meta: { |
| | | title: "编辑生产细胞", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ProductionCellLibraryAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/production-cell-library/add.vue"), |
| | |
| | | name: "PedigreeChart", |
| | | meta: { |
| | | title: "菌种传代生产谱系图", |
| | | privilege:'strain_pedigree_vhart' |
| | | }, |
| | | component: () => import("../views/pedigree-chart"), |
| | | }, |
| | | { |
| | | path: "detail-pedigree", |
| | | name: "DetailPedigree", |
| | | meta: { |
| | | title: "母代菌种传代生产谱系图详情", |
| | | hide: true, |
| | | }, |
| | | component: () => import("../views/pedigree-chart/add"), |
| | | }, |
| | | { |
| | | path: "add-pedigree", |
| | |
| | | meta: { |
| | | title: "新增母代菌种传代生产谱系图", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/pedigree-chart/add"), |
| | | }, |
| | |
| | | name: "AddProgenitor", |
| | | meta: { |
| | | title: "新增祖代菌种传代生产谱系图", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/pedigree-chart/addProgenitor"), |
| | | }, |
| | | { |
| | | path: "detail-progenitor", |
| | | name: "DetailProgenitor", |
| | | meta: { |
| | | title: "祖代菌种传代生产谱系图详情", |
| | | hide: true, |
| | | }, |
| | | component: () => import("../views/pedigree-chart/addProgenitor"), |
| | |
| | | name: "BreedingRecord", |
| | | meta: { |
| | | title: "菌种选育保藏记录", |
| | | privilege:'strain_breeding_record' |
| | | }, |
| | | component: () => import("../views/strain-library/breeding-record"), |
| | | }, |
| | |
| | | meta: { |
| | | title: "新增菌种选育保藏记录", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "BreedingRecordAdd" |
| | | }, |
| | | component: () => import("../views/strain-library/breeding-record/add"), |
| | | }, |
| | |
| | | meta: { |
| | | title: "编辑菌种选育保藏记录", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "BreedingRecordAdd" |
| | | }, |
| | | component: () => import("../views/strain-library/breeding-record/add"), |
| | | }, |
| | |
| | | path: "validation", |
| | | meta: { |
| | | title: "菌种验证数据资料", |
| | | privilege:'strain_validation' |
| | | }, |
| | | component: Parent, |
| | | children: [ |
| | |
| | | path: "primitive-cell", |
| | | name: "PrimitiveCell", |
| | | meta: { |
| | | title: "原始细胞库资料", |
| | | title: "祖代菌种库验证资料", |
| | | privilege:'strain_validation_primitive_cell' |
| | | }, |
| | | component: () => |
| | | import( |
| | |
| | | path: "add-primitive-cell", |
| | | name: "AddPrimitiveCell", |
| | | meta: { |
| | | title: "新增原始细胞库资料", |
| | | title: "新增祖代菌种库验证资料", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "PrimitiveCellAdd" |
| | | }, |
| | | component: () => |
| | | import( |
| | | "../views/strain-library/validation/primitive-cell/add.vue" |
| | | ), |
| | | }, |
| | | { |
| | | path: "edit-primitive-cell", |
| | | name: "EditPrimitiveCell", |
| | | meta: { |
| | | title: "编辑祖代菌种库验证资料", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "PrimitiveCellAdd" |
| | | }, |
| | | component: () => |
| | | import( |
| | |
| | | path: "confirm-detail", |
| | | name: "ConfirmDetail", |
| | | meta: { |
| | | title: "确认原始细胞库资料", |
| | | title: "确认祖代菌种库验证资料", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => |
| | | import( |
| | |
| | | path: "chief-cell", |
| | | name: "ChiefCell", |
| | | meta: { |
| | | title: "主细胞库资料", |
| | | title: "母代菌种库验证资料", |
| | | privilege:'strain_validation_chief_cell' |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/validation/chief-cell"), |
| | | }, |
| | | { |
| | | path: "add-chief-cell", |
| | | name: "AddChiefCell", |
| | | meta: { |
| | | title: "新增母代菌种库验证资料", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ChiefCellAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/validation/chief-cell/add.vue"), |
| | | }, |
| | | { |
| | | path: "edit-chief-cell", |
| | | name: "EditChiefCell", |
| | | meta: { |
| | | title: "编辑母代菌种库验证资料", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ChiefCellAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/validation/chief-cell/add.vue"), |
| | | }, |
| | | { |
| | | path: "confirm-detail-chief", |
| | | name: "ConfirmDetailChief", |
| | | meta: { |
| | | title: "确认母代菌种库验证资料", |
| | | hide: true, |
| | | }, |
| | | component: () => |
| | | import( |
| | | "../views/strain-library/validation/chief-cell/confirm-detail.vue" |
| | | ), |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | component: Layouts, |
| | | meta: { |
| | | title: "菌种报告库", |
| | | privilege:'strainReportLibrary' |
| | | }, |
| | | children: [ |
| | | { |
| | |
| | | meta: { |
| | | title: "报告库一", |
| | | keepAlive: true, |
| | | privilege:'strainReportLibrary_reportLibraryOne' |
| | | }, |
| | | component: () => |
| | | import("../views/strainReportLibrary/reportLibraryOne/index.vue"), |
| | |
| | | title: "新增报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ReportLibraryOneAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strainReportLibrary/reportLibraryOne/add.vue"), |
| | | }, |
| | | { |
| | | path: "detail", |
| | | meta: { |
| | | title: "报告详情", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ReportLibraryOneAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strainReportLibrary/reportLibraryOne/add.vue"), |
| | |
| | | meta: { |
| | | title: "报告库二", |
| | | keepAlive: true, |
| | | privilege:'strainReportLibrary_reportLibraryTwo' |
| | | }, |
| | | component: () => |
| | | import("../views/strainReportLibrary/reportLibraryOneTWO/index.vue"), |
| | | }, |
| | | { |
| | | path: "detailTwo", |
| | | meta: { |
| | | title: "报告详情", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => |
| | | import("../views/strainReportLibrary/reportLibraryOneTWO/add.vue"), |
| | | }, |
| | | { |
| | | path: "addTwo", |
| | |
| | | meta: { |
| | | title: "报告库三", |
| | | keepAlive: true, |
| | | privilege:'strainReportLibrary_reportLibraryThree' |
| | | }, |
| | | component: () => |
| | | import( |
| | | "../views/strainReportLibrary/reportLibraryOneThree/index.vue" |
| | | ), |
| | | }, |
| | | { |
| | | path: "detailThree", |
| | | meta: { |
| | | title: "报告详情", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => |
| | | import("../views/strainReportLibrary/reportLibraryOneThree/add.vue"), |
| | | }, |
| | | { |
| | | path: "addThree", |
| | |
| | | meta: { |
| | | title: "报告库四", |
| | | keepAlive: true, |
| | | privilege:'strainReportLibrary_reportLibraryFour' |
| | | }, |
| | | component: () => |
| | | import("../views/strainReportLibrary/reportLibraryOneFour/index.vue"), |
| | | }, |
| | | { |
| | | path: "detailFour", |
| | | meta: { |
| | | title: "报告详情", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => |
| | | import("../views/strainReportLibrary/reportLibraryOneFour/add.vue"), |
| | | }, |
| | | { |
| | | path: "addFour", |
| | |
| | | ], |
| | | }, |
| | | { |
| | | path: "/strainOperationAssessment", |
| | | component: Layouts, |
| | | meta: { |
| | | title: "菌种库操作评定", |
| | | privilege:'strainOperationAssessment' |
| | | }, |
| | | children: [ |
| | | // { |
| | | // path: "list", |
| | | // meta: { |
| | | // title: "评定列表", |
| | | // privilege:'strainOperationAssessment_list' |
| | | // }, |
| | | // component: () => |
| | | // import("../views/strainOperationAssessment/index.vue"), |
| | | // }, |
| | | ], |
| | | }, |
| | | { |
| | | path: "/deliveryAssessment", |
| | | component: Layouts, |
| | | meta: { |
| | | title: "菌种报告评定", |
| | | title: "菌种工作评定", |
| | | privilege:'deliveryAssessment' |
| | | }, |
| | | children: [ |
| | | { |
| | | path: "projectTeamIntegral", |
| | | meta: { |
| | | title: "菌种项目组评定表", |
| | | privilege:'deliveryAssessment_projectTeamIntegral' |
| | | }, |
| | | component: () => |
| | | import("../views/deliveryAssessment/projectTeamIntegral"), |
| | |
| | | component: () => |
| | | import("../views/deliveryAssessment/projectTeamIntegral/detail.vue"), |
| | | }, |
| | | { |
| | | path: "list", |
| | | meta: { |
| | | title: "菌种库操作评定列表", |
| | | privilege:'strainOperationAssessment' |
| | | }, |
| | | component: () => |
| | | import("../views/strainOperationAssessment/index.vue"), |
| | | }, |
| | | ], |
| | | }, |
| | | ]; |
| | |
| | | base: process.env.BASE_URL, |
| | | routes, |
| | | }); |
| | | |
| | | let tagCacheSequence = 0; |
| | | const createTagCacheKey = (fullPath) => `${fullPath}::${Date.now()}-${tagCacheSequence++}`; |
| | | const getTagFullPath = (tag) => tag.fullPath || router.resolve({ |
| | | path: tag.path, |
| | | query: tag.query || {}, |
| | | }).route.fullPath; |
| | | const getViewIdentity = (path, query = {}) => { |
| | | const businessQuery = { ...query }; |
| | | delete businessQuery._view; |
| | | return router.resolve({ path, query: businessQuery }).route.fullPath; |
| | | }; |
| | | |
| | | // 前置路由拦截器 |
| | | router.beforeEach((to, from, next) => { |
| | |
| | | } |
| | | |
| | | // 判断是否拥有要跳转菜单权限 |
| | | let menus = store.state.menus; |
| | | if ( |
| | | to.meta.hasOwnProperty("privilege") && |
| | | !menus.includes(to.meta.privilege) |
| | | ) { |
| | | // 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 |
| | | } |
| | | } |
| | | |
| | | // Hidden business pages are independent tab instances. An existing tab keeps |
| | | // its _view; entering from a list again creates a clean component instance. |
| | | const isIndependentView = Boolean(to.meta.hide && !to.meta.oneself); |
| | | if (isIndependentView && !to.query._view) { |
| | | const viewIdentity = getViewIdentity(to.path, to.query); |
| | | const tagList = JSON.parse(sessionStorage.getItem("tagList") || "[]"); |
| | | const staleTags = tagList.filter((tag) => |
| | | getViewIdentity(tag.path, tag.query) === viewIdentity |
| | | ); |
| | | |
| | | if (staleTags.length) { |
| | | const staleKeys = staleTags.map((tag) => tag.cacheKey || getTagFullPath(tag)); |
| | | const remainingTags = tagList.filter((tag) => |
| | | getViewIdentity(tag.path, tag.query) !== viewIdentity |
| | | ); |
| | | store.commit("SET_TAGLIST", remainingTags); |
| | | store.commit("PRUNE_VIEW_CACHE", staleKeys); |
| | | } |
| | | |
| | | next({ |
| | | path: to.path, |
| | | query: { ...to.query, _view: `${Date.now()}-${tagCacheSequence++}` }, |
| | | replace: true, |
| | | }); |
| | | return; |
| | | } |
| | | |
| | |
| | | if (!to.meta.hide || !to.meta.oneself) { |
| | | let tagList = JSON.parse(sessionStorage.getItem("tagList") || "[]"); |
| | | // 判断是否存在 |
| | | let isExist = tagList.some((item) => item.path === to.path); |
| | | let isExist = tagList.some((item) => getTagFullPath(item) === to.fullPath); |
| | | if (!isExist) { |
| | | // 只保存必要的信息 |
| | | const tagInfo = { |
| | | path: to.path, |
| | | fullPath: to.fullPath, |
| | | name: to.name, |
| | | meta: to.meta, |
| | | query: to.query, |
| | | cacheKey: createTagCacheKey(to.fullPath), |
| | | }; |
| | | tagList.push(tagInfo); |
| | | sessionStorage.setItem("tagList", JSON.stringify(tagList)); |
| | |
| | | let keepAliveList = JSON.parse( |
| | | sessionStorage.getItem("keepAliveList") || "[]" |
| | | ); |
| | | |
| | | const cacheName = to.meta.componentName || to.name; // 优先用组件真实name |
| | | |
| | | // 判断是否已经缓存 |
| | | let isExist = keepAliveList.includes(to.name); |
| | | let isExist = keepAliveList.includes(cacheName); |
| | | if (!isExist) { |
| | | keepAliveList.push(to.name); |
| | | keepAliveList.push(cacheName); |
| | | sessionStorage.setItem("keepAliveList", JSON.stringify(keepAliveList)); |
| | | store.commit("SET_KEEPALIVELIST", keepAliveList); |
| | | } |