index.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '@/layout'
  6. /* Router Modules */
  7. //import componentsRouter from './modules/components'
  8. /**
  9. * Note: sub-menu only appear when route children.length >= 1
  10. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  11. *
  12. * hidden: true if set true, item will not show in the sidebar(default is false)
  13. * alwaysShow: true if set true, will always show the root menu
  14. * if not set alwaysShow, when item has more than one children route,
  15. * it will becomes nested mode, otherwise not show the root menu
  16. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  17. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  18. * meta : {
  19. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  20. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  21. icon: 'svg-name' the icon show in the sidebar
  22. noCache: true if set true, the page will no be cached(default is false)
  23. affix: true if set true, the tag will affix in the tags-view
  24. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  25. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  26. }
  27. */
  28. /**
  29. * constantRoutes
  30. * a base page that does not have permission requirements
  31. * all roles can be accessed
  32. */
  33. export const constantRoutes = [{
  34. path: '/redirect',
  35. component: Layout,
  36. hidden: true,
  37. children: [{
  38. path: '/redirect/:path*',
  39. component: () => import('@/views/redirect/index')
  40. }]
  41. },
  42. {
  43. path: '/login',
  44. component: () => import('@/views/login/index'),
  45. hidden: true
  46. },
  47. {
  48. path: '/auth-redirect',
  49. component: () => import('@/views/login/auth-redirect'),
  50. hidden: true
  51. },
  52. {
  53. path: '/404',
  54. component: () => import('@/views/error-page/404'),
  55. hidden: true
  56. },
  57. {
  58. path: '/401',
  59. component: () => import('@/views/error-page/401'),
  60. hidden: true
  61. },
  62. {
  63. path: '/',
  64. component: Layout,
  65. redirect: '/dashboard',
  66. children: [{
  67. path: 'dashboard',
  68. component: () => import('@/views/dashboard/index'),
  69. name: 'Dashboard',
  70. meta: {
  71. title: 'dashboard',
  72. icon: 'dashboard',
  73. affix: true
  74. }
  75. }]
  76. },
  77. {
  78. path: '/profile',
  79. component: Layout,
  80. redirect: '/profile/index',
  81. hidden: true,
  82. children: [{
  83. path: 'index',
  84. component: () => import('@/views/profile/index'),
  85. name: 'Profile',
  86. meta: {
  87. title: 'profile',
  88. icon: 'user',
  89. noCache: true
  90. }
  91. }]
  92. }
  93. ]
  94. /**
  95. * asyncRoutes
  96. * the routes that need to be dynamically loaded based on user roles
  97. */
  98. // export const asyncRoutes = [{
  99. // path: '/saas',
  100. // component: Layout,
  101. // redirect: '/saas/tenant',
  102. // alwaysShow: true,
  103. // name: 'SAAS',
  104. // meta: {
  105. // title: 'SaaS',
  106. // icon: 'cloud',
  107. // roles: ['AbpTenantManagement.Tenants'],
  108. // },
  109. // children: [{
  110. // path: 'tenant',
  111. // component: () => import('@/views/tenant/index'),
  112. // name: 'Tenant',
  113. // meta: {
  114. // title: 'tenant',
  115. // roles: ['AbpTenantManagement.Tenants'],
  116. // icon: 'users'
  117. // }
  118. // }]
  119. // },
  120. // {
  121. // path: '/system',
  122. // component: Layout,
  123. // redirect: '/system/user',
  124. // alwaysShow: true,
  125. // name: 'SystemManagement',
  126. // meta: {
  127. // title: 'systemManagement',
  128. // icon: 'system'
  129. // },
  130. // children: [
  131. // {
  132. // path: 'menu',
  133. // component: () => import('@/views/menu/index'),
  134. // name: 'Menu',
  135. // meta: {
  136. // title: 'menu',
  137. // icon: 'menu'
  138. // }
  139. // },
  140. // {
  141. // path: 'user',
  142. // component: () => import('@/views/user/index'),
  143. // name: 'User',
  144. // meta: {
  145. // title: 'user',
  146. // roles: ['AbpIdentity.Users'],
  147. // icon: 'user'
  148. // }
  149. // },
  150. // {
  151. // path: 'role',
  152. // component: () => import('@/views/role/index'),
  153. // name: 'Role',
  154. // meta: {
  155. // title: 'role',
  156. // roles: ['AbpIdentity.Roles'],
  157. // icon: 'role'
  158. // }
  159. // },
  160. // {
  161. // path: 'org',
  162. // component: () => import('@/views/org/index'),
  163. // name: 'Organization',
  164. // meta: {
  165. // title: 'org',
  166. // roles: ['BaseService.Organization'],
  167. // icon: 'org'
  168. // }
  169. // },
  170. // {
  171. // path: 'dict',
  172. // component: () => import('@/views/dict/index'),
  173. // name: 'Dictionary',
  174. // meta: {
  175. // title: 'dict',
  176. // roles: ['BaseService.DataDictionary'],
  177. // icon: 'data'
  178. // }
  179. // },
  180. // {
  181. // path: 'job',
  182. // component: () => import('@/views/job/index'),
  183. // name: 'Job',
  184. // meta: {
  185. // title: 'job',
  186. // roles: ['BaseService.Job'],
  187. // icon: 'job'
  188. // }
  189. // },
  190. // {
  191. // path: 'log',
  192. // component: () => import('@/views/log/index'),
  193. // name: 'Log',
  194. // meta: {
  195. // title: 'log',
  196. // roles: ['BaseService.AuditLogging'],
  197. // icon: 'log'
  198. // }
  199. // },
  200. // ]
  201. // },
  202. // {
  203. // path: '/base',
  204. // component: Layout,
  205. // redirect: '/base/book',
  206. // alwaysShow: true,
  207. // name: 'BASE',
  208. // meta: {
  209. // title: 'base',
  210. // icon: 'base'
  211. // },
  212. // children: [{
  213. // path: 'book',
  214. // component: () => import('@/views/book/index'),
  215. // name: 'Book',
  216. // meta: {
  217. // title: 'book',
  218. // icon: 'book'
  219. // }
  220. // }]
  221. // },
  222. // {
  223. // path: '/tool',
  224. // component: Layout,
  225. // redirect: '/tool/form',
  226. // alwaysShow: true,
  227. // name: 'Tool',
  228. // meta: {
  229. // title: 'tool',
  230. // icon: 'tool',
  231. // roles: ['FormManagement.Form','FlowManagement.Flow','FormManagement.FormBuild','StorageManagement.File']
  232. // },
  233. // children: [{
  234. // path: 'form',
  235. // component: () => import('@/views/form/index'),
  236. // name: 'Forms',
  237. // meta: {
  238. // title: 'form',
  239. // roles: ['FormManagement.Form'],
  240. // icon: 'control'
  241. // }
  242. // },
  243. // // {
  244. // // path: 'dynamic',
  245. // // component: () => import('@/views/form/dynamic'),
  246. // // name: 'Dynamic',
  247. // // meta: {
  248. // // title: 'dynamic',
  249. // // icon: 'control'
  250. // // }
  251. // // },
  252. // {
  253. // path: 'formCreate',
  254. // component: () => import('@/views/form/create'),
  255. // name: 'FormCreate',
  256. // meta: {
  257. // roles: ['FormManagement.Form.Create'],
  258. // title: 'formCreate'
  259. // },
  260. // hidden: true
  261. // },
  262. // {
  263. // path: 'formEdit/:id',
  264. // component: () => import('@/views/form/edit'),
  265. // name: 'FormEdit',
  266. // meta: {
  267. // roles: ['FormManagement.Form.Update'],
  268. // title: 'formEdit'
  269. // },
  270. // hidden: true
  271. // },
  272. // {
  273. // path: 'flow',
  274. // component: () => import('@/views/flow-design/index'),
  275. // name: 'Flows',
  276. // meta: {
  277. // title: 'flows',
  278. // roles: ['FlowManagement.Flow'],
  279. // icon: 'flow'
  280. // },
  281. // },
  282. // {
  283. // path: 'flowDisplay/:id',
  284. // component: () => import('@/views/flow/display'),
  285. // name: 'FlowDisplay',
  286. // meta: {
  287. // title: 'flowDisplay',
  288. // roles: ['FlowManagement.Flow'],
  289. // },
  290. // hidden: true
  291. // },
  292. // {
  293. // path: 'flowCreate',
  294. // component: () => import('@/views/flow-design/create'),
  295. // name: 'FlowDesignCreate',
  296. // meta: {
  297. // roles: ['FlowManagement.Flow.Create'],
  298. // title: 'flowDesignCreate'
  299. // },
  300. // hidden: true
  301. // },
  302. // {
  303. // path: 'flowEdit/:id',
  304. // component: () => import('@/views/flow-design/edit'),
  305. // name: 'FlowDesignEdit',
  306. // meta: {
  307. // roles: ['FlowManagement.Flow.Update'],
  308. // title: 'flowDesignEdit'
  309. // },
  310. // hidden: true
  311. // },
  312. // {
  313. // path: 'build',
  314. // component: () => import('@/views/build/index'),
  315. // name: 'Builds',
  316. // meta: {
  317. // title: 'build',
  318. // roles: ['FormManagement.FormBuild'],
  319. // icon: 'code'
  320. // }
  321. // },
  322. // {
  323. // path: 'buildEdit/:id',
  324. // component: () => import('@/views/build/components/index'),
  325. // name: 'BuildEdit',
  326. // meta: {
  327. // roles: ['FormManagement.FormBuild.Update'],
  328. // title: 'buildEdit'
  329. // },
  330. // hidden: true
  331. // },
  332. // {
  333. // path:'storage',
  334. // component: () => import('@/views/storage/index'),
  335. // name: 'Storage',
  336. // meta: {
  337. // title: 'storage',
  338. // roles: ['StorageManagement.File'],
  339. // icon: 'storage'
  340. // },
  341. // }
  342. // ]
  343. // },
  344. // /** when your routing map is too long, you can split it into small modules **/
  345. // componentsRouter,
  346. // // 404 page must be placed at the end !!!
  347. // {
  348. // path: '*',
  349. // redirect: '/404',
  350. // hidden: true
  351. // }
  352. // ]
  353. const createRouter = () => new Router({
  354. // mode: 'history', // require service support
  355. scrollBehavior: () => ({
  356. y: 0
  357. }),
  358. routes: constantRoutes
  359. })
  360. const router = createRouter()
  361. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  362. export function resetRouter() {
  363. const newRouter = createRouter()
  364. router.matcher = newRouter.matcher // reset router
  365. }
  366. export default router