index.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '@/layout'
  6. /**
  7. * Note: sub-menu only appear when route children.length >= 1
  8. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  9. *
  10. * hidden: true if set true, item will not show in the sidebar(default is false)
  11. * alwaysShow: true if set true, will always show the root menu
  12. * if not set alwaysShow, when item has more than one children route,
  13. * it will becomes nested mode, otherwise not show the root menu
  14. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  15. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  16. * meta : {
  17. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  18. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  19. icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
  20. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  21. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  22. }
  23. */
  24. /**
  25. * constantRoutes
  26. * a base page that does not have permission requirements
  27. * all roles can be accessed
  28. */
  29. export const constantRoutes = [{
  30. path: '/login',
  31. component: () =>
  32. import ('@/views/login/index'),
  33. hidden: true
  34. },
  35. {
  36. path: '/404',
  37. component: () =>
  38. import ('@/views/404'),
  39. hidden: true
  40. },
  41. // my start
  42. {
  43. path: '/',
  44. component: Layout,
  45. redirect: '/alarmManage',
  46. children: [{
  47. path: 'alarmManage',
  48. name: 'alarmManage',
  49. component: () =>
  50. import ('@/views/alarmManage/index'), //aa页面路径
  51. meta: { title: '告警管理', icon: 'alarmManage' } //aa title 菜单标题&meta title
  52. }]
  53. },
  54. {
  55. path: '/siteManage',
  56. component: Layout,
  57. redirect: '/siteManage/basicInfo',
  58. name: 'siteManage',
  59. meta: { title: '站点管理', icon: 'siteManage' },
  60. children: [{
  61. path: 'basicInfo',
  62. name: 'basicInfo',
  63. component: () =>
  64. import ('@/views/siteManage/basicInfo/index'),
  65. meta: { title: '基本信息' }
  66. },
  67. {
  68. path: 'watchDog',
  69. name: 'watchDog',
  70. component: () =>
  71. import ('@/views/siteManage/watchDog/index'),
  72. meta: { title: '监控设备' }
  73. },
  74. {
  75. path: 'variableList',
  76. name: 'variableList',
  77. component: () =>
  78. import ('@/views/siteManage/variableList/index'),
  79. meta: { title: '变量列表' }
  80. },
  81. {
  82. path: 'rateConfig',
  83. name: 'rateConfig',
  84. component: () =>
  85. import ('@/views/siteManage/rateConfig/index'),
  86. meta: { title: '费率配置' }
  87. },
  88. {
  89. path: 'camera',
  90. name: 'camera',
  91. component: () =>
  92. import ('@/views/siteManage/camera/index'),
  93. meta: { title: '摄像头' }
  94. },
  95. {
  96. path: 'powerScore',
  97. name: 'powerScore',
  98. component: () =>
  99. import ('@/views/siteManage/powerScore/index'),
  100. meta: { title: '电能质量评分' }
  101. }
  102. ]
  103. },
  104. {
  105. path: '/stationManage',
  106. component: Layout,
  107. children: [{
  108. path: 'index',
  109. name: 'StationManage',
  110. component: () =>
  111. import ('@/views/stationManage/index'),
  112. meta: { title: '台区管理', icon: 'stationManage' }
  113. }]
  114. },
  115. {
  116. path: '/deviceManage',
  117. component: Layout,
  118. redirect: '/deviceManage/powerEquip',
  119. name: 'deviceManage',
  120. meta: { title: '设备管理', icon: 'deviceManage' },
  121. children: [{
  122. path: 'powerEquip',
  123. name: 'powerEquip',
  124. component: () =>
  125. import ('@/views/deviceManage/powerEquip/index'),
  126. meta: { title: '电力监测设备' }
  127. },
  128. {
  129. path: 'videoEquip',
  130. name: 'videoEquip',
  131. component: () =>
  132. import ('@/views/deviceManage/videoEquip/index'),
  133. meta: { title: '视频监测设备' }
  134. },
  135. {
  136. path: 'communicateEquip',
  137. name: 'communicateEquip',
  138. component: () =>
  139. import ('@/views/deviceManage/communicateEquip/index'),
  140. meta: { title: '通信设备' }
  141. },
  142. {
  143. path: 'channelList',
  144. name: 'channelList',
  145. component: () =>
  146. import ('@/views/deviceManage/channelList/index'),
  147. meta: { title: '通道列表' }
  148. },
  149. {
  150. path: 'attribTemplate',
  151. name: 'attribTemplate',
  152. component: () =>
  153. import ('@/views/deviceManage/attribTemplate/index'),
  154. meta: { title: '属性模板' }
  155. }
  156. ]
  157. },
  158. {
  159. path: '/dataManage',
  160. component: Layout,
  161. redirect: '/dataManage/sameAnalysis',
  162. name: 'dataManage',
  163. meta: { title: '数据管理', icon: 'dataManage' },
  164. children: [{
  165. path: 'sameAnalysis',
  166. name: 'sameAnalysis',
  167. component: () =>
  168. import ('@/views/dataManage/sameAnalysis/index'),
  169. meta: { title: '同比分析报表' }
  170. },
  171. {
  172. path: 'chainAnalysis',
  173. name: 'chainAnalysis',
  174. component: () =>
  175. import ('@/views/dataManage/chainAnalysis/index'),
  176. meta: { title: '环比分析报表' }
  177. },
  178. {
  179. path: 'handOpera',
  180. name: 'handOpera',
  181. component: () =>
  182. import ('@/views/dataManage/handOpera/index'),
  183. meta: { title: '手动抄表' }
  184. },
  185. {
  186. path: 'energyReport',
  187. name: 'energyReport',
  188. component: () =>
  189. import ('@/views/dataManage/energyReport/index'),
  190. meta: { title: '用能月报' }
  191. },
  192. {
  193. path: 'demandAnalysis',
  194. name: 'demandAnalysis',
  195. component: () =>
  196. import ('@/views/dataManage/demandAnalysis/index'),
  197. meta: { title: '需量分析' }
  198. }, {
  199. path: 'consumConfig',
  200. name: 'consumConfig',
  201. component: () =>
  202. import ('@/views/dataManage/consumConfig/index'),
  203. meta: { title: '能耗分析配置' }
  204. }
  205. ]
  206. },
  207. {
  208. path: '/powerQuality',
  209. component: Layout,
  210. redirect: '/powerQuality/harmonicReport',
  211. name: 'powerQuality',
  212. meta: { title: '电能质量', icon: 'powerQuality' },
  213. children: [{
  214. path: 'harmonicReport',
  215. name: 'harmonicReport',
  216. component: () =>
  217. import ('@/views/powerQuality/harmonicReport/index'),
  218. meta: { title: '谐波报表' }
  219. },
  220. {
  221. path: 'realTimeMonitoring',
  222. name: 'realTimeMonitoring',
  223. component: () =>
  224. import ('@/views/powerQuality/realTimeMonitoring/index'),
  225. meta: { title: '实时监测' }
  226. },
  227. {
  228. path: 'asseReport',
  229. name: 'asseReport',
  230. component: () =>
  231. import ('@/views/powerQuality/asseReport/index'),
  232. meta: { title: '评估报告' }
  233. },
  234. {
  235. path: 'unbalanceAnalysis',
  236. name: 'unbalanceAnalysis',
  237. component: () =>
  238. import ('@/views/powerQuality/unbalanceAnalysis/index'),
  239. meta: { title: '三相不平衡分析' }
  240. },
  241. ]
  242. },
  243. {
  244. path: '/monthReport',
  245. component: Layout,
  246. children: [{
  247. path: 'index',
  248. name: 'monthReport',
  249. component: () =>
  250. import ('@/views/monthReport/index'),
  251. meta: { title: '月度报告', icon: 'monthReport' }
  252. }]
  253. },
  254. {
  255. path: '/planOutage',
  256. component: Layout,
  257. children: [{
  258. path: 'index',
  259. name: 'planOutage',
  260. component: () =>
  261. import ('@/views/planOutage/index'),
  262. meta: { title: '计划停电', icon: 'planOutage' }
  263. }]
  264. },
  265. {
  266. path: '/patrolManage',
  267. component: Layout,
  268. redirect: '/patrolManage/patrolPlan',
  269. name: 'patrolManage',
  270. meta: { title: '巡检管理', icon: 'patrolManage' },
  271. children: [{
  272. path: 'patrolPlan',
  273. name: 'patrolPlan',
  274. component: () =>
  275. import ('@/views/patrolManage/patrolPlan/index'),
  276. meta: { title: '巡检计划' }
  277. },
  278. {
  279. path: 'patrolRecord',
  280. name: 'patrolRecord',
  281. component: () =>
  282. import ('@/views/patrolManage/patrolRecord/index'),
  283. meta: { title: '巡检记录' }
  284. },
  285. {
  286. path: 'patrolContent',
  287. name: 'patrolContent',
  288. component: () =>
  289. import ('@/views/patrolManage/patrolContent/index'),
  290. meta: { title: '巡检内容' }
  291. },
  292. {
  293. path: 'checkEntries',
  294. name: 'checkEntries',
  295. component: () =>
  296. import ('@/views/patrolManage/checkEntries/index'),
  297. meta: { title: '检查条目' }
  298. },
  299. ]
  300. },
  301. {
  302. path: '/operManage',
  303. component: Layout,
  304. redirect: '/operManage/siteAchives',
  305. name: 'operManage',
  306. meta: { title: '运维管理', icon: 'operManage' },
  307. children: [{
  308. path: 'siteAchives',
  309. name: 'siteAchives',
  310. component: () =>
  311. import ('@/views/operManage/siteAchives/index'),
  312. meta: { title: '现场档案' }
  313. },
  314. {
  315. path: 'defectManage',
  316. name: 'defectManage',
  317. component: () =>
  318. import ('@/views/operManage/defectManage/index'),
  319. meta: { title: '缺陷管理' }
  320. },
  321. {
  322. path: 'workManage',
  323. name: 'workManage',
  324. component: () =>
  325. import ('@/views/operManage/workManage/index'),
  326. meta: { title: '工单管理' }
  327. },
  328. {
  329. path: 'operStatistics',
  330. name: 'operStatistics',
  331. component: () =>
  332. import ('@/views/operManage/operStatistics/index'),
  333. meta: { title: '运维统计' }
  334. },
  335. {
  336. path: 'workStatistics',
  337. name: 'workStatistics',
  338. component: () =>
  339. import ('@/views/operManage/workStatistics/index'),
  340. meta: { title: '工作量统计 ' }
  341. },
  342. ]
  343. },
  344. {
  345. path: '/systemManage',
  346. component: Layout,
  347. redirect: '/systemManage/userManage',
  348. name: 'systemManage',
  349. meta: { title: '系统管理', icon: 'systemManage' },
  350. children: [{
  351. path: 'userManage',
  352. name: 'userManage',
  353. component: () =>
  354. import ('@/views/systemManage/userManage/index'),
  355. meta: { title: '用户管理' }
  356. },
  357. {
  358. path: 'rolePermission',
  359. name: 'rolePermission',
  360. component: () =>
  361. import ('@/views/systemManage/rolePermission/index'),
  362. meta: { title: '角色权限' }
  363. },
  364. ]
  365. },
  366. //my end
  367. // {
  368. // path: '/',
  369. // component: Layout,
  370. // redirect: '/dashboard',
  371. // children: [{
  372. // path: 'dashboard',
  373. // name: 'Dashboard',
  374. // component: () =>
  375. // import ('@/views/dashboard/index'),
  376. // meta: { title: 'Dashboard', icon: 'dashboard' }
  377. // }]
  378. // },
  379. {
  380. path: '/example',
  381. component: Layout,
  382. redirect: '/example/table',
  383. name: 'Example',
  384. meta: { title: 'Table', icon: 'el-icon-s-help' },
  385. children: [{
  386. path: 'table',
  387. name: 'Table',
  388. component: () =>
  389. import ('@/views/table/index'),
  390. meta: { title: 'Table', icon: 'table' }
  391. },
  392. {
  393. path: 'tree',
  394. name: 'Tree',
  395. component: () =>
  396. import ('@/views/tree/index'),
  397. meta: { title: 'Tree', icon: 'tree' }
  398. }
  399. ]
  400. },
  401. {
  402. path: '/form',
  403. component: Layout,
  404. children: [{
  405. path: 'index',
  406. name: 'Form',
  407. component: () =>
  408. import ('@/views/form/index'),
  409. meta: { title: 'Form', icon: 'form' }
  410. }]
  411. },
  412. // {
  413. // path: '/nested',
  414. // component: Layout,
  415. // redirect: '/nested/menu1',
  416. // name: 'Nested',
  417. // meta: {
  418. // title: 'Nested',
  419. // icon: 'nested'
  420. // },
  421. // children: [{
  422. // path: 'menu1',
  423. // component: () =>
  424. // import ('@/views/nested/menu1/index'), // Parent router-view
  425. // name: 'Menu1',
  426. // meta: { title: 'Menu1' },
  427. // children: [{
  428. // path: 'menu1-1',
  429. // component: () =>
  430. // import ('@/views/nested/menu1/menu1-1'),
  431. // name: 'Menu1-1',
  432. // meta: { title: 'Menu1-1' }
  433. // },
  434. // {
  435. // path: 'menu1-2',
  436. // component: () =>
  437. // import ('@/views/nested/menu1/menu1-2'),
  438. // name: 'Menu1-2',
  439. // meta: { title: 'Menu1-2' },
  440. // children: [{
  441. // path: 'menu1-2-1',
  442. // component: () =>
  443. // import ('@/views/nested/menu1/menu1-2/menu1-2-1'),
  444. // name: 'Menu1-2-1',
  445. // meta: { title: 'Menu1-2-1' }
  446. // },
  447. // {
  448. // path: 'menu1-2-2',
  449. // component: () =>
  450. // import ('@/views/nested/menu1/menu1-2/menu1-2-2'),
  451. // name: 'Menu1-2-2',
  452. // meta: { title: 'Menu1-2-2' }
  453. // }
  454. // ]
  455. // },
  456. // {
  457. // path: 'menu1-3',
  458. // component: () =>
  459. // import ('@/views/nested/menu1/menu1-3'),
  460. // name: 'Menu1-3',
  461. // meta: { title: 'Menu1-3' }
  462. // }
  463. // ]
  464. // },
  465. // {
  466. // path: 'menu2',
  467. // component: () =>
  468. // import ('@/views/nested/menu2/index'),
  469. // name: 'Menu2',
  470. // meta: { title: 'menu2' }
  471. // }
  472. // ]
  473. // },
  474. // {
  475. // path: 'external-link',
  476. // component: Layout,
  477. // children: [{
  478. // path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
  479. // meta: { title: 'External Link', icon: 'link' }
  480. // }]
  481. // },
  482. // 404 page must be placed at the end !!!
  483. { path: '*', redirect: '/404', hidden: true }
  484. ]
  485. const createRouter = () => new Router({
  486. // mode: 'history', // require service support
  487. scrollBehavior: () => ({ y: 0 }),
  488. routes: constantRoutes
  489. })
  490. const router = createRouter()
  491. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  492. export function resetRouter() {
  493. const newRouter = createRouter()
  494. router.matcher = newRouter.matcher // reset router
  495. }
  496. export default router