From 0db8c9b94a9ac655549d5eba5c2a6c92ac386c06 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 08 十月 2026 11:20:56 +0800
Subject: [PATCH] 提交最新代码
---
culture/src/router/index.js | 101 +++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 91 insertions(+), 10 deletions(-)
diff --git a/culture/src/router/index.js b/culture/src/router/index.js
index 7840524..10022be 100644
--- a/culture/src/router/index.js
+++ b/culture/src/router/index.js
@@ -60,7 +60,7 @@
name: "ProjectList",
meta: {
title: "菌种库项目组管理",
- privilege:'projectList_list'
+ privilege:'projectList_list',
},
component: () => import("../views/projectList"),
},
@@ -80,6 +80,7 @@
meta: {
title: "编辑菌种库项目组",
hide: true,
+ keepAlive: true,
},
component: () => import("../views/projectList/editProject"),
},
@@ -135,6 +136,7 @@
meta: {
title: "编辑角色",
hide: true,
+ keepAlive: true,
},
component: () => import("../views/system/role/edit"),
},
@@ -189,16 +191,20 @@
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"),
@@ -231,16 +237,22 @@
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"),
@@ -261,6 +273,8 @@
meta: {
title: "新增生产细胞",
hide: true,
+ keepAlive: true,
+ componentName: "ProductionCellLibraryAdd"
},
component: () =>
import("../views/strain-library/production-cell-library/add.vue"),
@@ -281,26 +295,32 @@
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"),
@@ -331,6 +351,7 @@
meta: {
title: "新增母代菌种传代生产谱系图",
hide: true,
+ keepAlive: true,
},
component: () => import("../views/pedigree-chart/add"),
},
@@ -340,6 +361,7 @@
meta: {
title: "新增祖代菌种传代生产谱系图",
hide: true,
+ keepAlive: true,
},
component: () => import("../views/pedigree-chart/addProgenitor"),
},
@@ -376,6 +398,8 @@
meta: {
title: "新增菌种选育保藏记录",
hide: true,
+ keepAlive: true,
+ componentName: "BreedingRecordAdd"
},
component: () => import("../views/strain-library/breeding-record/add"),
},
@@ -385,6 +409,8 @@
meta: {
title: "编辑菌种选育保藏记录",
hide: true,
+ keepAlive: true,
+ componentName: "BreedingRecordAdd"
},
component: () => import("../views/strain-library/breeding-record/add"),
},
@@ -423,6 +449,8 @@
meta: {
title: "新增祖代菌种库验证资料",
hide: true,
+ keepAlive: true,
+ componentName: "PrimitiveCellAdd"
},
component: () =>
import(
@@ -431,10 +459,12 @@
},
{
path: "edit-primitive-cell",
- name: "AddPrimitiveCell",
+ name: "EditPrimitiveCell",
meta: {
title: "编辑祖代菌种库验证资料",
hide: true,
+ keepAlive: true,
+ componentName: "PrimitiveCellAdd"
},
component: () =>
import(
@@ -447,6 +477,7 @@
meta: {
title: "确认祖代菌种库验证资料",
hide: true,
+ keepAlive: true,
},
component: () =>
import(
@@ -469,9 +500,11 @@
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",
@@ -479,6 +512,8 @@
meta: {
title: "编辑母代菌种库验证资料",
hide: true,
+ keepAlive: true,
+ componentName: "ChiefCellAdd"
},
component: () =>
import("../views/strain-library/validation/chief-cell/add.vue"),
@@ -523,6 +558,7 @@
title: "新增报告",
hide: true,
keepAlive: true,
+ componentName: "ReportLibraryOneAdd"
},
component: () =>
import("../views/strainReportLibrary/reportLibraryOne/add.vue"),
@@ -533,6 +569,7 @@
title: "报告详情",
hide: true,
keepAlive: true,
+ componentName: "ReportLibraryOneAdd"
},
component: () =>
import("../views/strainReportLibrary/reportLibraryOne/add.vue"),
@@ -695,6 +732,18 @@
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) => {
// 设置当前页签名称
@@ -743,18 +792,47 @@
}
}
+ // 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));
@@ -767,10 +845,13 @@
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);
}
--
Gitblit v1.7.1