import Layout from '@/layout'

const departureRoutes = {
  path: '/departure',
  name: 'departure',
  component: Layout,
  meta: { roles: ['departure_menu'] },
  children: [
    {
      path: '/departure',
      component: () => import('@/views/baggageManagement'),
      meta: {
        title: '离港管理',
        imgstyle: 'ic_list_nav_leave_default.png',
        imgstyleup: 'ic_list_nav_leave_check.png'
      },
      children: [
        {
          path: '/departure',
          name: 'DepartureNav',
          component: () => import('@/views/baggageManagement'),
          meta: {
            title: '离港视图',
            // title: "行李视图",
            roles: ['departure_page'],
            keepAlive: true
          },
          children: [
            {
              path: '/departure',
              name: 'DepartureTerminalView',
              component: () => import('@/views/baggageManagement/components/departure'),
              meta: { keepAlive: true }
            },
            {
              path: '/departure/flightView',
              name: 'DepartureFlightNav',
              component: () => import('@/views/baggageManagement'),
              meta: { title: '航班视图', keepAlive: true },
              children: [
                {
                  path: '/departure/flightView',
                  name: 'DepartureFlightView',
                  component: () => import('@/views/baggageManagement/components/departure/flight'),
                  meta: { keepAlive: true }
                },
                {
                  path: '/departure/baggageView',
                  name: 'DepartureBaggageView',
                  component: () => import('@/views/baggageManagement/components/departure/baggage'),
                  meta: { title: '行李视图', keepAlive: true }
                },
                {
                  path: '/departure/containerView',
                  name: 'DepartureContainerNav',
                  component: () => import('@/views/baggageManagement'),
                  meta: { title: '容器视图', keepAlive: true },
                  children: [
                    {
                      path: '/departure/containerView',
                      name: 'DepartureContainerView',
                      component: () => import('@/views/baggageManagement/components/departure/container'),
                      meta: { keepAlive: true }
                    },
                    {
                      path: '/departure/containerHistory',
                      name: 'DepartureContainerHistory',
                      component: () => import('@/views/baggageManagement/components/departure/containerHistory'),
                      meta: { title: '历史记录', keepAlive: true }
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

const arrivalRoutes = {
  path: '/arrival',
  name: 'arrival',
  component: Layout,
  meta: { roles: ['inbound_management'] },
  children: [
    {
      path: '/arrival',
      component: () => import('@/views/baggageManagement'),
      meta: {
        title: '进港管理',
        imgstyle: 'ic_list_nav_arrive_default.png',
        imgstyleup: 'ic_list_nav_arrive_check.png'
      },
      children: [
        {
          path: '/arrival',
          name: 'ArrivalNav',
          component: () => import('@/views/baggageManagement'),
          meta: { title: '进港视图', roles: ['inbound_search_page'], keepAlive: true },
          children: [
            {
              path: '/arrival',
              name: 'ArrivalTerminalView',
              component: () => import('@/views/baggageManagement/components/arrival'),
              meta: { keepAlive: true }
            },
            {
              path: '/arrival/flightView',
              name: 'ArrivalFlightNav',
              component: () => import('@/views/baggageManagement'),
              meta: { title: '航班视图', keepAlive: true },
              children: [
                {
                  path: '/arrival/flightView',
                  name: 'ArrivalFlightView',
                  component: () => import('@/views/baggageManagement/components/arrival/flight'),
                  meta: { keepAlive: true }
                },
                {
                  path: '/arrival/baggageView',
                  name: 'ArrivalBaggageView',
                  component: () => import('@/views/baggageManagement/components/arrival/baggage'),
                  meta: { title: '行李视图', keepAlive: true }
                },
                {
                  path: '/arrival/containerView',
                  name: 'ArrivalContainerNav',
                  component: () => import('@/views/baggageManagement'),
                  meta: { title: '容器视图', keepAlive: true },
                  children: [
                    {
                      path: '/arrival/containerView',
                      name: 'ArrivalContainerView',
                      component: () => import('@/views/baggageManagement/components/arrival/container'),
                      meta: { keepAlive: true }
                    },
                    {
                      path: '/arrival/containerHistory',
                      name: 'ArrivalContainerHistory',
                      component: () => import('@/views/baggageManagement/components/arrival/containerHistory'),
                      meta: { title: '容器历史', keepAlive: true }
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

const transferRoutes = {
  path: '/transfer',
  component: Layout,
  meta: { roles: ['ti_showTransit'] },
  children: [
    {
      path: '/transfer',
      component: () => import('@/views/baggageManagement'),
      meta: {
        title: '中转管理',
        imgstyle: 'ic_list_nav_transit_default.png',
        imgstyleup: 'ic_list_nav_transit_check.png'
      },
      redirect: '/transfer/arrival',
      children: [
        {
          path: '/transfer/arrival',
          name: 'TransferArrivalNav',
          component: () => import('@/views/baggageManagement'),
          meta: { title: '中转进港', roles: ['transit_inbound_page'], keepAlive: true },
          children: [
            {
              path: '/transfer/arrival',
              name: 'TransferArrivalTerminalView',
              component: () => import('@/views/baggageManagement/components/transferArrival'),
              meta: { keepAlive: true }
            },
            {
              path: '/transfer/arrival/flightView',
              name: 'TransferArrivalFlightNav',
              component: () => import('@/views/baggageManagement'),
              meta: { title: '航班视图', keepAlive: true },
              children: [
                {
                  path: '/transfer/arrival/flightView',
                  name: 'TransferArrivalFlightView',
                  component: () => import('@/views/baggageManagement/components/transferArrival/flight'),
                  meta: { keepAlive: true }
                },
                {
                  path: '/transfer/arrival/baggageView',
                  name: 'TransferArrivalBaggageView',
                  component: () => import('@/views/baggageManagement/components/transferArrival/baggage'),
                  meta: { title: '行李视图', keepAlive: true }
                },
                {
                  path: '/transfer/arrival/containerView',
                  name: 'TransferArrivalContainerNav',
                  component: () => import('@/views/baggageManagement'),
                  meta: { title: '容器视图', keepAlive: true },
                  children: [
                    {
                      path: '/transfer/arrival/containerView',
                      name: 'TransferArrivalContainerView',
                      component: () => import('@/views/baggageManagement/components/arrival/container'),
                      meta: { keepAlive: true }
                    },
                    {
                      path: '/transfer/arrival/containerHistory',
                      name: 'TransferArrivalContainerHistory',
                      component: () => import('@/views/baggageManagement/components/transferArrival/containerHistory'),
                      meta: { title: '容器历史', keepAlive: true }
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          path: '/transfer/departure',
          name: 'TransferDepartureNav',
          component: () => import('@/views/baggageManagement'),
          meta: { title: '中转离港', roles: ['transit_departure_page'], keepAlive: true },
          children: [
            {
              path: '/transfer/departure',
              name: 'TransferDepartureTerminalView',
              component: () => import('@/views/baggageManagement/components/transferDeparture'),
              meta: { keepAlive: true }
            },
            {
              path: '/transfer/departure/flightView',
              name: 'TransferDepartureFlightNav',
              component: () => import('@/views/baggageManagement'),
              meta: { title: '航班视图', keepAlive: true },
              children: [
                {
                  path: '/transfer/departure/flightView',
                  name: 'TransferDepartureFlightView',
                  component: () => import('@/views/baggageManagement/components/transferDeparture/flight'),
                  meta: { keepAlive: true }
                },
                {
                  path: '/transfer/departure/baggageView',
                  name: 'TransferDepartureBaggageView',
                  component: () => import('@/views/baggageManagement/components/transferDeparture/baggage'),
                  meta: { title: '行李视图', keepAlive: true }
                },
                {
                  path: '/transfer/departure/containerView',
                  name: 'TransferDepartureContainerNav',
                  component: () => import('@/views/baggageManagement'),
                  meta: { title: '容器视图', keepAlive: true },
                  children: [
                    {
                      path: '/transfer/departure/containerView',
                      name: 'TransferDepartureContainerView',
                      component: () => import('@/views/baggageManagement/components/transferDeparture/container'),
                      meta: { keepAlive: true }
                    },
                    {
                      path: '/transfer/departure/containerHistory',
                      name: 'TransferDepartureContainerHistory',
                      component: () =>
                        import('@/views/baggageManagement/components/transferDeparture/containerHistory'),
                      meta: { title: '容器历史', keepAlive: true }
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

const flightViewRoutes = {
  path: '/flightView',
  name: 'flightView',
  component: Layout,
  hidden: true,
  children: [
    {
      path: '/flightView',
      name: 'ArrivalNav',
      component: () => import('@/views/flightViewManagement'),
      children: [
        {
          path: '/flightView',
          name: 'ArrivalFlightNav',
          component: () => import('@/views/flightViewManagement'),
          meta: { title: '航班视图', keepAlive: true },
          children: [
            {
              path: '/flightView',
              name: 'ArrivalFlightView',
              component: () => import('@/views/flightViewManagement/components/arrival/flight'),
              meta: { keepAlive: true }
            },
            {
              path: '/flightView/baggageView',
              name: 'ArrivalBaggageView',
              component: () => import('@/views/flightViewManagement/components/arrival/baggage'),
              meta: { title: '行李视图' }
            },
            {
              path: '/flightView/containerView',
              name: 'ArrivalContainerNav',
              component: () => import('@/views/flightViewManagement'),
              meta: { title: '容器视图', keepAlive: true },
              children: [
                {
                  path: '/flightView/containerView',
                  name: 'ArrivalContainerView',
                  component: () => import('@/views/flightViewManagement/components/arrival/container'),
                  meta: { keepAlive: true }
                },
                {
                  path: '/flightView/containerHistory',
                  name: 'ArrivalContainerHistory',
                  component: () => import('@/views/flightViewManagement/components/arrival/containerHistory'),
                  meta: { title: '容器历史', keepAlive: true }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

const newQuerys = {
  path: '/newQuery',
  name: 'newQuery',
  component: Layout,
  children: [
    {
      path: '/newQuery',
      component: () => import('@/views/newQuery'),
      meta: {
        title: '高级查询',
      },
    }
  ]
}

export default [flightViewRoutes, departureRoutes, arrivalRoutes, transferRoutes]
