index copy.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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. // import chartsRouter from './modules/charts'
  9. // import tableRouter from './modules/table'
  10. // import nestedRouter from './modules/nested'
  11. /**
  12. * Note: sub-menu only appear when route children.length >= 1
  13. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  14. *
  15. * hidden: true if set true, item will not show in the sidebar(default is false)
  16. * alwaysShow: true if set true, will always show the root menu
  17. * if not set alwaysShow, when item has more than one children route,
  18. * it will becomes nested mode, otherwise not show the root menu
  19. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  20. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  21. * meta : {
  22. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  23. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  24. icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
  25. noCache: true if set true, the page will no be cached(default is false)
  26. affix: true if set true, the tag will affix in the tags-view
  27. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  28. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  29. }
  30. */
  31. /**
  32. * constantRoutes
  33. * a base page that does not have permission requirements
  34. * all roles can be accessed
  35. */
  36. export const constantRoutes = [
  37. {
  38. path: '/redirect',
  39. component: Layout,
  40. hidden: true,
  41. children: [
  42. {
  43. path: '/redirect/:path(.*)',
  44. component: () => import('@/views/redirect/index')
  45. }
  46. ]
  47. },
  48. {
  49. path: '/login',
  50. component: () => import('@/views/login/index'),
  51. hidden: true
  52. },
  53. {
  54. path: '/auth-redirect',
  55. component: () => import('@/views/login/auth-redirect'),
  56. hidden: true
  57. },
  58. {
  59. path: '/404',
  60. component: () => import('@/views/error-page/404'),
  61. hidden: true
  62. },
  63. {
  64. path: '/401',
  65. component: () => import('@/views/error-page/401'),
  66. hidden: true
  67. }
  68. ]
  69. /**
  70. * asyncRoutes
  71. * the routes that need to be dynamically loaded based on user roles
  72. */
  73. export const asyncRoutes = [
  74. {
  75. path: '/',
  76. component: Layout,
  77. redirect: '/dashboard',
  78. children: [
  79. {
  80. path: 'dashboard',
  81. component: () => import('@/views/dashboard/index'),
  82. name: 'Dashboard',
  83. meta: { title: '数据看板', icon: 'dashboard', affix: true, noCache: true }
  84. }
  85. ]
  86. },
  87. {
  88. path: '/operate',
  89. component: Layout,
  90. redirect: '/operate/operate',
  91. children: [
  92. {
  93. path: 'operate',
  94. component: () => import('@/views/operate/index'),
  95. name: 'operate',
  96. meta: { title: '病种运营', icon: 'el-icon-s-marketing', affix: true }
  97. },
  98. {
  99. path: 'operateDetail',
  100. component: () => import('@/views/operate/detail/index'),
  101. name: 'operateDetail',
  102. hidden: true,
  103. meta: { title: '运营分析', icon: 'el-icon-s-data', affix: true }
  104. }
  105. ]
  106. },
  107. {
  108. path: '/task',
  109. component: Layout,
  110. redirect: '/task',
  111. meta: { title: '我的任务', icon: 'el-icon-s-order', affix: true },
  112. children: [
  113. {
  114. path: 'index',
  115. component: () => import('@/views/task/unfinish'),
  116. name: 'task',
  117. meta: { title: '待执行任务', icon: 'el-icon-s-order', affix: true }
  118. },
  119. {
  120. path: 'noindex',
  121. component: () => import('@/views/task/finish'),
  122. name: 'task',
  123. meta: { title: '已完成任务', icon: 'el-icon-s-claim', affix: true }
  124. }
  125. ]
  126. },
  127. {
  128. path: '/user',
  129. component: Layout,
  130. redirect: '/user/index',
  131. meta: { title: '患者管理', icon: 'user', affix: true },
  132. children: [{
  133. path: 'tag',
  134. component: () => import('@/views/user/tag'),
  135. name: 'user',
  136. meta: { title: '我的患者', icon: 'user', affix: true }
  137. },
  138. {
  139. path: 'index',
  140. component: () => import('@/views/user/index'),
  141. name: 'user',
  142. meta: { title: '数据分析', icon: 'user', affix: true }
  143. },
  144. {
  145. path: 'health-document/index',
  146. component: () => import('@/views/user/health-document/index'),
  147. name: 'health-document',
  148. hidden: true,
  149. meta: { title: '患者详情', icon: 'user', affix: true }
  150. }
  151. ]
  152. },
  153. {
  154. path: '/tag',
  155. component: Layout,
  156. redirect: '/tag/index',
  157. meta: { title: '数据标签', icon: 'el-icon-s-management', affix: true },
  158. children: [
  159. {
  160. path: 'index',
  161. component: () => import('@/views/tag/index'),
  162. name: 'tags-list',
  163. meta: { title: '数据标签', icon: 'el-icon-s-management', affix: true }
  164. },
  165. {
  166. path: 'detail',
  167. component: () => import('@/views/tag/detail'),
  168. name: 'tags-detail',
  169. hidden: true,
  170. meta: { title: '标签详情', icon: 'el-icon-s-management', affix: true }
  171. }
  172. ]
  173. },
  174. {
  175. path: '/database',
  176. component: Layout,
  177. name: 'database',
  178. redirect: '/database/ods',
  179. meta: { title: '数据仓库', icon: 'el-icon-box', noCache: true },
  180. children: [
  181. {
  182. path: 'ods',
  183. component: () => import('@/views/database/ods/list'),
  184. name: 'ods',
  185. meta: { title: 'ODS数据层', icon: 'el-icon-box', noCache: true }
  186. },
  187. {
  188. path: 'dwd',
  189. component: () => import('@/views/database/dwd/list'),
  190. name: 'dwd',
  191. meta: { title: 'DWD数据层', icon: 'el-icon-box', noCache: true }
  192. }
  193. // {
  194. // path: 'logs',
  195. // component: () => import('@/views/database/logs/list'),
  196. // name: 'logs',
  197. // meta: { title: '同步日志', icon: 'el-icon-box', noCache: true }
  198. // }
  199. ]
  200. },
  201. {
  202. path: '/datacleaning',
  203. component: Layout,
  204. name: 'datacleaning',
  205. redirect: '/datacleaning/index',
  206. meta: { title: '数据清洗', icon: 'el-icon-box', noCache: true },
  207. children: [
  208. {
  209. path: 'standard',
  210. component: () => import('@/views/datacleaning/standard/list'),
  211. name: 'standard',
  212. meta: { title: '规则配置', icon: 'el-icon-box', noCache: true }
  213. },
  214. {
  215. path: 'logs',
  216. component: () => import('@/views/datacleaning/logs/list'),
  217. name: 'logs',
  218. meta: { title: '清洗日志', icon: 'el-icon-box', noCache: true }
  219. },
  220. {
  221. path: 'error-log',
  222. component: () => import('@/views/datacleaning/logs/error'),
  223. name: 'logs',
  224. meta: { title: '错误日志', icon: 'el-icon-box', noCache: true }
  225. }
  226. ]
  227. },
  228. {
  229. path: '/reports',
  230. component: Layout,
  231. name: 'reports',
  232. redirect: '/reports/index',
  233. meta: { title: '医生统计', icon: 'el-icon-box', noCache: true },
  234. children: [
  235. {
  236. path: 'standard',
  237. component: () => import('@/views/reports/index'),
  238. name: 'standard',
  239. meta: { title: '医生统计', icon: 'el-icon-box', noCache: true }
  240. }
  241. ]
  242. },
  243. {
  244. path: '/statistics',
  245. component: Layout,
  246. redirect: '/statistics',
  247. name: '统计看板',
  248. meta: { title: '统计看板', icon: 'el-icon-box', noCache: true },
  249. children: [
  250. {
  251. path: 'statistics',
  252. component: () => import('@/views/statistics/index'),
  253. name: 'statistics',
  254. meta: { title: '统计看板', icon: 'dashboard', affix: true, noCache: true }
  255. },
  256. {
  257. path: 'plan',
  258. component: () => import('@/views/statistics/plan'),
  259. name: 'plan',
  260. meta: { title: '个案管理统计', icon: 'dashboard', affix: true, noCache: true }
  261. },
  262. {
  263. path: 'task',
  264. component: () => import('@/views/statistics/task'),
  265. name: 'task',
  266. meta: { title: '任务统计', icon: 'dashboard', affix: true, noCache: true }
  267. }
  268. ]
  269. },
  270. // 404 page must be placed at the end !!!
  271. { path: '*', redirect: '/404', hidden: true }
  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