import Layout from '@/layout'

const HomeRoutes = {
  path: '/dataQuery',
  component: Layout,
  name: 'dataQuery',
  redirect: '/dataQuery/flightQuery',
  //using el svg icon, the elSvgIcon first when at the same time using elSvgIcon and icon
  meta: {
    title: '数据查询',
    elSvgIcon: 'Search',
    breadcrumb: false,
    roles: ['data_query_menu'],
  },
  children: [
    {
      path: '/dataQuery/flightQuery',
      name: 'FlightQuery',
      meta: {
        title: '航班查询',
        roles: ['flight_query_page'],
      },
      component: {
        render: () => h(resolveComponent('router-view')),
      },
      children: [
        {
          path: '',
          name: 'FlightQueryView',
          meta: { title: '航班查询', breadcrumb: false },
          component: () => import('@/views/dataQuery/flight/index.vue'),
        },
        {
          path: '/dataQuery/flightQuery/:viewName',
          name: 'FlightQueryFlightView',
          meta: { title: '航班视图' },
          props: true,
          component: () => import('@/views/dataQuery/flight/FlightView.vue'),
          hidden: true,
        },
      ],
    },
    {
      path: '/dataQuery/waybillQuery',
      name: 'WaybillQuery',
      meta: {
        title: '运单查询',
        roles: ['waybill_query_page'],
      },
      component: {
        render: () => h(resolveComponent('router-view')),
      },
      children: [
        {
          path: '',
          name: 'WaybillQueryView',
          meta: { title: '运单查询', breadcrumb: false },
          component: () => import('@/views/dataQuery/waybill/index.vue'),
        },
        {
          path: '/dataQuery/waybillQuery/:viewName',
          name: 'WaybillQueryWaybillView',
          meta: { title: '运单视图' },
          props: true,
          component: () => import('@/views/dataQuery/waybill/WaybillView.vue'),
          hidden: true,
        },
      ],
    },
    {
      path: '/dataQuery/freightQuery',
      name: 'FreightQuery',
      meta: { title: '货物查询', roles: ['freight_inquiry_page'] },
      component: () => import('@/views/dataQuery/freight/index.vue'),
    },
  ],
}

export default [HomeRoutes]
