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
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
/* Layout */
import Layout from '@/layout'
/**
* Note: sub-menu only appear when route children.length >= 1
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
*
* hidden: true if set true, item will not show in the sidebar(default is false)
* alwaysShow: true if set true, will always show the root menu
* if not set alwaysShow, when item has more than one children route,
* it will becomes nested mode, otherwise not show the root menu
* redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
* name:'router-name' the name is used by <keep-alive> (must set!!!)
* meta : {
roles: ['admin','editor'] control the page roles (you can set multiple roles)
title: 'title' the name show in sidebar and breadcrumb (recommend set)
icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
}
*/
/**
* constantRoutes
* a base page that does not have permission requirements
* all roles can be accessed
*/
export const constantRoutes = [
{
path: '/login',
component: () => import('@/views/login/index'),
hidden: true
},
{
path: '/404',
component: () => import('@/views/404'),
hidden: true
},
{
path: '/',
component: Layout,
redirect: '/dashboard',
children: [{
path: 'dashboard',
name: 'Dashboard',
component: () => import('@/views/dashboard/index'),
meta: { title: '首页', icon: 'homePage' }
}]
},
{
path: '/alarm',
component: Layout,
redirect: '/dashboard',
name: 'alarm',
meta: { title: '告警管理', icon: 'alarm' },
children: [
{
path: 'cableTime',
name: 'cableTime',
component: () => import('@/views/alarm/cableTime/index'),
meta: { title: '漏缆监测告警' }
},
{
path: 'device',
name: 'device',
component: () => import('@/views/alarm/device/index'),
meta: { title: '设备连接告警' }
}
]
},
{
path: '/setting',
component: Layout,
redirect: '/setting/add',
name: 'Setting',
meta: { title: '配置管理', icon: 'setting' },
children: [
{
path: 'add',
name: 'settingAdd',
component: () => import('@/views/setting/add/index'),
meta: { title: '手动添加配置' }
},
{
path: 'statistics',
name: 'settingAtatistics',
component: () => import('@/views/setting/statistics/index'),
meta: { title: '配置信息统计' },
children: [
]
},
{
path: "/detail/",
name: "detail",
beforeEnter: (to, from, next) => {
if (to.query.type==1) {
to.meta.title = '铁路线详情'
}
else if (to.query.type==2) {
to.meta.title = '站点详情'
}
else if (to.query.type==3) {
to.meta.title = 'FSU详情'
}
else if (to.query.type==4) {
to.meta.title = '监测设备详情'
}
else if (to.query.type==5) {
to.meta.title = '漏缆详情'
}
else if (to.query.type==6) {
to.meta.title = '天馈线详情'
} else{
to.meta.title = '详情'
}
next()
},
component: () => import('@/views/setting/statistics/detail'),
hidden: true,
},
]
},
{
path: '/monitor',
component: Layout,
redirect: '/dashboard',
name: '监测实时状态',
meta: { title: '监测实时状态', icon: 'system' },
children: [
{
path: 'leakageCable',
name: '漏缆实时状态',
component: () => import('@/views/monitor/leakageCable/index'),
meta: { title: '漏缆实时状态' }
},
{
path: 'equipment',
name: '设备实时状态',
component: () => import('@/views/monitor/equipment/index'),
meta: { title: '设备实时状态' }
}
]
},
{
path: '/maintain',
component: Layout,
redirect: '/maintain/oneself',
name: 'Maintain',
meta: { title: '维护管理', icon: 'maintain' },
children: [
{
path: 'oneself',
name: 'MaintainOneself',
component: () => import('@/views/maintain/oneself/index'),
meta: { title: '设备本身维护' }
},
{
path: 'parameter',
name: 'MaintainParameter',
component: () => import('@/views/maintain/parameter/index'),
meta: { title: '设备告警参数设置' }
}
]
},
{
path: '/history',
component: Layout,
redirect: '/history/leakyCableStatus',
name: 'History',
meta: { title: '历史数据', icon: 'history' },
children: [
{
path: 'leakyCableStatus',
name: 'leakyCableStatus',
component: () => import('@/views/history/leakyCableStatus/index.vue'),
meta: { title: '漏缆监测历史状态' }
},
{
path: 'leakyCableRepair',
name: 'leakyCableRepair',
component: () => import('@/views/history/leakyCableRepair/index.vue'),
meta: { title: '漏缆监测维修历史' }
},
{
path: 'deviceLinkStatus',
name: 'deviceLinkStatus',
component: () => import('@/views/history/deviceLinkStatus/index.vue'),
meta: { title: '设备连接历史状态' }
},
{
path: 'deviceLinkRepair',
name: 'deviceLinkRepair',
component: () => import('@/views/history/deviceLinkRepair/index.vue'),
meta: { title: '设备连接维修历史' }
}
]
},
{
path: '/user',
component: Layout,
redirect: '/dashboard',
name: 'User',
meta: { title: '用户管理', icon: 'user' },
children: [{
path: 'updateUser',
name: 'UpdateUser',
component: () => import('@/views/user/updateUser'),
meta: { title: '个人信息管理' }
},
{
path: 'userList',
name: 'UserList',
component: () => import('@/views/user/userList'),
meta: { title: '用户信息列表' }
},
{
path: 'userLog',
name: 'UserLog',
component: () => import('@/views/user/userLog'),
meta: { title: '用户操作日志' }
},
]
},
// 404 page must be placed at the end !!!
{ path: '*', redirect: '/404', hidden: true }
]
const createRouter = () => new Router({
// mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
const router = createRouter()
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router
}
router.beforeResolve((to, from, next) => {
window.document.title = to.meta.title
next()
})
export default router