import Vue from 'vue'
import Router from 'vue-router'

import routerBefore from '@/config/routerBefore.js'

Vue.use(Router)

const constantRouterMap = [{
  path: '/',
  name: 'main',
  component: resolve => require(['@/components/main.vue'], resolve),
  redirect: {
    name: 'measurementForecastManagementOfTruckScale'
  },
  children: [
    {
      path: 'measurementForecastManagementOfTruckScale',
      name: 'measurementForecastManagementOfTruckScale',
      component: resolve => require(['../components/measurementForecastManagementOfTruckScale.vue'], resolve)
    },
    {
      path: 'measurementAndForecastOfTrackScale',
      name: 'measurementAndForecastOfTrackScale',
      component: resolve => require(['../components/measurementAndForecastOfTrackScale.vue'], resolve)
    },
    {
      path: 'bookingManagementOfTruckScaleMeasurement',
      name: 'bookingManagementOfTruckScaleMeasurement',
      component: resolve => require(['../components/bookingManagementOfTruckScaleMeasurement.vue'], resolve)
    },
    {
      path: 'measurementContract',
      name: 'measurementContract',
      component: resolve => require(['../components/measurementContract.vue'], resolve)
    },
    {
      path: 'truckScaleMeasurementForecastInquiry',
      name: 'truckScaleMeasurementForecastInquiry',
      component: resolve => require(['../components/truckScaleMeasurementForecastInquiry.vue'], resolve)
    },
    { // 动轨预报管理
      path: 'dynamicMeasurementForecast',
      name: 'dynamicMeasurementForecast',
      component: resolve => require(['../components/dynamicMeasurementForecast.vue'], resolve)
    },
    { // 分检重量转移
      path: 'forecastMatchScale',
      name: 'forecastMatchScale',
      component: resolve => require(['../components/forecastMatchScale.vue'], resolve)
    },
    { // 集装箱预报
      path: 'containerForecast',
      name: 'containerForecast',
      component: resolve => require(['../components/containerForecast.vue'], resolve)
    },
    { // 分检预报
      path: 'inspectionForecast',
      name: 'inspectionForecast',
      component: resolve => require(['../components/inspectionForecast.vue'], resolve)
    }
  ]
}];
const router = new Router({
  routes: constantRouterMap
})

//  before
routerBefore(router, constantRouterMap);

export default router;
//  constantRouterMap
export const routes = constantRouterMap;
