pyt
2025-04-28 35743f996ade9e2993fb15a274bf3dbb6a3df9d7
culture/src/router/index.js
@@ -38,6 +38,33 @@
        component: () => import("../views/login"),
    },
    {
        path: "/projectList",
        meta: {
            title: "项目组管理",
        },
        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: "/system",
        meta: {
            title: "系统管理",
@@ -97,32 +124,99 @@
        ]
    },
    {
        path: "/projectList",
        meta: {
            title: "项目组管理",
        },
        path: "/strain",
        component: Layouts,
        meta: {
            title: "菌种库",
        },
        children: [
            {
                path: "list",
                name: "ProjectList",
                path: "/strain-library",
                component: Parent,
                meta: {
                    title: "项目组管理",
                   title: "菌种库管理",
                },
                component: () => import("../views/projectList"),
                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: "菌种传代生产谱系图",
            },
            {
                path: "addProject",
                name: "AddProject",
                meta: {
                    title: "新增项目组",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/projectList/addProject"),
            }
            component: () => import("../views/pedigree-chart"),
           }
        ]
    },
    {
        path: "/dataManagement",
        component: Layouts,
@@ -509,9 +603,9 @@
    // 登录验证
    // if (to.path === "/login") {
    //     localStorage.removeItem('userInfo')
    //     sessionStorage.removeItem('userInfo')
    //     next()
    // } else if (!localStorage.getItem('userInfo')) {
    // } else if (!sessionStorage.getItem('userInfo')) {
    //     next('/login')
    // } else {
    //     // 判断是否拥有要跳转菜单权限
@@ -522,7 +616,7 @@
    // 设置标签列表
    if (!to.meta.hide || !to.meta.oneself) {
        let tagList = JSON.parse(localStorage.getItem('tagList') || '[]')
        let tagList = JSON.parse(sessionStorage.getItem('tagList') || '[]')
        // 判断是否存在
        let isExist = tagList.some(item => item.path === to.path)
        if (!isExist) {
@@ -533,19 +627,19 @@
                meta: to.meta
            }
            tagList.push(tagInfo)
            localStorage.setItem('tagList', JSON.stringify(tagList))
            sessionStorage.setItem('tagList', JSON.stringify(tagList))
            store.commit('SET_TAGLIST', tagList)
        }
    }
    // 判断是否需要缓存
    if (to.meta.keepAlive) {
        let keepAliveList = JSON.parse(localStorage.getItem('keepAliveList') || '[]')
        let keepAliveList = JSON.parse(sessionStorage.getItem('keepAliveList') || '[]')
        // 判断是否已经缓存
        let isExist = keepAliveList.includes(to.name)
        if (!isExist) {
            keepAliveList.push(to.name)
            localStorage.setItem('keepAliveList', JSON.stringify(keepAliveList))
            sessionStorage.setItem('keepAliveList', JSON.stringify(keepAliveList))
            store.commit('SET_KEEPALIVELIST', keepAliveList)
        }
    }