董国庆
2 天以前 06b2be3bbb48e0275fbd25624c1cce54a7cac2b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
import Vue from "vue";
import VueRouter from "vue-router";
import Layouts from "../layouts";
import Parent from "../layouts/components/AppContent"
import store from "../store";
 
Vue.use(VueRouter);
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
 
/**
 *  path: "/login",   ------页面地址
    component: () => import("../views/login"),  ------组件地址
    name: "Login",  ------组件名称 缓存时需要 唯一性
    meta: {
      title: "登录",    ------页面标题
      icon: "el-icon-user-solid",  ------菜单图标
      oneself: true,  ------是否在单独页面打开
      hide: true,  ------是否隐藏改菜单
      keepAlive: true,  ------是否缓存
    }
 */
 
const routes = [
    {
        path: "/",
        redirect: "/login",
    },
    {
        path: "/login",
        meta: {
            title: "登录",
            oneself: true,
            hide: true,
        },
        component: () => import("../views/login"),
    },
    {
        path: "/system",
        meta: {
            title: "系统管理",
        },
        component: Layouts,
        children: [
            {
                path: "user",
                name: "User",
                meta: {
                    title: "人员管理",
                },
                component: () => import("../views/system/user"),
            },
            {
                path: "role",
                name: "Role",
                meta: {
                    title: "角色管理",
                },
                component: () => import("../views/system/role"),
            },
            {
                path: "add-role",
                name: "AddRole",
                meta: {
                    title: "新增角色",
                    hide: true,
                },
                component: () => import("../views/system/role/add"),
            },
            {
                path: "edit-role",
                name: "EditRole",
                meta: {
                    title: "编辑角色",
                    hide: true,
                },
                component: () => import("../views/system/role/edit"),
            },
            {
                path: "detail-role",
                name: "DetailRole",
                meta: {
                    title: "角色详情",
                    hide: true,
                },
                component: () => import("../views/system/role/detail"),
            },
            {
                path: "operation-log",
                meta: {
                    title: "操作日志",
                },
                component: () => import("../views/system/operation-log"),
            },
        ]
    },
    {
        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: "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"),
            }
        ]
    },
    {
        path: "/dataManagement",
        component: Layouts,
        meta: {
            title: "实验室数据管理",
        },
        children: [
            {
                path: "approvalPlan",
                meta: {
                    title: "项目课题方案审批",
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/approvalPlan/list.vue"),
            },
            {
                path: "addPlan",
                name: "addPlan",
                meta: {
                    title: "新增项目课题方案",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/approvalPlan/addPlan"),
            },
            {
                path: "dispatching",
                meta: {
                    title: "实验调度管理",
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/dispatching/list.vue"),
            },
            {
                path: "addDispatch",
                meta: {
                    title: "新增实验调度",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/dispatching/addDispatch"),
            },
            {
                path: "confirmation-sheet",
                name: "ConfirmationSheet",
                meta: {
                    title: "检验方法确认单",
                },
                component: () => import("../views/dataManagement/confirmation-sheet"),
            },
            {
                path: "confirmation-sheet/add",
                name: "AddConfirmationSheet",
                meta: {
                    title: "检验方法确认单",
                    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",
                meta: {
                    title: "样品管理",
                    // keepAlive: true,
                },
                component: Parent,
                children: [
                    {
                        path: "manage",
                        meta: {
                            title: "样品管理",
                            keepAlive: true,
                        },
                        component: () => import("../views/dataManagement/sampleManage/list.vue"),
                    },
                    {
                        path: "addSample",
                        name: "addPaddSamplelan",
                        meta: {
                            title: "新增样品",
                            hide: true,
                            keepAlive: true,
                        },
                        component: () => import("../views/dataManagement/sampleManage/addSample"),
                    }, {
                        path: "record",
                        meta: {
                            title: "取样操作记录列表",
                            keepAlive: true,
                        },
                        component: () => import("../views/dataManagement/sampleRecordList/list.vue"),
                    },
                    {
                        path: "changeRecord",
                        name: "changeRecord",
                        meta: {
                            title: "填写取样操作记录",
                            hide: true,
                            keepAlive: true,
                        },
                        component: () => import("../views/dataManagement/sampleRecordList/changeRecord"),
                    }, {
                        path: "submissionList",
                        meta: {
                            title: "送样单列表",
                            keepAlive: true,
                        },
                        component: () => import("../views/dataManagement/sampleSubmissionList/list.vue"),
                    },
                    {
                        path: "submission",
                        name: "submission",
                        meta: {
                            title: "送样单详情",
                            hide: true,
                            keepAlive: true,
                        },
                        component: () => import("../views/dataManagement/sampleSubmissionList/submission"),
                    },
                ]
 
            },
            {
                path: "deliveryRecord",
                meta: {
                    title: "取样送样记录",
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/SampleDeliveryRecord/list.vue"),
            },
            {
                path: "delivery",
                name: "delivery",
                meta: {
                    title: "送样详情",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/SampleDeliveryRecord/deliveryRecord"),
            },
            {
                path: "originalRecordTest",
                meta: {
                    title: "原始检验记录",
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/originalRecordTest/list.vue"),
            },
            {
                path: "originalRecordTest/detail",
                name: "OriginalRecordTestDetail",
                meta: {
                    title: "原始检验记录详情",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/originalRecordTest/detail.vue"),
            },
            {
                path: "inspectionReport",
                meta: {
                    title: "检验报告管理",
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/inspectionReport/list.vue"),
            },
            {
                path: "inspectionReport/detail",
                name: "inspectionReportDetail",
                meta: {
                    title: "检验报告详情",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/inspectionReport/detail.vue"),
            },
            {
                path: "testResultReport",
                meta: {
                    title: "实验结果汇报",
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/testResultReport/list.vue"),
            },
            {
                path: "testResultReport/detail",
                name: "testResultReportDetail",
                meta: {
                    title: "实验结果详情",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/testResultReport/detail.vue"),
            },
            {
                path: "suspendExperiment",
                meta: {
                    title: "实验中止审批",
                    keepAlive: true,
                },
                component: () => import("../views/dataManagement/suspendExperiment/list.vue"),
            },
        ],
    },
    {
        path: "/reportLibrary",
        component: Layouts,
        meta: {
            title: "专业报告库审批",
        },
        children: [
            {
                path: "feasibilityStudy",
                meta: {
                    title: "可研报告库",
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/feasibilityStudy/index.vue"),
            },
            {
                path: "add",
                meta: {
                    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: {
                    title: "可行报告库",
                    keepAlive: true,
                },
                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: "工艺开发工具",
                    keepAlive: true,
                },
                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: {
                    title: "验证与发布",
                    keepAlive: true,
                },
                component: () => import("../views/reportLibrary/verificationRelease/index.vue"),
            },
            {
                path: "projectProposalLibrary",
                meta: {
                    title: "立项报告库",
                    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"),
            },
        ],
    },
    {
        path: "/deliveryAssessment",
        component: Layouts,
        meta: {
            title: "工作交付评定",
        },
        children: [
            {
                path: "projectTeamIntegral",
                meta: {
                    title: "项目组总积分",
                },
                component: () => import("../views/deliveryAssessment/projectTeamIntegral"),
            },
            {
                path: "projectTeamIntegral-detail",
                meta: {
                    title: "积分详情",
                    hide: true
                },
                component: () => import("../views/deliveryAssessment/projectTeamIntegral/detail.vue"),
            },
            {
                // 超级管理员
                path: "taskList",
                meta: {
                    title: "课题列表",
                },
                component: () => import("../views/deliveryAssessment/taskList"),
            },
            {
                // 工艺工程师 审批人 实验员 超级管理员
                path: "restsTask",
                meta: {
                    title: "实验员其他任务",
                },
                component: () => import("../views/deliveryAssessment/restsTask"),
            },
            {
                // 超级管理员 工艺工程师 审批人
                path: "clinicalTrial",
                meta: {
                    title: "临床试验积分列表",
                },
                component: () => import("../views/deliveryAssessment/clinicalTrial"),
            },
            {
                // 化验师 审批人 工艺工程师
                path: "testingAndEvaluation",
                meta: {
                    title: "检测项评定列表",
                },
                component: () => import("../views/deliveryAssessment/testingAndEvaluation"),
            },
            {
                // 化验师 实验员
                path: "experimentResults",
                meta: {
                    title: "实验结果评定",
                },
                component: () => import("../views/deliveryAssessment/experimentResults"),
            },
            {
                // 化验师 工艺工程师 审批人
                path: "assayTaskList",
                meta: {
                    title: "课题评定列表",
                },
                component: () => import("../views/deliveryAssessment/assayTaskList"),
            },
            {
                // 工艺工程师 审批人
                path: "processEngineerEvaluate",
                meta: {
                    title: "工艺工程师工作评定详情",
                },
                component: () => import("../views/deliveryAssessment/processEngineerEvaluate"),
            },
            {
                // 工艺工程师
                path: "testerWorkerEvaluate",
                meta: {
                    title: "实验员工作评定",
                },
                component: () => import("../views/deliveryAssessment/testerWorkerEvaluate"),
            },
            {
                // 工艺工程师
                path: "addTesterWorkerEvaluate",
                name: 'AddTesterWorkerEvaluate',
                meta: {
                    title: "新增实验员工作评定",
                    hide: true,
                    keepAlive: true,
                },
                component: () => import("../views/deliveryAssessment/testerWorkerEvaluate/add"),
            },
            {
                // 工艺工程师
                path: "chemistEvaluate",
                meta: {
                    title: "化验师工作评定",
                },
                component: () => import("../views/deliveryAssessment/chemistEvaluate"),
            },
            {
                // 工艺工程师
                path: "addchemistEvaluate",
                name: 'AddchemistEvaluate',
                meta: {
                    title: "新增化验师工作评定",
                    hide: true,
                    keepAlive: true,
                },
                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"),
            },
        ]
    }
];
 
const router = new VueRouter({
    mode: "hash",
    base: process.env.BASE_URL,
    routes,
});
 
// 前置路由拦截器
router.beforeEach((to, from, next) => {
    // 设置当前页签名称
    document.title = to.meta.title || '实验室流程';
 
    // 登录验证
    // 排除登录页的校验
    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(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,
                query: to.query,
            }
            tagList.push(tagInfo)
            sessionStorage.setItem('tagList', JSON.stringify(tagList))
            store.commit('SET_TAGLIST', tagList)
        }
    }
 
    // 判断是否需要缓存
    if (to.meta.keepAlive) {
        let keepAliveList = JSON.parse(sessionStorage.getItem('keepAliveList') || '[]')
        // 判断是否已经缓存
        let isExist = keepAliveList.includes(to.name)
        if (!isExist) {
            keepAliveList.push(to.name)
            sessionStorage.setItem('keepAliveList', JSON.stringify(keepAliveList))
            store.commit('SET_KEEPALIVELIST', keepAliveList)
        }
    }
 
    next()
});
 
export default router;