70 lines
1.8 KiB
JavaScript
70 lines
1.8 KiB
JavaScript
import {createRouter, createWebHashHistory, createWebHistory} from "vue-router";
|
|
import {getAuther, getPerm} from "@/api/auth.js";
|
|
import useUserStore from "@/store/modules/user.js";
|
|
|
|
export const constantRoutes = [
|
|
{
|
|
path: '/synthesis',
|
|
component: () => import('@/views/synthesis/index.vue'),
|
|
meta: {title: '综合统计'}
|
|
},
|
|
{
|
|
path: '/integrative',
|
|
component: () => import('@/views/integrative/index.vue'),
|
|
meta: {title: '全院综合统计'}
|
|
},
|
|
{
|
|
path: '/hospitalization',
|
|
component: () => import('@/views/hospitalization/index.vue'),
|
|
meta: {title: '住院统计'}
|
|
}, {
|
|
path: '/inhos',
|
|
component: () => import('@/views/inhos/index.vue'),
|
|
meta: {title: '住院统计'}
|
|
},
|
|
{
|
|
path: '/outpatient',
|
|
component: () => import('@/views/outpatient/index.vue'),
|
|
meta: {title: '门诊统计'}
|
|
},
|
|
{
|
|
path: '/opd',
|
|
component: () => import('@/views/opd/index.vue'),
|
|
meta: {title: '门诊统计'}
|
|
},
|
|
{
|
|
path: '/dept',
|
|
component: () => import('@/views/dept/index.vue'),
|
|
meta: {title: '科室统计'}
|
|
},
|
|
{
|
|
path: '/401',
|
|
component: () => import('@/views/error/401.vue'),
|
|
},
|
|
|
|
]
|
|
const router = createRouter(
|
|
{
|
|
history: createWebHashHistory(),
|
|
routes: constantRoutes,
|
|
scrollBehavior(to, from, savedPosition) {
|
|
if (savedPosition) {
|
|
return savedPosition
|
|
} else {
|
|
return {top: 0}
|
|
}
|
|
},
|
|
}
|
|
)
|
|
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
await useUserStore().getInfo(to)
|
|
if (to.meta.title) {
|
|
document.title = to.meta.title
|
|
}
|
|
next()
|
|
|
|
})
|
|
|
|
export default router; |