董国庆
2025-05-21 c85d2427b749c5e7236f0474f9215e5936cdfa7c
laboratory/src/router/index.js
@@ -23,10 +23,9 @@
    }
 */
const routes = [
    {
const routes = [{
        path: "/",
        redirect: "/projectList/list",
        redirect: "/login",
    },
    {
        path: "/login",
@@ -43,8 +42,7 @@
            title: "系统管理",
        },
        component: Layouts,
        children: [
            {
        children: [{
                path: "user",
                name: "User",
                meta: {
@@ -102,8 +100,7 @@
            title: "项目组管理",
        },
        component: Layouts,
        children: [
            {
        children: [{
                path: "list",
                name: "ProjectList",
                meta: {
@@ -120,6 +117,24 @@
                    keepAlive: true,
                },
                component: () => import("../views/projectList/addProject"),
            },
            {
                path: "editProject",
                name: "EditProject",
                meta: {
                    title: "编辑项目组",
                    hide: true,
                },
                component: () => import("../views/projectList/editProject"),
            },
            {
                path: "detailProject",
                name: "DetailProject",
                meta: {
                    title: "项目组详情",
                    hide: true,
                },
                component: () => import("../views/projectList/detailProject"),
            }
        ]
    },
@@ -129,8 +144,7 @@
        meta: {
            title: "实验室数据管理",
        },
        children: [
            {
        children: [{
                path: "approvalPlan",
                meta: {
                    title: "项目课题方案审批",
@@ -214,8 +228,7 @@
                    // keepAlive: true,
                },
                component: Parent,
                children: [
                    {
                children: [{
                        path: "manage",
                        meta: {
                            title: "样品管理",
@@ -342,6 +355,14 @@
                },
                component: () => import("../views/dataManagement/testResultReport/detail.vue"),
            },
            {
                path: "suspendExperiment",
                meta: {
                    title: "实验中止审批",
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/suspendExperiment/list.vue"),
            },
        ],
    },
    {
@@ -350,8 +371,7 @@
        meta: {
            title: "专业报告库审批",
        },
        children: [
            {
        children: [{
                path: "feasibilityStudy",
                meta: {
                    title: "可研报告库",
@@ -362,12 +382,22 @@
            {
                path: "add",
                meta: {
                    title: "新增可行报告",
                    title: "新增可研报告",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/feasibilityStudy/add.vue"),
            },
            {
                path: "edit",
                meta: {
                    title: "编辑可研报告",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/feasibilityStudy/add.vue"),
            },
            {
                path: "feasibilityReport",
                meta: {
@@ -377,6 +407,26 @@
                component: () => import("../views/reportLibrary/feasibilityReport/index.vue"),
            },
            {
                path: "addFeasibility",
                meta: {
                    title: "新增可行报告",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/feasibilityReport/add.vue"),
            },
            {
                path: "editFeasibility",
                meta: {
                    title: "编辑可行报告",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/feasibilityReport/add.vue"),
            },
            {
                path: "processDevelopment",
                meta: {
                    title: "工艺开发工具",
@@ -384,6 +434,28 @@
                },
                component: () => import("../views/reportLibrary/processDevelopment/index.vue"),
            },
            {
                path: "addProcessDevelopment",
                meta: {
                    title: "新增工艺开发工具",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/processDevelopment/add.vue"),
            },
            {
                path: "editProcessDevelopment",
                meta: {
                    title: "编辑工艺开发工具",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/processDevelopment/add.vue"),
            },
            {
                path: "verificationRelease",
                meta: {
@@ -393,12 +465,133 @@
                component: () => import("../views/reportLibrary/verificationRelease/index.vue"),
            },
            {
                path: "addVerificationRelease",
                meta: {
                    title: "新增验证与发布",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/verificationRelease/add.vue"),
            },
            {
                path: "editVerificationRelease",
                meta: {
                    title: "新增验证与发布",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/verificationRelease/add.vue"),
            },
            {
                path: "projectProposalLibrary",
                meta: {
                    title: "立项报告库",
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/projectProposalLibrary/index.vue"),
            },
            {
                path: "addProjectProposalLibrary",
                meta: {
                    title: "新增立项报告",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/projectProposalLibrary/add.vue"),
            },
            {
                path: "editProjectProposalLibrary",
                meta: {
                    title: "编辑立项报告",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/projectProposalLibrary/add.vue"),
            },
        ],
    },
    {
        path: "/chemistQa",
        component: Layouts,
        meta: {
            title: "化验师QA专题报告",
        },
        children: [{
                path: "projectTesting",
                meta: {
                    title: "项目检测项、检验包列表",
                    keepAlive: true,
                },
                component: () => import("../views/chemistQa/projectTesting/index.vue"),
            },
            {
                path: "add",
                meta: {
                    title: "新增检测项",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/chemistQa/projectTesting/add.vue"),
            },
            {
                path: "addDetectionReport",
                meta: {
                    title: "新增报告",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/chemistQa/projectTesting/addDetectionReport.vue"),
            },
            {
                path: "pilotAndProduction",
                meta: {
                    title: "中试、生产验证试验检验分析报告",
                    keepAlive: true,
                },
                component: () => import("../views/chemistQa/pilotAndProduction/index.vue"),
            },
            {
                path: "addPilot",
                meta: {
                    title: "新增中试、生产验证试验检验分析报告",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/chemistQa/pilotAndProduction/add.vue"),
            },
            {
                path: "rawMaterials",
                meta: {
                    title: "原辅料、包材、竞品检验分析报告",
                    keepAlive: true,
                },
                component: () => import("../views/chemistQa/rawMaterials/index.vue"),
            },
            {
                path: "addRawMaterials",
                meta: {
                    title: "新增原辅料、包材、竞品检验分析报告",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/chemistQa/rawMaterials/add.vue"),
            },
            {
                path: "productApproval",
                meta: {
                    title: "产品报批及项目工作总计报告",
                    keepAlive: true,
                },
                component: () => import("../views/chemistQa/productApproval/index.vue"),
            },
            {
                path: "addProductApproval",
                meta: {
                    title: "新增产品报批及项目工作总计报告",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/chemistQa/productApproval/add.vue"),
            },
        ],
    },
@@ -408,8 +601,7 @@
        meta: {
            title: "工作交付评定",
        },
        children: [
            {
        children: [{
                path: "projectTeamIntegral",
                meta: {
                    title: "项目组总积分",
@@ -441,7 +633,7 @@
                component: () => import("../views/deliveryAssessment/restsTask"),
            },
            {
                // 超级管理员 工艺工程师
                // 超级管理员 工艺工程师 审批人
                path: "clinicalTrial",
                meta: {
                    title: "临床试验积分列表",
@@ -449,7 +641,7 @@
                component: () => import("../views/deliveryAssessment/clinicalTrial"),
            },
            {
                // 化验师 审批人
                // 化验师 审批人 工艺工程师
                path: "testingAndEvaluation",
                meta: {
                    title: "检测项评定列表",
@@ -473,7 +665,7 @@
                component: () => import("../views/deliveryAssessment/assayTaskList"),
            },
            {
                // 工艺工程师
                // 工艺工程师 审批人
                path: "processEngineerEvaluate",
                meta: {
                    title: "工艺工程师工作评定详情",
@@ -518,6 +710,46 @@
                },
                component: () => import("../views/deliveryAssessment/chemistEvaluate/add"),
            },
            {
                // 工艺工程师
                path: "QAList",
                name: 'QAList',
                meta: {
                    title: "化验师QA专题报告评定",
                    keepAlive: true,
                },
                component: () => import("../views/deliveryAssessment/QA"),
            },
            {
                // 审批人
                path: "experimenterJobEvaluation",
                name: 'ExperimenterJobEvaluation',
                meta: {
                    title: "实验员工作评定详情",
                    keepAlive: true,
                },
                component: () => import("../views/deliveryAssessment/experimenterJobEvaluation"),
            },
            {
                // 审批人
                path: "technicianJobEvaluation",
                name: 'TechnicianJobEvaluation',
                meta: {
                    title: "化验师工作评定详情",
                    keepAlive: true,
                },
                component: () => import("../views/deliveryAssessment/technicianJobEvaluation"),
            },
            {
                // 审批人
                path: "reportEvaluation",
                name: 'ReportEvaluation',
                meta: {
                    title: "专业报告库评定",
                    keepAlive: true,
                },
                component: () => import("../views/deliveryAssessment/reportEvaluation"),
            },
        ]
    }
];
@@ -534,17 +766,28 @@
    document.title = to.meta.title || '实验室流程';
    // 登录验证
    // if (to.path === "/login") {
    //     sessionStorage.removeItem('userInfo')
    //     next()
    // } else if (!sessionStorage.getItem('userInfo')) {
    //     next('/login')
    // } else {
    //     // 判断是否拥有要跳转菜单权限
    //     let menus = store.state.menus
    //     if (to.meta.hasOwnProperty('privilege') && !menus.includes(to.meta.privilege)) {
    //         return
    //     }
    // 排除登录页的校验
    if (to.path === "/login") {
        if (sessionStorage.getItem('token')) {
            next('/system'); // 已登录状态访问登录页时重定向到系统首页
            return;
        }
        next();
        return;
    }
    // 登录状态校验
    const isAuthenticated = sessionStorage.getItem('token');
    if (!isAuthenticated) {
        next('/login'); // 未登录用户重定向到登录页
        return;
    }
    // 判断是否拥有要跳转菜单权限
    let menus = store.state.menus
    if (to.meta.hasOwnProperty('privilege') && !menus.includes(to.meta.privilege)) {
        return
    }
    // 设置标签列表
    if (!to.meta.hide || !to.meta.oneself) {
@@ -556,7 +799,8 @@
            const tagInfo = {
                path: to.path,
                name: to.name,
                meta: to.meta
                meta: to.meta,
                query: to.query,
            }
            tagList.push(tagInfo)
            sessionStorage.setItem('tagList', JSON.stringify(tagList))
@@ -577,7 +821,6 @@
    }
    next()
    // }
});
export default router;
export default router;