index.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import Layout from '@/layout'
  4. import SiteRouter from './SiteRouter'
  5. import ChargeRouter from './ChargeRouter'
  6. import UserRouter from './UserRouter'
  7. import ProviderRouter from './ProviderRouter'
  8. import Transactions from './Transactions'
  9. import ChargingProfile from './ChargingProfile'
  10. import OCPPRouter from './OCPPRouter'
  11. import driver from './driver'
  12. import fleetCompanyRoute from './fleetCompany'
  13. import CreditLimit from './CreditLimit'
  14. import FinancialRouter from './FinancialRouter'
  15. import PosRouter from './PosRouter'
  16. import RfidRouter from './RfidRouter'
  17. Vue.use(VueRouter)
  18. const constantRoutes = [
  19. {
  20. path: '/',
  21. redirect: '/dashboard'
  22. },
  23. {
  24. path: '/redirect',
  25. component: Layout,
  26. hidden: true,
  27. children: [
  28. {
  29. path: '/redirect/:path*',
  30. component: () => import('@/views/redirect/index'),
  31. }
  32. ]
  33. },
  34. {
  35. path: '/login',
  36. component: () => import('@/views/login/index'),
  37. meta: {
  38. title: 'Login'
  39. },
  40. hidden: true
  41. },
  42. {
  43. path: '/administrator',
  44. component: Layout,
  45. meta: {
  46. title: 'Administrator',
  47. subTitle: 'Settings',
  48. icon: 'administrator',
  49. activeIcon: 'administrator-active',
  50. affix: true
  51. },
  52. children: [
  53. {
  54. path: '/administrator',
  55. component: () => import('@/views/Administrator'),
  56. name: 'administrator',
  57. meta: {
  58. title: 'Administrator',
  59. subTitle: 'Settings',
  60. icon: 'administrator',
  61. breadcrumb: false,
  62. }
  63. }
  64. ],
  65. },
  66. {
  67. path: '/dashboard',
  68. component: Layout,
  69. meta: {
  70. title: 'Dashboard',
  71. icon: 'dashboard',
  72. activeIcon: 'dashboard-active',
  73. affix: true
  74. },
  75. children: [
  76. {
  77. path: '/dashboard',
  78. component: () => import('@/views/dashboard/Dashboard'),
  79. name: 'dashboard',
  80. meta: {
  81. title: 'Dashboard',
  82. icon: 'dashboard',
  83. breadcrumb: false
  84. }
  85. },
  86. {
  87. path: '/maps',
  88. component: () => import('@/views/dashboard/Maps'),
  89. name: 'maps',
  90. meta: {
  91. title: 'Maps',
  92. icon: 'dashboard',
  93. },
  94. hidden: true
  95. }
  96. ],
  97. },
  98. SiteRouter,
  99. ChargeRouter,
  100. Transactions,
  101. {
  102. path: '/error-table',
  103. component: Layout,
  104. meta: {
  105. title: 'Error Table',
  106. icon: 'error-table',
  107. activeIcon: 'error-table-active',
  108. affix: true
  109. },
  110. children: [
  111. {
  112. path: '/error-table',
  113. component: () => import('@/views/transaction/error_table'),
  114. name: 'error-table',
  115. meta: {
  116. title: 'Error Table',
  117. icon: 'error-table',
  118. breadcrumb: false
  119. }
  120. }
  121. ]
  122. },
  123. ChargingProfile,
  124. FinancialRouter,
  125. UserRouter,
  126. //driver,
  127. {
  128. path: '/feedback-management',
  129. component: Layout,
  130. meta: {
  131. title: 'Feedback Management',
  132. icon: 'feedback-management',
  133. activeIcon: 'feedback-management-active',
  134. affix: true
  135. },
  136. children: [
  137. {
  138. path: '/feedback-management',
  139. component: () => import('@/views/feedback/FeedbackManagement'),
  140. name: 'feedback-management',
  141. meta: {
  142. title: 'Feedback Management',
  143. breadcrumb: false
  144. }
  145. },
  146. {
  147. path: '/feedback-management/view/:id',
  148. component: () => import('@/views/feedback/Detail'),
  149. name: 'feedback-view',
  150. meta: {
  151. title: 'View Feedback',
  152. activeMenu: '/feedback-management'
  153. }
  154. }
  155. ],
  156. },
  157. OCPPRouter,
  158. {
  159. path: '/reports',
  160. component: Layout,
  161. children: [
  162. {
  163. path: '/reports/index',
  164. component: () => import('@/views/Reports'),
  165. name: 'reports',
  166. meta: {
  167. title: 'Reports',
  168. icon: 'reports',
  169. activeIcon: 'reports-active',
  170. }
  171. }
  172. ],
  173. },
  174. {
  175. path: '/notification',
  176. component: Layout,
  177. meta: {
  178. title: 'Notification Management',
  179. icon: 'notification',
  180. activeIcon: 'notification-active',
  181. affix: true
  182. },
  183. children: [
  184. {
  185. path: '/notification',
  186. component: () => import('@/views/notification/index'),
  187. name: 'notification',
  188. meta: {
  189. title: 'Notification Management',
  190. icon: 'notification',
  191. activeIcon: 'notification-active',
  192. breadcrumb: false
  193. }
  194. },
  195. {
  196. path: '/notification/add',
  197. component: () => import('@/views/notification/add'),
  198. name: 'notification-add',
  199. meta: {
  200. title: 'Add Notification',
  201. activeMenu: '/notification',
  202. icon: 'notification',
  203. activeIcon: 'notification-active'
  204. }
  205. },
  206. {
  207. path: '/notification/:id',
  208. component: () => import('@/views/notification/add'),
  209. name: 'notification-add',
  210. meta: {
  211. title: 'View Notification',
  212. activeMenu: '/notification'
  213. }
  214. }
  215. ],
  216. },
  217. ProviderRouter,
  218. fleetCompanyRoute,
  219. CreditLimit,
  220. PosRouter,
  221. RfidRouter
  222. /*OCPI*/
  223. ]
  224. const asyncRoutes = []
  225. export {
  226. constantRoutes,
  227. asyncRoutes,
  228. }
  229. const createRouter = () => new VueRouter({
  230. // mode: 'history', // require service support
  231. scrollBehavior: () => ({
  232. y: 0
  233. }),
  234. routes: constantRoutes
  235. })
  236. const router = createRouter()
  237. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  238. export function resetRouter() {
  239. const newRouter = createRouter()
  240. router.matcher = newRouter.matcher // reset router
  241. }
  242. export default router