index.js 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. /* Layout */
  4. import Layout from '@/views/layout/Layout'
  5. import data_dict from './modules/data_dict'
  6. import device from './modules/device'
  7. import dialysis from './modules/dialysis'
  8. import patient from './modules/patient'
  9. import qcd from './modules/qcd'
  10. import role from './modules/role'
  11. import stock from './modules/stock'
  12. import weight_sign from './modules/weight_sign'
  13. import workforce from './modules/workforce'
  14. import service from './modules/service'
  15. import org from './modules/org'
  16. import systems from './modules/systems'
  17. import data_upload from './modules/data_upload'
  18. import integration from './modules/integration'
  19. import slow from './modules/slow'
  20. import scrm from './modules/scrm'
  21. import shop from './modules/shop'
  22. Vue.use(Router)
  23. /** note: submenu only apppear when children.length>=1
  24. * detail see https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  25. **/
  26. /**
  27. * hidden: true if `hidden:true` will not show in the sidebar(default is false)
  28. * alwaysShow: true if set true, will always show the root menu, whatever its child routes length
  29. // 详见 xt_permission.xt_filterAsyncRouter 函数的逻辑
  30. is_menu: false 加载路由时验证用的(即该路由是否要在侧边栏展示,需要展示的即需要),为 false 时表示该路由不需要进行权限验证
  31. * if not set alwaysShow, only more than one route under the children
  32. * it will becomes nested mode, otherwise not show the root menu
  33. * redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb
  34. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  35. * meta : {
  36. title: 'title' the name show in submenu and breadcrumb (recommend set)
  37. icon: 'svg-name' the icon show in the sidebar,
  38. noCache: true if true ,the page will no be cached(default is false)
  39. // 详见 xt_permission.xt_filterAsyncRouter 函数的逻辑
  40. is_menu: false 加载路由时验证用的,为 false 时表示该路由不需要进行权限验证
  41. hidden: false 加载路由时验证用的,is_menu 为true时才有作用,为 true 时表示该路由需要进行权限验证
  42. }
  43. **/
  44. var _constant_router_map = [{
  45. path: '/token/verify',
  46. component: () => import('@/xt_pages/index/verify_token'),
  47. hidden: true
  48. },
  49. {
  50. path: '/404',
  51. component: () => import('@/views/errorPage/404'),
  52. hidden: true
  53. },
  54. {
  55. path: '/401',
  56. component: () => import('@/views/errorPage/401'),
  57. hidden: true
  58. },
  59. {
  60. path: '',
  61. component: Layout,
  62. redirect: '/home',
  63. children: [{
  64. path: '/home',
  65. component: () => import('@/xt_pages/home/index'),
  66. name: 'home',
  67. meta: {
  68. title: 'home',
  69. icon: 'dashboard',
  70. noCache: true
  71. }
  72. }]
  73. },
  74. service,
  75. // patient,
  76. // workforce,
  77. // weight_sign,
  78. // dialysis,
  79. // stock,
  80. // qcd,
  81. // data_dict,
  82. // device,
  83. // role,
  84. // org
  85. ]
  86. var _asy_router_map = [
  87. patient,
  88. workforce,
  89. weight_sign,
  90. dialysis,
  91. stock,
  92. qcd,
  93. device,
  94. org,
  95. data_upload,
  96. slow,
  97. scrm,
  98. shop,
  99. integration,
  100. systems,
  101. ]
  102. var is_asy_router = process.env.NODE_ENV === 'production' // true; 设置为 true 强制进行路由验证
  103. if (!is_asy_router) {
  104. _constant_router_map = _constant_router_map.concat(_asy_router_map)
  105. _asy_router_map = []
  106. } else {
  107. }
  108. export const xt_constantRouterMap = _constant_router_map
  109. export const xt_asyncRouterMap = _asy_router_map
  110. export default new Router({
  111. // mode: 'history', // require service support
  112. scrollBehavior: () => ({
  113. y: 0
  114. }),
  115. routes: xt_constantRouterMap
  116. })