index.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '@/layout'
  6. import FullScreenLayout from '@/layout/components/FullScreen'
  7. /**
  8. * Note: sub-menu only appear when route children.length >= 1
  9. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  10. *
  11. * hidden: true if set true, item will not show in the sidebar(default is false)
  12. * alwaysShow: true if set true, will always show the root menu
  13. * if not set alwaysShow, when item has more than one children route,
  14. * it will becomes nested mode, otherwise not show the root menu
  15. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  16. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  17. * meta : {
  18. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  19. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  20. icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
  21. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  22. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  23. }
  24. */
  25. /**
  26. * constantRoutes
  27. * a base page that does not have permission requirements
  28. * all roles can be accessed
  29. */
  30. export const constantRoutes = [
  31. {
  32. path: '/redirect',
  33. component: Layout,
  34. hidden: true,
  35. children: [
  36. {
  37. path: '/redirect/:path(.*)',
  38. component: () => import('@/views/redirect/index')
  39. }
  40. ]
  41. },
  42. {
  43. path: '/login',
  44. component: () => import('@/views/login/index'),
  45. hidden: true
  46. },
  47. {
  48. path: '/',
  49. component: Layout,
  50. redirect: '/index',
  51. children: [{
  52. path: 'index',
  53. name: 'index',
  54. component: () => import('@/views/dashboard/index'),
  55. meta: { title: '首页', icon: 'icon-shouye' }
  56. }]
  57. },
  58. // {
  59. // path: 'external-link',
  60. // component: Layout,
  61. // children: [
  62. // {
  63. // path: 'https://baidu.com',
  64. // meta: { title: '外链', icon: 'link' }
  65. // }
  66. // ]
  67. // },
  68. // 404 page must be placed at the end !!!
  69. {
  70. path: '/404',
  71. component: () => import('@/views/404'),
  72. hidden: true
  73. },
  74. {
  75. path: '/dashboard-screen',
  76. component: FullScreenLayout,
  77. // redirect: '/catenary/fault',
  78. name: 'dashboard-screen',
  79. meta: {
  80. title: '',
  81. icon: 'icon-jiechuwang',
  82. pages: ['pc:catenary']
  83. },
  84. children: [
  85. {
  86. path: '',
  87. component: () => import('@/views/dashboard-screen/index'), // Parent router-view
  88. name: 'fault',
  89. meta: { title: '大屏', pages: ['pc:catenary:jlgz'] }
  90. }
  91. ]
  92. },
  93. ]
  94. export const asyncRoutes = [
  95. {
  96. path: '/catenary',
  97. component: Layout,
  98. redirect: '/catenary/fault',
  99. name: 'catenary',
  100. meta: {
  101. title: '接触网管理',
  102. icon: 'icon-jiechuwang',
  103. pages: ['pc:catenary']
  104. },
  105. children: [
  106. {
  107. path: 'fault',
  108. component: () => import('@/views/catenary/fault/index'), // Parent router-view
  109. name: 'fault',
  110. meta: { title: '故障数据管理', pages: ['pc:catenary:jlgz'] }
  111. },
  112. {
  113. path: 'checklist',
  114. component: () => import('@/views/catenary/checklist/index'),
  115. name: 'checklist',
  116. meta: { title: '检查表记录管理', pages: ['pc:catenary:jcab'] }
  117. },
  118. {
  119. path: 'record',
  120. component: () => import('@/views/catenary/record/index'),
  121. name: 'record',
  122. meta: { title: '检测记录管理', pages: ['pc:catenary:jceb'] }
  123. },
  124. {
  125. path: 'stand',
  126. component: () => import('@/views/catenary/stand/index'),
  127. name: 'stand',
  128. meta: { title: '九防台账数据管理', pages: ['pc:prevent'] }
  129. }
  130. ]
  131. },
  132. {
  133. path: '/security',
  134. component: Layout,
  135. redirect: '/security/seStand',
  136. name: 'security',
  137. meta: {
  138. title: '安全工具管理',
  139. icon: 'icon-anquangongju',
  140. pages: ['pc:safetool']
  141. },
  142. children: [
  143. {
  144. path: 'seStand',
  145. component: () => import('@/views/security/stand/index'),
  146. name: 'seStand',
  147. meta: { title: '安全工具台账', pages: ['pc:safety:tool'] }
  148. },
  149. {
  150. path: 'checklist',
  151. component: () => import('@/views/security/checkList/index'),
  152. name: 'checklist',
  153. meta: { title: '安全工具检验记录', pages: ['pc:safety:experiment'] }
  154. }
  155. ]
  156. },
  157. {
  158. path: '/basics',
  159. component: Layout,
  160. redirect: '/basics/pillar',
  161. name: 'basics',
  162. meta: {
  163. title: '基础数据管理',
  164. pages: ['pc:baseinfo'],
  165. icon: 'icon-jichushuju'
  166. },
  167. children: [
  168. {
  169. path: 'line',
  170. component: () => import('@/views/basics/line/index'), // Parent router-view
  171. name: 'line',
  172. meta: { title: '线路数据', pages: ['pc:baseinfo:line'] }
  173. },
  174. {
  175. path: 'section',
  176. component: () => import('@/views/basics/section/index'), // Parent router-view
  177. name: 'section',
  178. meta: { title: '区间站场数据', pages: ['pc:baseinfo:station'] }
  179. },
  180. {
  181. path: 'pillar',
  182. component: () => import('@/views/basics/pillar/index'), // Parent router-view
  183. name: 'pillar',
  184. meta: { title: '支柱数据', pages: ['pc:baseinfo:pillar'] }
  185. },
  186. {
  187. path: 'suoting',
  188. component: () => import('@/views/basics/suoting/index'), // Parent router-view
  189. name: 'suoting',
  190. meta: { title: '所亭数据', pages: ['pc:baseinfo:substation'] }
  191. },
  192. {
  193. path: 'tunnel',
  194. component: () => import('@/views/basics/tunnel/index'), // Parent router-view
  195. name: 'tunnel',
  196. meta: { title: '隧道数据', pages: ['pc:baseinfo:sdtz'] }
  197. },
  198. {
  199. path: 'add',
  200. component: () => import('@/views/basics/add/index'), // Parent router-view
  201. name: 'add',
  202. meta: { title: '附加悬挂锚段数据', pages: ['pc:baseinfo:fjxgmd'] }
  203. },
  204. {
  205. path: 'check',
  206. component: () => import('@/views/basics/check/index'), // Parent router-view
  207. name: 'check',
  208. meta: { title: '检查表数据', pages: ['pc:baseinfo:jcab'] }
  209. }
  210. ]
  211. },
  212. {
  213. path: '/sys',
  214. component: Layout,
  215. redirect: '/sys/dept',
  216. name: 'sys',
  217. meta: {
  218. title: '系统管理',
  219. pages: ['pc:system'],
  220. icon: 'icon-xitong'
  221. },
  222. children: [
  223. {
  224. path: 'dept',
  225. component: () => import('@/views/sys/dept/index'), // Parent router-view
  226. name: 'dept',
  227. meta: { title: '部门数据', pages: ['pc:system:dept:list'] }
  228. },
  229. {
  230. path: 'role',
  231. component: () => import('@/views/sys/role/index'), // Parent router-view
  232. name: 'role',
  233. meta: { title: '职务管理', pages: ['pc:system:role:list'] }
  234. },
  235. {
  236. path: 'user',
  237. component: () => import('@/views/sys/user/index'), // Parent router-view
  238. name: 'user',
  239. meta: { title: '职工管理', pages: ['pc:system:user:list'] }
  240. },
  241. {
  242. path: 'dict',
  243. component: () => import('@/views/sys/dict/index'), // Parent router-view
  244. name: 'dict',
  245. meta: { title: '字典管理', pages: ['pc:system:dict:list'] }
  246. },
  247. {
  248. path: 'menu',
  249. component: () => import('@/views/sys/menu/index'), // Parent router-view
  250. name: 'menu',
  251. meta: { title: '菜单管理', pages: ['pc:system:menu:list'] }
  252. },
  253. {
  254. path: 'app',
  255. component: () => import('@/views/sys/app/index'), // Parent router-view
  256. name: 'app',
  257. meta: { title: 'APP管理', pages: ['pc:system:app:list'] }
  258. },
  259. {
  260. path: 'log',
  261. component: () => import('@/views/sys/log/index'), // Parent router-view
  262. name: 'log',
  263. meta: { title: '日志管理', pages: ['pc:system:operlog:list'] }
  264. }
  265. ]
  266. },
  267. {
  268. path: '*',
  269. redirect: '/404',
  270. hidden: true
  271. }
  272. ]
  273. const createRouter = () => new Router({
  274. mode: 'history', // require service support
  275. scrollBehavior: () => ({ y: 0 }),
  276. routes: constantRoutes
  277. })
  278. const router = createRouter()
  279. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  280. export function resetRouter() {
  281. const newRouter = createRouter()
  282. router.matcher = newRouter.matcher // reset router
  283. }
  284. export default router