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

import routerBefore from '@/config/routerBefore.js'
// 主要
import main from '@/components/main.vue'
// 系统配置管理
const addCapacity = () => import('../components/addCapacity.vue')
const addCapacityType = () => import('../components/addCapacityType.vue')
const addTransRange = () => import('../components/addTransRange.vue')
const transRange = () => import('../components/transRange.vue')
const addMaterialCoke = () => import('../components/addMaterialCoke.vue')
const materialCoke = () => import('../components/materialCoke.vue')
const addReceivingCompany = () =>
  import('../components/addReceivingCompany.vue')
const receivingCompany = () => import('../components/receivingCompany.vue')
const addCarDriver = () => import('../components/addCarDriver.vue')
const addCarrier = () => import('../components/addCarrier.vue')
const addConsignee = () => import('../components/addConsignee.vue')
const addGatepost = () => import('../components/addGatepost.vue')
const addMaterial = () => import('../components/addMaterial.vue')
const addOilPrice = () => import('../components/addOilPrice.vue')
const addPersonnel = () => import('../components/addPersonnel.vue')
const addPier = () => import('../components/addPier.vue')
const addPort = () => import('../components/addPort.vue')
const addPortStorageYard = () => import('../components/addPortStorageYard.vue')
const addRawMaterialManufacturer = () =>
  import('../components/addRawMaterialManufacturer.vue')
const addRawWarehouse = () => import('../components/addRawWarehouse.vue')
const addRmsShipper = () => import('../components/addRmsShipper.vue')
const addSupplier = () => import('../components/addSupplier.vue')
const addTruckCalculate = () => import('../components/addTruckCalculate.vue')
const capacity = () => import('../components/capacity.vue')
const capacityType = () => import('../components/capacityType.vue')
const carDriver = () => import('../components/carDriver.vue')
const carrier = () => import('../components/carrier.vue')
const addOtherCapacity = () => import('../components/addOtherCapacity.vue')

const editCapacity = () => import('../components/editCapacity.vue')
const editCarDriver = () => import('../components/editCarDriver.vue')
const editCarrier = () => import('../components/editCarrier.vue')
const editConsignee = () => import('../components/editConsignee.vue')
const editGatepost = () => import('../components/editGatepost.vue')
const editMaterial = () => import('../components/editMaterial.vue')
const editOilPrice = () => import('../components/editOilPrice.vue')
const editPersonnel = () => import('../components/editPersonnel.vue')
const editPier = () => import('../components/editPier.vue')
const editPortStorageYard = () =>
  import('../components/editPortStorageYard.vue')
const editRawMaterialManufacturer = () =>
  import('../components/editRawMaterialManufacturer.vue')
const editRawWarehouse = () => import('../components/editRawWarehouse.vue')
const editRmsShipper = () => import('../components/editRmsShipper.vue')
const editSupplier = () => import('../components/editSupplier.vue')
const editTruckCalculate = () => import('../components/editTruckCalculate.vue')
const gatepost = () => import('../components/gatepost.vue')
const material = () => import('../components/material.vue')
const oilPrice = () => import('../components/oilPrice.vue')
const personnel = () => import('../components/personnel.vue')
const pier = () => import('../components/pier.vue')
const port = () => import('../components/port.vue')
const portStorageYard = () => import('../components/portStorageYard.vue')
const rawMaterialManufacturer = () =>
  import('../components/rawMaterialManufacturer.vue')
const rawWarehouse = () => import('../components/rawWarehouse.vue')
const rmsShipper = () => import('../components/rmsShipper.vue')
const supplier = () => import('../components/supplier.vue')
const transitRoute = () => import('../components/transitRoute.vue')
const showCarrier = () => import('../components/showCarrier.vue')
const showCapacity = () => import('../components/showCapacity.vue')
const transitRouteAdd = () => import('../components/transitRouteAdd.vue')
const truckCalculate = () => import('../components/truckCalculate.vue')
const consignee = () => import('../components/consignee.vue')
const inwardContractMaterial = () =>
  import('../components/inwardContractMaterial.vue')
const addInwardContractMaterial = () =>
  import('../components/addInwardContractMaterial.vue')
const editInwardContractMaterial = () =>
  import('../components/editInwardContractMaterial.vue')
const editInwardMaterial = () => import('../components/editInwardMaterial.vue')
const cargoDep = () => import('../components/cargoDep.vue')
const addCargoDep = () => import('../components/addCargoDep.vue')
const updateCargoDep = () => import('../components/updateCargoDep.vue')
const contractPrice = () => import('../components/contractPrice.vue')
const addContractPrice = () => import('../components/addContractPrice.vue')
const editContractPrice = () => import('../components/editContractPrice.vue')
const rmsMaterialSingleWeight = () =>
  import('../components/rmsMaterialSingleWeight.vue')
const rmsDirectlySentCity = () =>
  import('../components/rmsDirectlySentCity.vue')
Vue.use(Router)
const constantRouterMap = [
  {
    path: '/',
    name: 'main',
    meta: { title: '首页', code: 'xtpzgl' },
    component: main,
    redirect: { name: 'addCapacity' },
    children: [
      {
        path: 'addCapacity',
        name: 'addCapacity',
        meta: { code: 'xtpzgl-jggl' },
        component: addCapacity
      },
      {
        path: 'addCapacityType',
        name: 'addCapacityType',
        meta: { code: 'xtpzgl-jggl' },
        component: addCapacityType
      },
      {
        path: 'addTransRange',
        name: 'addTransRange',
        meta: { code: 'xtpzgl-jggl' },
        component: addTransRange
      },
      {
        path: 'transRange',
        name: 'transRange',
        meta: { code: 'xtpzgl-jggl' },
        component: transRange
      },
      {
        path: 'addMaterialCoke',
        name: 'addMaterialCoke',
        meta: { code: 'xtpzgl-jggl' },
        component: addMaterialCoke
      },
      {
        path: 'materialCoke',
        name: 'materialCoke',
        meta: { code: 'xtpzgl-jggl' },
        component: materialCoke
      },
      {
        path: 'addReceivingCompany',
        name: 'addReceivingCompany',
        meta: { code: 'xtpzgl-jggl' },
        component: addReceivingCompany
      },
      {
        path: 'receivingCompany',
        name: 'receivingCompany',
        meta: { code: 'xtpzgl-jggl' },
        component: receivingCompany
      },
      {
        path: 'addCarDriver',
        name: 'addCarDriver',
        meta: { code: 'xtpzgl-yhgl' },
        component: addCarDriver
      },
      {
        path: 'addCarrier',
        name: 'addCarrier',
        meta: { code: 'xtpzgl-yhgl' },
        component: addCarrier
      },
      {
        path: 'addConsignee',
        name: 'addConsignee',
        meta: { code: 'xtpzgl-yhgl' },
        component: addConsignee
      },
      {
        path: 'addGatepost',
        name: 'addGatepost',
        meta: { code: 'xtpzgl-yhgl' },
        component: addGatepost
      },
      {
        path: 'addMaterial',
        name: 'addMaterial',
        meta: { code: 'xtpzgl-yhgl' },
        component: addMaterial
      },
      {
        path: 'addOilPrice',
        name: 'addOilPrice',
        meta: { code: 'xtpzgl-yhgl' },
        component: addOilPrice
      },
      {
        path: 'addPersonnel',
        name: 'addPersonnel',
        meta: { code: 'xtpzgl-yhgl' },
        component: addPersonnel
      },
      {
        path: 'addPier',
        name: 'addPier',
        meta: { code: 'xtpzgl-yhgl' },
        component: addPier
      },
      {
        path: 'addPort',
        name: 'addPort',
        meta: { code: 'xtpzgl-yhgl' },
        component: addPort
      },
      {
        path: 'addPortStorageYard',
        name: 'addPortStorageYard',
        meta: { code: 'xtpzgl-yhgl' },
        component: addPortStorageYard
      },
      {
        path: 'addRawMaterialManufacturer',
        name: 'addRawMaterialManufacturer',
        meta: { code: 'xtpzgl-yhgl' },
        component: addRawMaterialManufacturer
      },
      {
        path: 'addRawWarehouse',
        name: 'addRawWarehouse',
        meta: { code: 'xtpzgl-yhgl' },
        component: addRawWarehouse
      },
      {
        path: 'addRmsShipper',
        name: 'addRmsShipper',
        meta: { code: 'xtpzgl-yhgl' },
        component: addRmsShipper
      },
      {
        path: 'addSupplier',
        name: 'addSupplier',
        meta: { code: 'xtpzgl-yhgl' },
        component: addSupplier
      },
      {
        path: 'addTruckCalculate',
        name: 'addTruckCalculate',
        meta: { code: 'xtpzgl-yhgl' },
        component: addTruckCalculate
      },
      {
        path: 'addOtherCapacity',
        name: 'addOtherCapacity',
        meta: { code: 'xtpzgl-yhgl' },
        component: addOtherCapacity
      },
      {
        path: 'capacity',
        name: 'capacity',
        meta: { code: 'xtpzgl-yhgl' },
        component: capacity
      },
      {
        path: 'capacityType',
        name: 'capacityType',
        meta: { code: 'xtpzgl-yhgl' },
        component: capacityType
      },
      {
        path: 'carDriver',
        name: 'carDriver',
        meta: { code: 'xtpzgl-yhgl' },
        component: carDriver
      },
      {
        path: 'carrier',
        name: 'carrier',
        meta: { code: 'xtpzgl-yhgl' },
        component: carrier
      },
      {
        path: 'editCapacity/:capacityCarrierId',
        name: 'editCapacity',
        meta: { code: 'xtpzgl-yhgl' },
        component: editCapacity
      },
      {
        path: 'editCarDriver/:driverId',
        name: 'editCarDriver',
        meta: { code: 'xtpzgl-yhgl' },
        component: editCarDriver
      },
      {
        path: 'editCarrier/:carrierId',
        name: 'editCarrier',
        meta: { code: 'xtpzgl-yhgl' },
        component: editCarrier
      },
      {
        path: 'showCarrier/:carrierId',
        name: 'showCarrier',
        meta: { code: 'xtpzgl-yhgl' },
        component: showCarrier
      },
      {
        path: 'showCapacity/:capacityId',
        name: 'showCapacity',
        meta: { code: 'xtpzgl-yhgl' },
        component: showCapacity
      },
      {
        path: 'editConsignee/:consigneeId',
        name: 'editConsignee',
        meta: { code: 'xtpzgl-yhgl' },
        component: editConsignee
      },
      {
        path: 'editGatepost/:gatepostId',
        name: 'editGatepost',
        meta: { code: 'xtpzgl-yhgl' },
        component: editGatepost
      },
      {
        path: 'editMaterial/:materialId',
        name: 'editMaterial',
        meta: { code: 'xtpzgl-yhgl' },
        component: editMaterial
      },
      {
        path: 'editOilPrice/:priceId',
        name: 'editOilPrice',
        meta: { code: 'xtpzgl-yhgl' },
        component: editOilPrice
      },
      {
        path: 'editPersonnel/:personnelId',
        name: 'editPersonnel',
        meta: { code: 'xtpzgl-yhgl' },
        component: editPersonnel
      },
      {
        path: 'editPier',
        name: 'editPier',
        meta: { code: 'xtpzgl-yhgl' },
        component: editPier
      },
      {
        path: 'editPortStorageYard',
        name: 'editPortStorageYard',
        meta: { code: 'xtpzgl-yhgl' },
        component: editPortStorageYard
      },
      {
        path: 'editRawMaterialManufacturer',
        name: 'editRawMaterialManufacturer',
        meta: { code: 'xtpzgl-yhgl' },
        component: editRawMaterialManufacturer
      },
      {
        path: 'editRawWarehouse/:warehouseId',
        name: 'editRawWarehouse',
        meta: { code: 'xtpzgl-yhgl' },
        component: editRawWarehouse
      },
      {
        path: 'editRmsShipper/:shipperId',
        name: 'editRmsShipper',
        meta: { code: 'xtpzgl-yhgl' },
        component: editRmsShipper
      },
      {
        path: 'editSupplier/:supplierId',
        name: 'editSupplier',
        meta: { code: 'xtpzgl-yhgl' },
        component: editSupplier
      },
      {
        path: 'editTruckCalculate/:truckCalculateId',
        name: 'editTruckCalculate',
        meta: { code: 'xtpzgl-yhgl' },
        component: editTruckCalculate
      },
      {
        path: 'gatepost',
        name: 'gatepost',
        meta: { code: 'xtpzgl-yhgl' },
        component: gatepost
      },
      {
        path: 'material',
        name: 'material',
        meta: { code: 'xtpzgl-yhgl' },
        component: material
      },
      {
        path: 'oilPrice',
        name: 'oilPrice',
        meta: { code: 'xtpzgl-yhgl' },
        component: oilPrice
      },
      {
        path: 'personnel',
        name: 'personnel',
        meta: { code: 'xtpzgl-yhgl' },
        component: personnel
      },
      {
        path: 'pier',
        name: 'pier',
        meta: { code: 'xtpzgl-yhgl' },
        component: pier
      },
      {
        path: 'port',
        name: 'port',
        meta: { code: 'xtpzgl-yhgl' },
        component: port
      },
      {
        path: 'portStorageYard',
        name: 'portStorageYard',
        meta: { code: 'xtpzgl-yhgl' },
        component: portStorageYard
      },
      {
        path: 'rawMaterialManufacturer',
        name: 'rawMaterialManufacturer',
        meta: { code: 'xtpzgl-yhgl' },
        component: rawMaterialManufacturer
      },
      {
        path: 'rawWarehouse',
        name: 'rawWarehouse',
        meta: { code: 'xtpzgl-yhgl' },
        component: rawWarehouse
      },
      {
        path: 'rmsShipper',
        name: 'rmsShipper',
        meta: { code: 'xtpzgl-yhgl' },
        component: rmsShipper
      },
      {
        path: 'supplier',
        name: 'supplier',
        meta: { code: 'xtpzgl-yhgl' },
        component: supplier
      },
      {
        path: 'transitRoute',
        name: 'transitRoute',
        meta: { code: 'xtpzgl-yhgl' },
        component: transitRoute
      },
      {
        path: 'transitRouteAdd/:addup',
        name: 'transitRouteAdd',
        meta: { code: 'xtpzgl-yhgl' },
        component: transitRouteAdd
      },
      {
        path: 'truckCalculate',
        name: 'truckCalculate',
        meta: { code: 'xtpzgl-yhgl' },
        component: truckCalculate
      },
      {
        path: 'consignee',
        name: 'consignee',
        meta: { code: 'xtpzgl-yhgl' },
        component: consignee
      },
      {
        path: 'inwardContractMaterial',
        name: 'inwardContractMaterial',
        meta: { code: 'xtpzgl-yhgl' },
        component: inwardContractMaterial
      },
      {
        path: 'addInwardContractMaterial',
        name: 'addInwardContractMaterial',
        meta: { code: 'xtpzgl-yhgl' },
        component: addInwardContractMaterial
      },
      {
        path: 'editInwardContractMaterial',
        name: 'editInwardContractMaterial',
        meta: { code: 'xtpzgl-yhgl' },
        component: editInwardContractMaterial
      },
      {
        path: 'editInwardMaterial/:materialTypeId',
        name: 'editInwardMaterial',
        meta: { code: 'xtpzgl-yhgl' },
        component: editInwardMaterial
      },
      {
        path: 'cargoDep',
        name: 'cargoDep',
        meta: { code: 'xtpzgl-yhgl' },
        component: cargoDep
      },
      {
        path: 'addCargoDep',
        name: 'addCargoDep',
        meta: { code: 'xtpzgl-yhgl' },
        component: addCargoDep
      },
      {
        path: 'updateCargoDep/:cargoCarrierId',
        name: 'updateCargoDep',
        meta: { code: 'xtpzgl-yhgl' },
        component: updateCargoDep
      },
      {
        path: 'contractPrice',
        name: 'contractPrice',
        meta: { code: 'xtpzgl-yhgl' },
        component: contractPrice
      },
      {
        path: 'addContractPrice',
        name: 'addContractPrice',
        meta: { code: 'xtpzgl-yhgl' },
        component: addContractPrice
      },
      {
        path: 'editContractPrice/:resultId',
        name: 'editContractPrice',
        meta: { code: 'xtpzgl-yhgl' },
        component: editContractPrice
      },
      {
        path: 'rmsMaterialSingleWeight',
        name: 'rmsMaterialSingleWeight',
        meta: { code: 'xtpzgl-yhgl' },
        component: rmsMaterialSingleWeight
      },
      {
        path: 'rmsDirectlySentCity',
        name: 'rmsDirectlySentCity',
        meta: { code: 'xtpzgl-yhgl' },
        component: rmsDirectlySentCity
      }
    ]
  }
]

const router = new Router({
  routes: constantRouterMap
})
//  before
routerBefore(router, constantRouterMap)

export default router
//  constantRouterMap
export const routes = constantRouterMap
