import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);
import kpiRouter from './kpi-router'
import invoiceRouter from "@/router/invoice-router";
import secondHandRouter from "@/router/second-hand-router";
import reportRouter from "@/router/report-router"
import authenticationRouter from "@/router/authentication-router"
const routes = [
    {
      path: '/',
      redirect: '/index'
    },
    {
        path: '/supplierAdd',
        name: 'supplierAdd',
        component: () => import('@/views/index/supplierAdd'),
        meta:{
            title: '信息录入',
        }
    },
    {
        path: '/supplierAddResult',
        name: 'supplierAddResult',
        component: () => import('@/views/index/supplierAddResult'),
        meta:{
            title: '审核中',
        }
    },
    {
        path: '/addWechat',
        name: 'addWechat',
        component: () => import('@/views/index/addWechat'),
        meta:{
            title: '添加微信',
        }
    },
    {
        path: '/supplierInfo',
        name: 'supplierInfo',
        component: () => import('@/views/index/supplierInfo'),
        meta:{
            title: '信息查看',
        }
    },
    {
        path: '/supplierTimePhone',
        name: 'supplierTimePhone',
        component: () => import('@/views/index/supplierTimePhone'),
        meta:{
            title: '供应商时段电话',
        }
    },
    {
        path: '/supplierTimePhoneEdit',
        name: 'supplierTimePhoneEdit',
        component: () => import('@/views/index/supplierTimePhoneEdit'),
        meta:{
            title: '编辑时段电话',
        }
    },
    {
      path: '/toDoList',
      name: 'toDoList',
      component: () => import('@/views/index/toDoList'),
      meta:{
        title: '代办事项',
      }
    },
    {
      path: "/reporting",
      name: 'reportingView',
      component: () => import('@/views/index/reporting.vue'),
      meta: {
        title: '报备'
      }
    },
    {
        path: "/reportingList",
        name: 'reportingList',
        component: () => import('@/views/index/reportingList.vue'),
        meta: {
            title: '查看报备'
        }
    },
    {
      path: "/workOrderDetail",
      name: 'workOrderDetail',
      component: () => import('@/views/index/workOrderDetail'),
      meta: {
        title: '工单详情'
      }
    },
    {
      path: "/supplySettlement",
      name: 'supplySettlement',
      component: () => import('@/views/index/supplySettlement'),
      meta: {
        title: '补结算单'
      }
    },
    {
        path: "/workOrderReconciliation",
        name: "workOrderReconciliation",
        component:()=>import('@/views/workOrder/workOrderReconciliation.vue'),
        meta: {
            title: '工单对账'
        }
    },
    {
      path: "/accounting",
      name: 'accountingView',
      component: () => import('@/views/workOrder/accounting.vue'),
      meta: {
        title: '记账'
      }
    },
    {
        path: "/aduitCompleteDetail",
        name: 'aduitCompleteDetail',
        component: () => import('@/views/workOrder/aduitCompleteDetail.vue'),
        meta: {
            title: '审核完成-详情'
        }
    },
    {
        path: "/settlementDetail",
        name: 'settlementDetail',
        component: () => import('@/views/workOrder/settlementDetail.vue'),
        meta: {
            title: '结算单详情'
        }
    },
    {
      path: "/invoicingNotify",
      name: 'invoicingNotify',
      component: () => import('@/views/index/invoicingNotify.vue'),
      meta: {
        title: '工单批次'
      }
    },
    {
        path: "/invoiceListInfo",
        name: 'invoiceListInfo',
        component: () => import('@/views/index/invoiceListInfo.vue'),
        meta: {
            title: '开票信息'
        }
    },
    {
        path: "/invoiceInfo",
        name: 'invoiceInfo',
        component: () => import('@/views/index/invoiceInfo.vue'),
        meta: {
            title: '开票信息'
        }
    },
    {
        path: "/invoicingDetail",
        name: 'invoicingDetail',
        component: () => import('@/views/index/invoicingDetail'),
        meta: {
            title: '工单批次详情'
        }
    },
    {
        path: "/uploadInvoice",
        name: 'uploadInvoice',
        component: () => import('@/views/index/uploadInvoice.vue'),
        meta: {
            title: '上传发票',
            cache: true
        }
    },
    {
        path: "/showInvoice",
        name: 'showInvoice',
        component: () => import('@/views/index/showInvoice.vue'),
        meta: {
            title: '查看发票'
        }
    },
    {
        path: '/damagePhotos',
        name: 'damagePhotoList',
        component: () => import('@/views/damagePhoto/damagePhotoList.vue'),
        meta: {
            title: '损伤照片'
        }
    },
    {
        path: '/environmentPhotos',
        name: 'environmentPhotoList',
        component: () => import('@/views/environmentPhoto/environmentPhotoList.vue'),
        meta: {
            title: '环境照片'
        }
    },
    {
        path: "/vehicleManage",
        name: 'vehicleManage',
        component: () => import('@/views/index/vehicleManage.vue'),
        meta: {
            title: '车辆管理'
        }
    },
    {
        path: "/vehicleAdd",
        name: 'vehicleAdd',
        component: () => import('@/views/index/vehicleAdd'),
        meta: {
            title: '车辆新增或修改',
            cache: true // keep-alive 缓存：跳转拍摄页返回时保留表单，再次从其他页面进入时由 activated 重新初始化
        }
    },
    {
        path: "/cameraGuide",
        name: 'cameraGuide',
        component: () => import('@/views/index/cameraGuide'),
        meta: {
            title: '拍摄行驶证'
        }
    },
    {
        path: "/continueInsurance",
        name: 'continueInsurance',
        component: () => import('@/views/index/continueInsurance'),
        meta: {
            title: '续保更新'
        }
    },
    {
        path: '/driverManage',
        name: 'driverManage',
        component:()=>import('@/views/index/driverManage'),
        meta:{
            title: '司机管理'
        }
    },
    {
        path: '/driverAdd',
        name: 'driverAdd',
        component:()=>import('@/views/index/driverAdd'),
        meta: {
            title:'司机新增或修改'
        }
    },
    {
        path: '/trainDocment',
        name: 'trainDocment',
        component:()=>import('@/views/documentView/trainDocment.vue'),
        meta: {
            title:'培训文档',
        }
    },
    {
        path: '/diverTrainDocment',
        name: 'diverTrainDocment',
        component:()=>import('@/views/documentView/diverTrainDocment.vue'),
        meta: {
            title:'培训文档'
        }
    },
    {
        path: '/docmentList',
        name: 'docmentList',
        component:()=>import('@/views/documentView/docmentList.vue'),
        meta: {
            title:'文档资料'
        }
    },
    {
        path: '/notificationList',
        name: 'notificationList',
        component:()=>import('@/views/index/notificationList'),
        meta: {
            title:'告知函'
        }
    },
    {
        path: '/caseList',
        name: 'caseList',
        component:()=>import('@/views/caseList/caseList.vue'),
        meta: {
            title:'案件列表'
        }
    },
    {
        path: '/driverCaseList',
        name: 'driverCaseList',
        component:()=>import('@/views/driverCaseList/driverCaseList.vue'),
        meta: {
            title:'司机app案件列表'
        }
    },
    {
        path: '/caseAuditList',
        name: 'caseAuditList',
        component:()=>import('@/views/caseList/caseAuditList.vue'),
        meta: {
            title:'案件审核列表'
        }
    },
    {
        path: '/caseDetail',
        name: 'caseDetail',
        component:()=>import('@/views/caseList/caseDetail.vue'),
        meta: {
            title:'案件详情'
        }
    },
    {
        path: '/newTrainingList',
        name: 'newTrainingList',
        component:()=>import('@/views/newcomerTraining/newTrainingList.vue'),
        meta: {
            title:'新服务商培训'
        }
    },
    {
        path: '/driverTrainingList',
        name: 'driverTrainingList',
        component:()=>import('@/views/newcomerTraining/driverTrainingList.vue'),
        meta: {
            title:'新师傅培训'
        }
    },
    {
        path: '/maintenanceList',
        name: 'vehicleMaintenanceList',
        component:()=>import('@/views/vehicle-maintenance/vehicle-maintenance-list.vue'),
        meta: {
            title:'车辆维保'
        }
    },
    {
        path: '/vehicleAlarmList',
        name: 'vehicleAlarmList',
        component:()=>import('@/views/vehicle-maintenance/vehicle-alarm-list.vue'),
        meta: {
            title:'车辆报警'
        }
    },
    {
        path: '/vehicleAlarmDetail',
        name: 'vehicleAlarmDetail',
        component:()=>import('@/views/vehicle-maintenance/vehicle-alarm-detail.vue'),
        meta: {
            title:'报警详情'
        }
    },
    {
        path: '/maintenanceApplication',
        name: 'maintenanceApplication',
        component:()=>import('@/views/vehicle-maintenance/maintenance-application.vue'),
        meta: {
            title:'维保申请'
        }
    },
    {
        path: '/batteryList',
        name: 'batteryList',
        component:()=>import('@/views/battery/batteryList.vue'),
        meta: {
            title:'电瓶进销存'
        }
    },
    {
        path: '/batteryDetail',
        name: 'batteryDetail',
        component:()=>import('@/views/battery/batteryDetail.vue'),
        meta: {
            title:'电瓶详情'
        }
    },
    {
        path: '/goToApp',
        name: 'goToApp',
        component:()=>import('@/views/goToApp/goToApp.vue'),
        meta: {
            title:'小板运输司机端'
        }
    },
    ...kpiRouter,
    ...invoiceRouter,
    ...secondHandRouter,
    ...reportRouter,
    ...authenticationRouter
  ]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

router.beforeEach(function (to, form, next) {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})
export default router
