import { RouteRecordRaw } from 'vue-router'

export const staticRouter: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    name: 'Index',
    component: () => import('@/views/Index.vue'),
    // redirect: '/home',
    meta: {
      title: '起始页'
    },
    children: [
      {
        path: '/list',
        name: 'List',
        component: () => import('@/views/storehouse/List.vue'),
        meta: {
          title: '仓库列表'
        }
      },
      {
        path: '/classify',
        name: 'Classify',
        component: () => import('@/views/storehouse/Classify.vue'),
        meta: {
          title: '产品分类'
        }
      },
      {
        path: '/productionList',
        name: 'ProductionList',
        component: () => import('@/views/storehouse/ProductionList.vue'),
        meta: {
          title: '产品列表'
        }
      },
      {
        path: '/ioTNetworkCard',
        name: 'IoTNetworkCard',
        component: () => import('@/views/storehouse/IoTNetworkCard.vue'),
        meta: {
          title: '物联网卡'
        }
      },
      {
        path: '/saleMange',
        name: 'SaleMange',
        component: () => import('@/views/storehouse/sales/index.vue'),
        // redirect: '/contract',
        meta: {
          routerView: true,
          title: '销售管理'
        },
        children: [
          {
            path: '/contract',
            name: 'Contract',
            component: () => import('@/views/storehouse/sales/Contract.vue'),
            meta: {
              title: '合同管理'
            }
          },
          {
            path: '/contractDetail/:id/:type',
            name: 'ContractDetail',
            component: () => import('@/views/storehouse/sales/ContractDetail.vue'),
            meta: {
              title: '合同详情'
            }
          },
          {
            path: '/contractSale',
            name: 'ContractSale',
            component: () => import('@/views/storehouse/sales/ContractSale.vue'),
            meta: {
              title: '合同详情(销售)'
            }
          }
        ]
      },
      {
        path: '/inventoryMange',
        name: 'InventoryMange',
        component: () => import('@/views/storehouse/inventory/index.vue'),
        // redirect: '/contract',
        meta: {
          routerView: true,
          title: '库存管理'
        },
        children: [
          {
            path: '/device',
            name: 'Device',
            component: () => import('@/views/storehouse/inventory/Device.vue'),
            meta: {
              title: '设备列表'
            }
          },
          {
            path: '/inStorage',
            name: 'InStorage',
            component: () => import('@/views/storehouse/inventory/InStorage.vue'),
            meta: {
              title: '入库管理'
            }
          },
          {
            path: '/inStorageDetail/:id',
            name: 'InStorageDetail',
            component: () => import('@/views/storehouse/inventory/InStorageDetail.vue'),
            meta: {
              title: '入库详情'
            }
          },
          {
            path: '/outStock',
            name: 'OutStock',
            component: () => import('@/views/storehouse/outStock/OutStock.vue'),
            meta: {
              title: '出库管理'
            }
          },
          {
            path: '/receiveOutStock',
            name: 'ReceiveOutStock',
            component: () => import('@/views/storehouse/outStock/ReceiveOutStock.vue'),
            meta: {
              title: '领料出库'
            }
          },
          {
            path: '/saleOutStock',
            name: 'SaleOutStock',
            component: () => import('@/views/storehouse/outStock/SaleOutStock.vue'),
            meta: {
              title: '销售出库'
            }
          },
          {
            path: '/outStockDetail/:number',
            name: 'OutStockDetail',
            component: () => import('@/views/storehouse/outStock/OutStockDetail.vue'),
            meta: {
              title: '出库详情'
            }
          },
          {
            path: '/inventoryStatistics',
            name: 'InventoryStatistics',
            component: () => import('@/views/storehouse/InventoryStatistics.vue'),
            meta: {
              title: '库存统计'
            }
          }
        ]
      },
      // {
      //   path: '/contract',
      //   name: 'Contract',
      //   component: () => import('@/views/storehouse/sales/Contract.vue'),
      //   meta: {
      //     title: '合同管理'
      //   }
      // },
      // {
      //   path: '/contract-detail/:id',
      //   name: 'ContractDetail',
      //   component: () => import('@/views/storehouse/sales/ContractDetail.vue'),
      //   meta: {
      //     title: '合同详情'
      //   }
      // },
      {
        path: '/user',
        name: 'User',
        component: () => import('@/views/home/User.vue'),
        meta: {
          title: '个人中心'
        }
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login.vue'),
    meta: {
      title: '登录'
    }
  }
]

export const errorRouter = [
  {
    path: '/404',
    name: '404',
    component: () => import('@/components/ErrorMessage/404.vue'),
    meta: {
      title: '404页面'
    }
  }
]

/**
 * notFoundRouter(找不到路由)
 */
export const notFoundRouter = {
  path: '/:pathMatch(.*)*',
  name: 'notFound',
  redirect: { name: '404' }
}
