import { createRouter, createWebHashHistory } from 'vue-router' import Login from '../views/Login.vue' import Index from '../views/Index.vue' import MenuList from '../views/SystemMngr/Menu/List.vue' import AdminGroupList from '../views/SystemMngr/Group/List.vue' import AdminUserList from '../views/SystemMngr/User/List.vue' import AdminChangPwd from '../views/SystemMngr/User/ChangPwd.vue' import HealthCalendar from '../views/AppointmentMngr/HealthCalendar.vue' import Dashboard from '../views/MedicalCenter/Dashboard.vue' const router = createRouter({ history: createWebHashHistory(import.meta.env.BASE_URL), routes: [ { path: '/', name: 'Login1', component: Login, meta: { requiresAuth: false } }, { path: '/login', name: 'Login', component: Login, meta: { requiresAuth: false } },{ path: '/autologin', name: 'AutoLogin', component: () => import('../views/AutoLogin.vue'), meta: { requiresAuth: false } }, { path: '/caslogin', name: 'CasLogin', component: () => import('../views/CasLogin.vue'), meta: { requiresAuth: false } },{ path: '/hislogin', name: 'HisLogin', component: () => import('../views/HisLogin.vue'), meta: { requiresAuth: false } }, { path: '/doctorappointment', name: 'DoctorAppointment', component: () => import('../views/YeWu/DoctorYuYue.vue'), meta: { requiresAuth: false } }, { path: '/index', name: 'Index', component: Index, children: [{ path: '/dashboard', name: 'Dashboard', component: Dashboard, meta: { title: '数据面板' } }, { path: '/menuList', name: 'menuList', component: MenuList, meta: { title: '菜单管理' } }, { path: '/groupMngr', name: 'AdminGroupList', component: AdminGroupList, meta: { title: '组管理' } }, { path: '/adminUserList', name: 'AdminUserList', component: AdminUserList, meta: { title: '系统用户管理' } }, { path: '/adminChangPwd', name: 'AdminChangPwd', component: AdminChangPwd, meta: { title: '用户中心' } },{ path: '/systemMngr/systemConfig', name: 'SystemMngrSystemConfig', component: () => import('../views/SystemMngr/SystemConfig.vue'), meta: { title: '系统参数设置' } }, { path: '/healthCalendar', name: 'HealthCalendar', component: HealthCalendar, meta: { title: '体检日历' } }, { path: '/yewu/mainList', name: 'YewuManiList', component: () => import('../views/YeWu/MainList.vue'), meta: { title: '主工作列表' } }, { path: '/yewu/CheckItemConfig', name: 'YewuCheckItemConfig', component: () => import('../views/YeWu/CheckItemConfig.vue'), meta: { title: '检查项目设置' } },{ path: '/yewu/devicesConfig', name: 'YewuDevicesConfig', component: () => import('../views/YeWu/DevicesConfig.vue'), meta: { title: '服务组设置' } },{ path: '/yewu/departmentConfig', name: 'YewuDepartmentConfig', component: () => import('../views/YeWu/DepartmentConfig.vue'), meta: { title: '科室管理' } },{ path: '/yewu/departmentResources', name: 'YewuDepartmentResources', component: () => import('../views/YeWu/DepartmentResources.vue'), meta: { title: '资源管理' } },{ path: '/appointmentmngr/timeperiodmngr', name: 'AppointmentMngrTimePeriodMngr', component: () => import('../views/AppointmentMngr/TimePeriodMngr.vue'), meta: { title: '时间段管理' } },{ path: '/appointmentmngr/planmodel', name: 'AppointmentMngrPlanModel', component: () => import('../views/AppointmentMngr/PlanModel.vue'), meta: { title: '预约资源计划' } },{ path: '/appointmentmngr/planlist', name: 'AppointmentMngrPlanList', component: () => import('../views/AppointmentMngr/PlanList.vue'), meta: { title: '预约资源明细' } },{ path: '/appointmentmngr/ratio', name: 'AppointmentmngrRatio', component: () => import('../views/AppointmentMngr/RatioMngr.vue'), meta: { title: '各渠道比例设置' } },{ path: '/yewu/inpatientwardconfig', name: 'InpatientWardConfig', component: () => import('../views/YeWu/InpatientWardConfig.vue'), meta: { title: '病区管理' } },{ path: '/yewu/MainList_ZhuYuan', name: 'MainList_ZhuYuan', component: () => import('../views/YeWu/MainList_ZhuYuan.vue'), meta: { title: '主工作列表(住院)' } },{ path: '/info/EntrustList', name: 'EntrustList', component: () => import('../views/Info/EntrustList.vue'), meta: { title: '医嘱信息列表' } },{ path: '/info/PlanList', name: 'InfoPlanList', component: () => import('../views/Info/PlanList.vue'), meta: { title: '资源信息列表' } },{ path: '/info/AppointmentTj', name: 'InfoAppointmentTj', component: () => import('../views/Info/AppointmentTj.vue'), meta: { title: '预约统计' } },{ path: '/info/MakeListTj', name: 'InfoMakeListTj', component: () => import('../views/Info/MakeListTj.vue'), meta: { title: '开单统计' } },{ path: '/info/PlanTj', name: 'infoPlanTj', component: () => import('../views/Info/PlanTj.vue'), meta: { title: '号源统计' } }] }, ] }) import { CheckMenuAuth } from "@/api/api.js"; import { ElMessage } from 'element-plus' router.beforeEach((to, from, next) => { console.log(to.meta.requiresAuth) const url = to.path if (to.meta.requiresAuth == false) { next() } else { const NewUrl = url.substring(1) CheckMenuAuth({ url: NewUrl }).then(res => { if (res.status) { next(); } else { ElMessage.error(res.msg) next('/'); } }) } }) export default router