index.ts 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import pinia, { useAccountStore } from '@/stores';
  2. import { createRouter, createWebHistory } from 'vue-router';
  3. const router = createRouter({
  4. history: createWebHistory(import.meta.env.BASE_URL),
  5. routes: [
  6. { path: '/login', component: () => import('@/pages/login.vue') },
  7. {
  8. path: '/',
  9. component: () => import(`@/pages/index.vue`),
  10. children: [
  11. { path: 'patient/history', component: () => import(`@/pages/index/patient/history.vue`) },
  12. {
  13. path: 'patient/room',
  14. components: {
  15. default: () => import(`@/pages/index/patient/room@default.vue`),
  16. aside: () => import(`@/pages/index/patient/room@aside.vue`),
  17. },
  18. },
  19. {
  20. path: 'system',
  21. children: [
  22. { path: 'user', component: () => import(`@/pages/index/system/user.vue`) },
  23. { path: 'role', component: () => import(`@/pages/index/system/role.vue`) },
  24. { path: 'tag', component: () => import(`@/pages/index/system/tag.vue`) },
  25. { path: 'organization', component: () => import(`@/pages/index/system/organization.vue`) },
  26. { path: 'institution', component: () => import(`@/pages/index/system/institution.vue`) },
  27. ],
  28. },
  29. { path: '', redirect: '/patient/history' },
  30. {
  31. path: 'follow',
  32. children: [
  33. { path: 'plan', component: () => import(`@/pages/index/follow/plan.vue`) },
  34. { path: 'task', component: () => import(`@/pages/index/follow/task.vue`) },
  35. { path: 'assessment', component: () => import(`@/pages/index/follow/assessment.vue`) },
  36. ],
  37. },
  38. {
  39. path: 'care',
  40. children: [
  41. { path: 'supplier', component: () => import(`@/pages/index/care/supplier.vue`) },
  42. { path: 'serviceItems', component: () => import(`@/pages/index/care/serviceItems.vue`) },
  43. { path: 'systemService', component: () => import(`@/pages/index/care/systemService.vue`) },
  44. { path: 'institutionService', component: () => import(`@/pages/index/care/institutionService.vue`) },
  45. { path: 'issueService', component: () => import(`@/pages/index/care/issueService.vue`) },
  46. { path: 'conditioningRecord', component: () => import(`@/pages/index/care/conditioningRecord.vue`) },
  47. { path: 'configured', component: () => import(`@/pages/index/care/configured.vue`) },
  48. ],
  49. },
  50. {
  51. path: 'equipment',
  52. children: [
  53. { path: 'registe', component: () => import(`@/pages/index/equipment/registe.vue`) },
  54. { path: 'configured', component: () => import(`@/pages/index/equipment/configured.vue`) },
  55. { path: 'reportManagement', component: () => import(`@/pages/index/equipment/reportManagement.vue`) },
  56. ],
  57. },
  58. {
  59. path: 'tcmRecuperation',
  60. children: [
  61. { path: 'preserve', component: () => import(`@/pages/index/tcmRecuperation/preserve.vue`) },
  62. { path: 'system', component: () => import(`@/pages/index/tcmRecuperation/system.vue`) },
  63. { path: 'institution', component: () => import(`@/pages/index/tcmRecuperation/institution.vue`) },
  64. ],
  65. },
  66. {
  67. path: 'online', children: [
  68. { path: 'onlineConsult', component: () => import(`@/pages/index/online/onlineConsult.vue`) },
  69. ],
  70. },
  71. {
  72. path: 'healthy',
  73. children: [{ path: 'education', component: () => import(`@/pages/index/healthy/education.vue`) }],
  74. },
  75. {
  76. path: 'notify',
  77. children: [{ path: 'manage', component: () => import(`@/pages/index/notify/manage.vue`) }],
  78. },
  79. {
  80. path: 'satisfaction',
  81. children: [{ path: 'survey', component: () => import(`@/pages/index/satisfaction/survey.vue`) }],
  82. },
  83. {
  84. path: 'order',
  85. children: [
  86. { path: 'management', component: () => import(`@/pages/index/order/management.vue`) },
  87. { path: 'dispatchOrder', component: () => import(`@/pages/index/order/dispatchOrder.vue`) },
  88. { path: 'shipment', component: () => import(`@/pages/index/order/shipment.vue`) },
  89. { path: 'revenueSharing', component: () => import(`@/pages/index/order/revenueSharing.vue`) },
  90. { path: 'afterSale', component: () => import(`@/pages/index/order/afterSale.vue`) },
  91. ],
  92. },
  93. ],
  94. beforeEnter(to, from, next) {
  95. if (useAccountStore(pinia).token) {
  96. next();
  97. } else {
  98. next({ path: '/login' });
  99. }
  100. },
  101. },
  102. ],
  103. });
  104. export default router;