From ac33a3fb2bfc4d4b11b958afe4d4b462d96fbb26 Mon Sep 17 00:00:00 2001
From: pyt <626651354@qq.com>
Date: 星期二, 01 四月 2025 10:38:20 +0800
Subject: [PATCH] Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory

---
 src/router/index.js |   96 ++++++++++++++++++++++++++++--------------------
 1 files changed, 56 insertions(+), 40 deletions(-)

diff --git a/src/router/index.js b/src/router/index.js
index 9401f17..8c706f4 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -25,18 +25,21 @@
 
 const routes = [
     {
+        path: "/login",
+        meta: {
+            title: "登录",
+            oneself: true,
+            hide: true,
+        },
+        component: () => import("../views/login"),
+    },
+    {
         path: "/",
-        redirect: "login",
         component: Layouts,
         children: [
             {
-                path: "/login",
-                meta: {
-                    title: "登录",
-                    oneself: true,
-                    hide: true,
-                },
-                component: () => import("../views/login"),
+                path: "",
+                redirect: "/projectList/list"
             },
             {
                 path: "/projectList",
@@ -50,9 +53,18 @@
                         name: "ProjectList",
                         meta: {
                             title: "项目组管理",
-                            keepAlive: true,
                         },
                         component: () => import("../views/projectList"),
+                    },
+                    {
+                        path: "addProject",
+                        name: "AddProject",
+                        meta: {
+                            title: "新增项目组",
+                            hide: true,
+                            keepAlive: true,
+                        },
+                        component: () => import("../views/projectList/addProject"),
                     }
                 ]
             },
@@ -69,7 +81,7 @@
                             title: "项目课题方案审批",
                             keepAlive: true,
                         },
-                        component: () => import("../views/approvalPlan/list.vue"),
+                        component: () => import("../views/dataManagement/approvalPlan/list.vue"),
                     },
                     {
                         path: "/dispatching",
@@ -77,11 +89,10 @@
                             title: "实验调度管理",
                             keepAlive: true,
                         },
-                        component: () => import("../views/dispatching/list.vue"),
+                        component: () => import("../views/dataManagement/dispatching/list.vue"),
                     },
                 ],
             }
-
         ],
     },
 ];
@@ -97,21 +108,7 @@
     // 设置当前页签名称
     document.title = to.meta.title || '实验室流程';
 
-    // 判断是否需要缓存
-    if (to.meta.keepAlive) {
-        store.commit('SET_KEEPALIVELIST', [...store.state.keepAliveList, to.name])
-    }
-    // 设置标签列表
-    if (!to.meta.hide || !to.meta.oneself) {
-        // 判断是否存在
-        let isExist = store.state.tagList.some(item => item.path === to.path)
-        if (!isExist) {
-            store.commit('SET_TAGLIST', [...store.state.tagList, to])
-        }
-    }
-    next()
-
-    // 没有登录并且要去的页面不是登录页面,在强制跳转到登录
+    // 登录验证
     // if (to.path === "/login") {
     //     localStorage.removeItem('userInfo')
     //     next()
@@ -123,19 +120,38 @@
     //     if (to.meta.hasOwnProperty('privilege') && !menus.includes(to.meta.privilege)) {
     //         return
     //     }
-    // 设置标签列表
-    // if (!to.meta.hide || !to.meta.oneself) {
-    //     // 判断是否存在
-    //     let isExist = store.state.tagList.some(item => item.path === to.path)
-    //     if (!isExist) {
-    //         store.commit('SET_TAGLIST', [...store.state.tagList, to])
-    //     }
-    // }
-    //     // 判断是否需要缓存
-    //     if (to.meta.keepAlive) {
-    //         store.commit('SET_KEEPALIVELIST', [...store.state.keepAliveList, to.name])
-    //     }
-    //     next()
+
+        // 设置标签列表
+        if (!to.meta.hide || !to.meta.oneself) {
+            let tagList = JSON.parse(localStorage.getItem('tagList') || '[]')
+            // 判断是否存在
+            let isExist = tagList.some(item => item.path === to.path)
+            if (!isExist) {
+                // 只保存必要的信息
+                const tagInfo = {
+                    path: to.path,
+                    name: to.name,
+                    meta: to.meta
+                }
+                tagList.push(tagInfo)
+                localStorage.setItem('tagList', JSON.stringify(tagList))
+                store.commit('SET_TAGLIST', tagList)
+            }
+        }
+
+        // 判断是否需要缓存
+        if (to.meta.keepAlive) {
+            let keepAliveList = JSON.parse(localStorage.getItem('keepAliveList') || '[]')
+            // 判断是否已经缓存
+            let isExist = keepAliveList.includes(to.name)
+            if (!isExist) {
+                keepAliveList.push(to.name)
+                localStorage.setItem('keepAliveList', JSON.stringify(keepAliveList))
+                store.commit('SET_KEEPALIVELIST', keepAliveList)
+            }
+        }
+
+        next()
     // }
 });
 

--
Gitblit v1.7.1