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
| import Vue from 'vue'
| import Router from 'vue-router'
| import AppLayout from '@/layout/AppLayout.vue'
|
| Vue.use(Router)
|
| const routes = [
| { path: '/', redirect: '/dashboard' },
| { path: '/login', component: () => import('@/views/Login.vue') },
| {
| path: '/',
| component: AppLayout,
| children: [
| { path: 'dashboard', component: () => import('@/views/Dashboard.vue'), meta: { title: '首页门户', cacheName: 'Dashboard' } },
| { path: 'fault/report', component: () => import('@/views/fault/FaultReport.vue'), meta: { title: '故障上报', cacheName: 'FaultReport' } },
| { path: 'fault/review', component: () => import('@/views/fault/XcbReview.vue'), meta: { title: 'XCB助理审核', cacheName: 'XcbReview' } },
| { path: 'fault/approval/cmb', component: () => import('@/views/fault/SimpleApproval.vue'), props: { stage: 'CMB' }, meta: { title: 'CMB领导审批', stage: 'CMB', cacheName: 'SimpleApproval' } },
| { path: 'fault/approval/jcc-assistant', component: () => import('@/views/fault/SimpleApproval.vue'), props: { stage: 'JCC_ASSISTANT' }, meta: { title: 'JCC助理审批', stage: 'JCC_ASSISTANT', cacheName: 'SimpleApproval' } },
| { path: 'fault/approval/jcc-director', component: () => import('@/views/fault/SimpleApproval.vue'), props: { stage: 'JCC_DIRECTOR' }, meta: { title: 'JCC处长审批', stage: 'JCC_DIRECTOR', cacheName: 'SimpleApproval' } },
| { path: 'fault/dispatch', component: () => import('@/views/fault/DispatchPage.vue'), meta: { title: 'XCB助理派单', cacheName: 'DispatchPage' } },
| { path: 'fault/completion', component: () => import('@/views/completion/CompletionList.vue'), meta: { title: '完工情况处理', cacheName: 'CompletionList' } },
| { path: 'completion/report', component: () => import('@/views/completion/CompletionReport.vue'), props: route => ({ workOrderId: route.query.workOrderId || null }), meta: { title: '完工信息上报', cacheName: 'CompletionReport' } },
| { path: 'acceptance/application', component: () => import('@/views/acceptance/AcceptanceList.vue'), props: { stage: 'APPLICATION' }, meta: { title: '验收申请', stage: 'APPLICATION', cacheName: 'AcceptanceList' } },
| { path: 'acceptance/inspector', component: () => import('@/views/acceptance/AcceptanceList.vue'), props: { stage: 'INSPECTOR' }, meta: { title: '质检员验收', stage: 'INSPECTOR', cacheName: 'AcceptanceList' } },
| { path: 'acceptance/leader', component: () => import('@/views/acceptance/AcceptanceList.vue'), props: { stage: 'LEADER' }, meta: { title: '质检负责人验收', stage: 'LEADER', cacheName: 'AcceptanceList' } },
| { path: 'acceptance/print', component: () => import('@/views/acceptance/AcceptanceList.vue'), props: { stage: 'PRINT' }, meta: { title: '完工验收打印输出', stage: 'PRINT', cacheName: 'AcceptanceList' } },
| { path: 'acceptance/rating', component: () => import('@/views/acceptance/AcceptanceList.vue'), props: { stage: 'RATING' }, meta: { title: '修后质量评级', stage: 'RATING', cacheName: 'AcceptanceList' } },
| { path: 'reports/:type', component: () => import('@/views/report/ReportPage.vue'), props: route => ({ type: route.params.type }), meta: { title: '统计报表', cacheName: 'ReportPage' } },
| { path: 'system/contractors', component: () => import('@/views/system/ContractorManage.vue'), meta: { title: '承修单位管理', cacheName: 'ContractorManage' } },
| { path: 'system/product-tree', component: () => import('@/views/system/TreeManage.vue'), props: { treeType: 'product' }, meta: { title: '产品结构树管理', treeType: 'product', cacheName: 'TreeManage' } },
| { path: 'system/base-equipment', component: () => import('@/views/system/TreeManage.vue'), props: { treeType: 'base' }, meta: { title: '设备基础库管理', treeType: 'base', cacheName: 'TreeManage' } },
| { path: 'system/engineering-majors', component: () => import('@/views/system/EngineeringMajorManage.vue'), meta: { title: '工程专业配置', cacheName: 'EngineeringMajorManage' } },
| { path: 'system/team-majors', component: () => import('@/views/system/TeamMajorManage.vue'), meta: { title: 'T队专业配置', cacheName: 'TeamMajorManage' } },
| { path: 'system/roles', component: () => import('@/views/system/RoleManage.vue'), meta: { title: '角色管理', cacheName: 'RoleManage' } },
| { path: 'system/menus', component: () => import('@/views/system/MenuManage.vue'), meta: { title: '菜单管理', cacheName: 'MenuManage' } },
| { path: 'system/menu-permissions', component: () => import('@/views/system/MenuPermission.vue'), meta: { title: '菜单权限', cacheName: 'MenuPermission' } },
| { path: 'system/three-member', component: () => import('@/views/system/ThreeMember.vue'), meta: { title: '三员管理', cacheName: 'ThreeMember' } }
| ]
| }
| ]
|
| const router = new Router({ mode: 'hash', routes })
|
| router.beforeEach((to, from, next) => {
| const token = sessionStorage.getItem('token')
| if (to.path === '/login') return next(token ? '/dashboard' : undefined)
| if (!token) return next('/login')
| next()
| })
|
| export default router
|
|