index.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import Layout from '@/layouts'
  4. import EmptyLayout from '@/layouts/EmptyLayout'
  5. import { publicPath, routerMode } from '@/config'
  6. Vue.use(VueRouter)
  7. export const constantRoutes = [
  8. {
  9. path: '/login',
  10. component: () => import('@/views/login/index'),
  11. hidden: true,
  12. },
  13. {
  14. path: '/register',
  15. component: () => import('@/views/register/index'),
  16. hidden: true,
  17. },
  18. {
  19. path: '/401',
  20. name: '401',
  21. component: () => import('@/views/401'),
  22. hidden: true,
  23. },
  24. {
  25. path: '/404',
  26. name: '404',
  27. component: () => import('@/views/404'),
  28. hidden: true,
  29. },
  30. ]
  31. export const asyncRoutes = [
  32. {
  33. path: '/',
  34. component: Layout,
  35. redirect: '/index',
  36. children: [
  37. {
  38. path: 'index',
  39. name: 'Index',
  40. component: () => import('@/views/index/index'),
  41. meta: {
  42. title: '计划电量',
  43. icon: 'home',
  44. affix: true,
  45. },
  46. },
  47. ],
  48. },
  49. {
  50. path: "/indicators",
  51. component: Layout,
  52. redirect: "noRedirect",
  53. children: [
  54. {
  55. path: "indicators",
  56. name: "indicators",
  57. component: () => import("@/views/indicators/index"),
  58. meta: {
  59. title: "指标录入",
  60. icon: "marker",
  61. permissions: ["admin"],
  62. },
  63. },
  64. ],
  65. },
  66. {
  67. path: '/stationConfiguration',
  68. component: Layout,
  69. redirect: 'noRedirect',
  70. name: 'stationConfiguration',
  71. meta: { title: '场站配置', icon: 'tools', permissions: ['admin'] },
  72. children: [
  73. {
  74. path: 'company',
  75. name: 'company',
  76. component: () =>
  77. import('@/views/stationConfiguration/company/index'),
  78. meta: { title: '公司管理' },
  79. },
  80. {
  81. path: 'area',
  82. name: 'area',
  83. component: () =>
  84. import('@/views/stationConfiguration/area/index'),
  85. meta: { title: '区域管理' },
  86. },
  87. {
  88. path: 'station',
  89. name: 'station',
  90. component: () =>
  91. import('@/views/stationConfiguration/station/index'),
  92. meta: { title: '场站管理' },
  93. },
  94. {
  95. path: 'period',
  96. name: 'period',
  97. component: () =>
  98. import('@/views/stationConfiguration/period/index'),
  99. meta: { title: '期次管理' },
  100. },
  101. {
  102. path: 'line',
  103. name: 'line',
  104. component: () =>
  105. import('@/views/stationConfiguration/line/index'),
  106. meta: { title: '线路管理' },
  107. },
  108. {
  109. path: 'windterbin',
  110. name: 'windterbin',
  111. component: () =>
  112. import('@/views/stationConfiguration/windterbin/index'),
  113. meta: { title: '风机管理' },
  114. },
  115. {
  116. path: 'equipmentmodel',
  117. name: 'equipmentmodel',
  118. component: () =>
  119. import('@/views/stationConfiguration/equipmentmodel/index'),
  120. meta: { title: '设备型号' },
  121. },
  122. ],
  123. },
  124. {
  125. path: "/meterpoint",
  126. component: Layout,
  127. redirect: "noRedirect",
  128. children: [
  129. {
  130. path: "meterpoint",
  131. name: "meterpoint",
  132. component: () => import("@/views/meterpoint/index"),
  133. meta: {
  134. title: "电计量配置",
  135. icon: "allergies",
  136. permissions: ["admin"],
  137. },
  138. },
  139. ],
  140. },
  141. // {
  142. // path: "/equipmentAllocation",
  143. // component: Layout,
  144. // redirect: "noRedirect",
  145. // children: [
  146. // {
  147. // path: "equipmentAllocation",
  148. // name: "equipmentAllocation",
  149. // component: () => import("@/views/pointConfiguration/equipmentAllocation/index"),
  150. // meta: {
  151. // title: "设备点表配置",
  152. // icon: "marker",
  153. // permissions: ["admin"],
  154. // },
  155. // },
  156. // ],
  157. // },
  158. // {
  159. // path: "/stationAllocation",
  160. // component: Layout,
  161. // redirect: "noRedirect",
  162. // children: [
  163. // {
  164. // path: "stationAllocation",
  165. // name: "stationAllocation",
  166. // component: () => import("@/views/pointConfiguration/stationAllocation/index"),
  167. // meta: {
  168. // title: "场站点表配置",
  169. // icon: "marker",
  170. // permissions: ["admin"],
  171. // },
  172. // },
  173. // ],
  174. // },
  175. // {
  176. // path: '/personnelManagement',
  177. // component: Layout,
  178. // redirect: 'noRedirect',
  179. // name: 'PersonnelManagement',
  180. // meta: { title: '配置', icon: 'users-cog', permissions: ['admin'] },
  181. // children: [
  182. // {
  183. // path: 'userManagement',
  184. // name: 'UserManagement',
  185. // component: () =>
  186. // import('@/views/personnelManagement/userManagement/index'),
  187. // meta: { title: '用户管理' },
  188. // },
  189. // {
  190. // path: 'roleManagement',
  191. // name: 'RoleManagement',
  192. // component: () =>
  193. // import('@/views/personnelManagement/roleManagement/index'),
  194. // meta: { title: '角色管理' },
  195. // },
  196. // {
  197. // path: 'menuManagement',
  198. // name: 'MenuManagement',
  199. // component: () =>
  200. // import('@/views/personnelManagement/menuManagement/index'),
  201. // meta: { title: '菜单管理' },
  202. // },
  203. // ],
  204. // },
  205. // {
  206. // path: '/error',
  207. // component: EmptyLayout,
  208. // redirect: 'noRedirect',
  209. // name: 'Error',
  210. // meta: { title: '错误页', icon: 'bug' },
  211. // children: [
  212. // {
  213. // path: '401',
  214. // name: 'Error401',
  215. // component: () => import('@/views/401'),
  216. // meta: { title: '401' },
  217. // },
  218. // {
  219. // path: '404',
  220. // name: 'Error404',
  221. // component: () => import('@/views/404'),
  222. // meta: { title: '404' },
  223. // },
  224. // ],
  225. // },
  226. ]
  227. const router = new VueRouter({
  228. base: publicPath,
  229. mode: routerMode,
  230. scrollBehavior: () => ({
  231. y: 0,
  232. }),
  233. routes: constantRoutes,
  234. })
  235. export function resetRouter() {
  236. location.reload()
  237. }
  238. export default router