/*
 * @Author: Badguy
 * @Date: 2022-04-25 16:01:34
 * @LastEditTime: 2022-05-06 11:09:32
 * @LastEditors: your name
 * @Description: 账号管理
 * have a nice day!
 */

import Layout from '@/layout'

// 权限管理
const authorityRoutes = {
  path: '/authority',
  component: Layout,
  meta: { roles: ['authority_menu'] },
  children: [
    {
      path: '/authority',
      component: () => import('@/views/authorityManagement/index'),
      meta: {
        title: '权限管理',
        icon: 'authority',
        imgstyle: 'ic_list_nav_permissions_default.png',
        imgstyleup: 'ic_list_nav_permissions_check.png'
      },
      children: [
        {
          path: '/',
          name: 'AuthorityHome',
          component: {
            render (c) {
              return c('router-view')
            }
          },
          redirect: '/',
          meta: { title: '权限项管理', isPage: 'authority_page' },
          children: [
            {
              path: '/',
              component: () => import('@/views/authorityManagement/components/authorityHome')
            },
            {
              path: 'appAdd',
              name: 'AuthorityAppAdd',
              component: () => import('@/views/authorityManagement/components/authorityAppAdd'),
              meta: { title: '新增应用' }
            },
            {
              path: 'appEdit',
              name: 'AuthorityAppEdit',
              component: () => import('@/views/authorityManagement/components/authorityAppEdit'),
              meta: { title: '编辑应用' }
            },
            {
              path: 'addPower',
              name: 'AuthorityPowerAdd',
              component: () => import('@/views/authorityManagement/components/authorityPowerAdd'),
              meta: { title: '新增权限项' }
            },
            {
              path: 'editPower',
              name: 'AuthorityPowerEdit',
              component: () => import('@/views/authorityManagement/components/authorityPowerEdit'),
              meta: { title: '编辑权限项' }
            }
          ]
        }
      ]
    }
  ]
}

// 角色管理
const roleRoutes = {
  path: '/role',
  component: Layout,
  meta: { roles: ['role_menu'] },
  children: [
    {
      path: '/role',
      component: () => import('@/views/authorityManagement/components/authorityRole'),
      meta: {
        title: '角色管理',
        icon: 'role',
        imgstyle: 'ic_list_nav_character_default.png',
        imgstyleup: 'ic_list_nav_character_check.png'
      },
      children: [
        {
          path: '/',
          name: 'AuthorityRoleHome',
          component: {
            render (c) {
              return c('router-view')
            }
          },
          redirect: '/',
          meta: { title: '角色管理', isPage: 'role_page' },
          children: [
            {
              path: '/',
              component: () => import('@/views/authorityManagement/components/authorityRoleHome')
            },
            {
              path: 'addRole',
              name: 'AuthorityRoleAdd',
              component: () => import('@/views/authorityManagement/components/authorityRoleAdd'),
              meta: { title: '新增角色' }
            },
            {
              path: 'editRole',
              name: 'AuthorityRoleEdit',
              component: () => import('@/views/authorityManagement/components/authorityRoleEdit'),
              meta: { title: '账号权限' }
            }
          ]
        }
      ]
    }
  ]
}

// 账号管理
const accountRoutes = {
  path: '/account',
  component: Layout,
  meta: { roles: ['account_menu'] },
  children: [
    {
      path: '/account',
      name: 'accountManagement',
      component: () => import('@/views/accountManagement'),
      meta: {
        title: '账号管理',
        icon: 'account',
        imgstyle: 'ic_list_nav_account_default.png',
        imgstyleup: 'ic_list_nav_account_check.png'
      },
      children: [
        {
          path: '/account',
          name: 'accountHome',
          component: {
            render (c) {
              return c('router-view')
            }
          },
          redirect: '/account',
          meta: {
            title: '账号管理',
            roles: ['account_page']
          },
          children: [
            {
              path: '/account',
              component: () => import('@/views/accountManagement/components/accountHome')
            },
            {
              path: 'accountAdd',
              name: 'accountAdd',
              component: () => import('@/views/accountManagement/components/accountEdit'),
              meta: {
                title: '新增账号'
              }
            },
            {
              path: 'accountEdit',
              name: 'accountEdit',
              component: () => import('@/views/accountManagement/components/accountEdit'),
              meta: {
                title: '编辑账号',
                doesAccountExist: true
              }
            },
            {
              path: 'accountAuth',
              name: 'accountAuth',
              component: () => import('@/views/accountManagement/components/accountAuth'),
              meta: {
                title: '账号权限'
              }
            }
          ]
        }
      ]
    }
  ]
}

// 高级查询
const advanceRoutes = {
  path: '/',
  redirect: '/advance',
  component: Layout,
  children: [
    {
      path: '/advance',
      component: () => import('@/views/advancedQuery/index.vue'),
      meta: {
        title: '高级查询',
        icon: 'dataParser',
        imgstyle: 'ic_list_nav_search_default.png',
        imgstyleup: 'ic_list_nav_search_check.png'
      },
      children: [
        {
          path: '/',
          name: 'advanceHome',
          component: {
            render (c) {
              return c('router-view')
            }
          },
          redirect: '/',
          meta: { title: '高级查询', isPage: 'advance_page' },
          children: [
            {
              path: '/',
              component: () => import('@/views/advancedQuery/views/advancedHome.vue')
            },
            {
              path: 'flightView',
              name: 'advancedFlight',
              component: () => import('@/views/advancedQuery/views/advancedFlight.vue'),
              meta: { title: '航班视图' }
            },
            {
              path: 'baggageView',
              name: 'advancedBag',
              component: () => import('@/views/advancedQuery/views/advancedBag.vue'),
              meta: { title: '行李视图' }
            }
          ]
        }
      ]
    }
  ]
}

export default [authorityRoutes, roleRoutes, accountRoutes, advanceRoutes]
