| | |
| | | const routes = [ |
| | | { |
| | | path: "/", |
| | | redirect: "/projectList/list", |
| | | redirect: "/login", |
| | | }, |
| | | { |
| | | path: "/login", |
| | |
| | | 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"), |
| | | } |
| | | ] |
| | | }, |
| | |
| | | hide: true, |
| | | }, |
| | | component: () => import("../views/dataManagement/confirmation-sheet/components/add.vue"), |
| | | }, |
| | | { |
| | | path: "scheme-management", |
| | | name: "schemeManagement", |
| | | meta: { |
| | | title: "实验方案管理", |
| | | }, |
| | | component: () => import("../views/dataManagement/schemeManagement/list.vue"), |
| | | }, |
| | | { |
| | | path: "scheme-management/add", |
| | | name: "addSchemeManagement", |
| | | meta: { |
| | | title: "添加实验方案", |
| | | hide: true, |
| | | }, |
| | | component: () => import("../views/dataManagement/schemeManagement/addPlan.vue"), |
| | | }, { |
| | | path: "scheme-management/stop-experiment", |
| | | name: "schemeManagementStopExperiment", |
| | | meta: { |
| | | title: "终止实验方案", |
| | | hide: true, |
| | | }, |
| | | component: () => import("../views/dataManagement/schemeManagement/stop-experiment.vue"), |
| | | }, |
| | | { |
| | | path: "/sampleManage", |
| | |
| | | }, |
| | | component: () => import("../views/dataManagement/testResultReport/detail.vue"), |
| | | }, |
| | | { |
| | | path: "suspendExperiment", |
| | | meta: { |
| | | title: "实验中止审批", |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/dataManagement/suspendExperiment/list.vue"), |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | |
| | | { |
| | | 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: { |
| | |
| | | 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: "工艺开发工具", |
| | |
| | | }, |
| | | 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: { |
| | |
| | | keepAlive: true, |
| | | }, |
| | | component: () => import("../views/reportLibrary/projectProposalLibrary/index.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"), |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | component: () => import("../views/deliveryAssessment/restsTask"), |
| | | }, |
| | | { |
| | | // 超级管理员 工艺工程师 |
| | | // 超级管理员 工艺工程师 审批人 |
| | | path: "clinicalTrial", |
| | | meta: { |
| | | title: "临床试验积分列表", |
| | |
| | | component: () => import("../views/deliveryAssessment/clinicalTrial"), |
| | | }, |
| | | { |
| | | // 化验师 审批人 |
| | | // 化验师 审批人 工艺工程师 |
| | | path: "testingAndEvaluation", |
| | | meta: { |
| | | title: "检测项评定列表", |
| | |
| | | component: () => import("../views/deliveryAssessment/assayTaskList"), |
| | | }, |
| | | { |
| | | // 工艺工程师 |
| | | // 工艺工程师 审批人 |
| | | path: "processEngineerEvaluate", |
| | | meta: { |
| | | title: "工艺工程师工作评定详情", |
| | |
| | | }, |
| | | 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"), |
| | | }, |
| | | ] |
| | | } |
| | | ]; |
| | |
| | | document.title = to.meta.title || '实验室流程'; |
| | | |
| | | // 登录验证 |
| | | // if (to.path === "/login") { |
| | | // localStorage.removeItem('userInfo') |
| | | // next() |
| | | // } else if (!localStorage.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) { |
| | | 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) { |
| | |
| | | const tagInfo = { |
| | | path: to.path, |
| | | name: to.name, |
| | | meta: to.meta |
| | | meta: to.meta, |
| | | query: to.query, |
| | | } |
| | | 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) |
| | | } |
| | | } |
| | | |
| | | next() |
| | | // } |
| | | }); |
| | | |
| | | export default router; |