| | |
| | | name: "ProjectList", |
| | | meta: { |
| | | title: "菌种库项目组管理", |
| | | privilege:'projectList_list' |
| | | privilege:'projectList_list', |
| | | }, |
| | | component: () => import("../views/projectList"), |
| | | }, |
| | |
| | | meta: { |
| | | title: "编辑菌种库项目组", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/projectList/editProject"), |
| | | }, |
| | |
| | | meta: { |
| | | title: "编辑角色", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/system/role/edit"), |
| | | }, |
| | |
| | | meta: { |
| | | title: "新增原始细胞库", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "StrainLibraryManageAdd", |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/strain-library-manage/add.vue"), |
| | | }, |
| | | { |
| | | path: "strain-library-manage/detail", |
| | | name: "StrainLibraryManageAdd", |
| | | name: "StrainLibraryManageEdit", |
| | | meta: { |
| | | title: "编辑原始细胞库", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "StrainLibraryManageAdd", |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/strain-library-manage/add.vue"), |
| | |
| | | meta: { |
| | | title: "新增主细胞", |
| | | hide: true, |
| | | keepAlive: true, |
| | | formMode: "add", |
| | | componentName: "MainCellLibraryAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/main-cell-library/add.vue"), |
| | | }, |
| | | { |
| | | path: "main-cell-library/edit", |
| | | name: "MainCellLibraryAdd", |
| | | name: "MainCellLibraryEdit", |
| | | meta: { |
| | | title: "编辑主细胞", |
| | | hide: true, |
| | | keepAlive: true, |
| | | formMode: "edit", |
| | | componentName: "MainCellLibraryAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/main-cell-library/add.vue"), |
| | |
| | | meta: { |
| | | title: "新增生产细胞", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ProductionCellLibraryAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/production-cell-library/add.vue"), |
| | |
| | | meta: { |
| | | title: "新增生产细胞", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ProductionCellGrandsonAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/production-cell-grandson/add.vue"), |
| | | }, |
| | | { |
| | | path: "production-cell-grandson/edit", |
| | | name: "ProductionCellGrandsonAdd", |
| | | 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: "ProductionCellLibraryAdd", |
| | | name: "ProductionCellLibraryEdit", |
| | | meta: { |
| | | title: "编辑生产细胞", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ProductionCellLibraryAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/production-cell-library/add.vue"), |
| | |
| | | meta: { |
| | | title: "新增母代菌种传代生产谱系图", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/pedigree-chart/add"), |
| | | }, |
| | |
| | | meta: { |
| | | title: "新增祖代菌种传代生产谱系图", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/pedigree-chart/addProgenitor"), |
| | | }, |
| | |
| | | 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"), |
| | | }, |
| | |
| | | meta: { |
| | | title: "新增祖代菌种库验证资料", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "PrimitiveCellAdd" |
| | | }, |
| | | component: () => |
| | | import( |
| | |
| | | }, |
| | | { |
| | | path: "edit-primitive-cell", |
| | | name: "AddPrimitiveCell", |
| | | name: "EditPrimitiveCell", |
| | | meta: { |
| | | title: "编辑祖代菌种库验证资料", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "PrimitiveCellAdd" |
| | | }, |
| | | component: () => |
| | | import( |
| | |
| | | meta: { |
| | | title: "确认祖代菌种库验证资料", |
| | | hide: true, |
| | | keepAlive: true, |
| | | }, |
| | | component: () => |
| | | import( |
| | |
| | | meta: { |
| | | title: "新增母代菌种库验证资料", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ChiefCellAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/validation/chief-cell/add.vue"), |
| | | import("../views/strain-library/validation/chief-cell/add.vue"), |
| | | }, |
| | | { |
| | | path: "edit-chief-cell", |
| | |
| | | meta: { |
| | | title: "编辑母代菌种库验证资料", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ChiefCellAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strain-library/validation/chief-cell/add.vue"), |
| | |
| | | title: "新增报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ReportLibraryOneAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strainReportLibrary/reportLibraryOne/add.vue"), |
| | |
| | | title: "报告详情", |
| | | hide: true, |
| | | keepAlive: true, |
| | | componentName: "ReportLibraryOneAdd" |
| | | }, |
| | | component: () => |
| | | import("../views/strainReportLibrary/reportLibraryOne/add.vue"), |
| | |
| | | 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) => { |
| | | // 设置当前页签名称 |
| | |
| | | } |
| | | } |
| | | |
| | | // 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); |
| | | } |