import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'home',
    redirect: '/monitor',
  },
  {
    path: '/monitor',
    name: 'monitor',
    meta: { title: '运营监控' },
    component: () => import('@/views/pageMonitor/MonitorIndex.vue'),
  },
  {
    path: '/scheduling',
    name: 'scheduling',
    meta: { title: '护理人员排班' },
    component: () => import('@/views/pageScheduling/SchedulingIndex.vue'),
  },
  {
    path: '/operation',
    name: 'operation',
    meta: { title: '首台率' },
    component: () => import('@/views/pageOperation/OperationIndex.vue'),
  },
  {
    path: '/room',
    name: 'room',
    meta: { title: '手术间利用率' },
    component: () => import('@/views/pageRoom/RoomIndex.vue'),
  },
];

const router = new VueRouter({
  routes,
});

router.beforeEach((to, from, next) => {
  document.title = to.meta.title;
  next();
});

export default router;
