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

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/* Router Modules */
// import componentsRouter from './modules/components'

// import nestedRouter from './modules/nested'

// import warehouseBasicInformation from '@/views/systemManagement/organizationalStructureManagement/warehouseBasicInformation';

import daiBanTabs from '@/views/home/daiBan/daiBanTabs'

import organizationalStructureTabs from '@/views/systemManagement/organizationalStructureManagement/organizationalStructureTabs'

import facilitiesTabs from '@/views/facilitiesEquipment/facilitiesManagement/facilitiesTabs'
import equipementTabs from '@/views/facilitiesEquipment/equipmentManagement/equipementTabs'


import userTabs from '@/views/systemManagement/userManagement/userTabs'
import safeTabs from '@/views/safeProduction/safeTabs'
import reservesTabs from '@/views/reservesManagement/grainCheck/reservesTabs'
import reservesTab from '@/views/systemManagement/notice/reservesTab'
/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    noCache: true                if set true, the page will no be cached(default is false)
    affix: true                  if set true, the tag will affix in the tags-view
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  // {
  //   path: '/redirect',
  //   component: Layout,
  //   hidden: true,
  // children: [
  //     {
  //       path: '/redirect/:path(.*)',
  //       component: () => import('@/views/redirect/index')
  //     }
  //   ]
  // },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  // {
  //   path: '/auth-redirect',
  //   component: () => import('@/views/login/auth-redirect'),
  //   hidden: true
  // },

  {
    path: '/dashboard',
    hidden: true,
    component: () => import('@/views/home/branchOffice'),
  },

  // 首页
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: () => import('@/views/home/index'),
        name: 'Home',
        hidden: true,
        meta: { title: '首页', icon: 'dashboard', affix: true },
      },
      {
        path: 'inform',
        component: () => import('@/views/home/inform/index'),
        name: 'inform',
        redirect: 'inform/unreadinform',
        hidden: true,
        meta: { title: '通知', icon: 'dashboard', affix: true },
        children: [
          {
            path: 'unreadinform',
            component: () => import('@/views/home/inform/unread'),
            name: 'infounread',
            hidden: true,
            meta: { title: '未读', icon: 'dashboard', affix: false },
          },
          {
            path: 'readinform',
            component: () => import('@/views/home/inform/read'),
            name: 'inforead',
            hidden: true,
            meta: { title: '已读', icon: 'dashboard', affix: false },
          },
          {
            path: 'allinform',
            component: () => import('@/views/home/inform/alllist'),
            name: 'infoalllist',
            hidden: true,
            meta: { title: '全部', icon: 'dashboard', affix: false },
          },
        ],
      },
      {
        path: 'notice',
        component: () => import('@/views/home/notice/index'),
        name: 'notice',
        hidden: true,
        meta: { title: '公告', icon: 'dashboard', affix: true },
        children: [
          {
            path: 'noticeDetail',
            component: () => import('@/views/home/notice/detail'),
            name: 'noticeDetail',
            hidden: true,
            meta: { title: '公告详情', icon: 'dashboard', affix: true }
          },
        ]
      },
      {
        path: 'daiban',
        component: daiBanTabs,
        redirect: 'daiban/initiated',
        name: 'Daiban',
        hidden: true,
        meta: { title: '待办', icon: 'dashboard', affix: true },

        children: [
          {
            path: 'initiated',
            component: () => import('@/views/home/daiBan/initiated/index'),
            name: 'Initiated',

            hidden: true,
            meta: { title: '已发起', icon: 'dashboard', affix: false },

            children:
            [

         // 已发起/详情
         {
          path: 'iniDetails',
          component: () => import('@/views/home/daiBan/initiated/iniDetails'),
          name: 'IniDetails',

          hidden: true,
          meta: { title: '详情', icon: 'dashboard', affix: false }
        },
            ]

          },


          {
            path: 'pending',
            component: () => import('@/views/home/daiBan/pending/index'),
            name: 'Pending',

            hidden: true,
            meta: { title: '待处理', icon: 'dashboard', affix: false },
            children:
            [

              // 待处理/详情
              {
                path: 'penDetails',
                component: () => import('@/views/home/daiBan/pending/penDetails'),
                name: 'PenDetails',

                hidden: true,
                meta: { title: '详情', icon: 'dashboard', affix: false }
              },
            ]
          },
          {
            path: 'processed',
            component: () => import('@/views/home/daiBan/processed/index'),
            name: 'Processed',

            hidden: true,
            meta: { title: '已处理', icon: 'dashboard', affix: false },
            children:
            [

              // 待处理/详情
              {
                path: 'proDetails',
                component: () => import('@/views/home/daiBan/processed/proDetails'),
                name: 'ProDetails',

                hidden: true,
                meta: { title: '详情', icon: 'dashboard', affix: false }
              },
            ]
          },

        ],




      },
           // 待办/详情
           {
            path: 'initiated/details',
            component: () => import('@/views/home/daiBan/initiated/details'),
            name: 'Details',

            hidden: true,
            meta: { title: '详情', icon: 'dashboard', affix: false, noCache: true }
          },





    ]
  },

  // 基本信息
  {

    path: '/basicInformation',
    component: Layout,
    // redirect: '/basicMatter',
    name: 'BasicInformation',

    meta: { title: '基本信息', icon: 'dashboard', affix: false },

    children: [
      // 基本信息/人员结构
      {
        path: 'personnelStructure',
        component: () => import('@/views/basicInformation/personnelStructure'),
        name: 'PersonnelStructure',
        hiddren: true,
        meta: { title: '人员结构', icon: 'dashboard', affix: false }

      },
      // 基本信息/政策制度
      /* {
        path: 'policySystem',
        component: () => import('@/views/basicInformation/policySystem'),
        name: 'PolicySystem',
        hiddren: true,
        meta: { title: '政策制度', icon: 'dashboard', affix: false }

      } */
    ]

  },

  // 数量质量
  {
    path: '/countQuality',
    component: Layout,
    name: 'CountQuality',
    meta: { title: '数量质量', icon: 'dashboard' },
    children: [
      {
        // 数量质量/仓房信息
        path: 'warehouseInformation',
        component: () => import('@/views/countQuality/warehouseInformation'),
        name: 'WarehouseInformation',
        meta: { title: '仓房信息', icon: 'dashboard', affix: false }
      },

      //  数量质量/入库质量
/*       {
        path: 'warehousingQuality',
        component: () => import('@/views/countQuality/warehousingQuality'),
        name: 'WarehousingQuality',
        meta: { title: '入库质量管理', icon: 'documentation', affix: false }
      }, */

      //  数量质量/库存质量
/*       {
        path: 'inventoryQuality',
        component: () => import('@/views/countQuality/inventoryQuality'),
        name: 'InventoryQuality',
        meta: { title: '库存质量管理', icon: 'documentation', affix: false }
      },

      //  数量质量 /出库质量
      {
        path: 'deliveryQuality',
        component: () => import('@/views/countQuality/deliveryQuality'),
        name: 'DeliveryQuality',
        meta: { title: '出库质量管理', icon: 'documentation', affix: false }
      } */
    ]

  },

  // 储量管理
  {
    path: '/reservesManagement',
    component: Layout,
    // redirect: '/guide/index',
    name: 'ReservesManagement',
    meta: { title: '储量管理', icon: 'dashboard', affix: false },
    //  储量管理/粮情检测
    children: [
      {
        path: 'grainCheck',
        component: reservesTabs,
        name: 'GrainCheck',
        redirect: 'grainCheck/newGrain',
        meta: { title: '粮情检测', icon: 'dashboard', affix: false },

        children: [
          //   储量管理/粮情检测/最新粮情
          {
            path: 'newGrain',
            component: () => import('@/views/reservesManagement/grainCheck/newGrain/index'),
            name: 'NewGrain',

            hidden: true,
            meta: { title: '最新粮情检查记录', icon: 'dashboard', affix: false }
          },

          //   储量管理/粮情检测/全部粮情
          {
            path: 'allGrain',
            component: () => import('@/views/reservesManagement/grainCheck/allGrain/index'),
            name: 'AllGrain',

            hidden: true,
            meta: { title: '最新粮情检查记录', icon: 'dashboard', affix: false }
          }

        ]

      },

      //  储量管理/粮情检测/新增最新粮情
      {
        path: '/grainCheck/addNewGrain',
        component: () => import('@/views/reservesManagement/grainCheck/newGrain/addNewGrain'),
        name: 'AddNewGrain',
        hidden: true,
        meta: { title: '新增最新粮情', icon: 'dashboard', affix: false, noCache: true }
      },

      //  储量管理/机械通风
      {
        path: 'mechanicalVentilation',
        component: () => import('@/views/reservesManagement/mechanicalVentilation/index'),
        name: 'MechanicalVentilation',
        meta: { title: '机械通风', icon: 'dashboard', affix: false }
      },
      //  储量管理/机械通风/新增
      {
        path: '/mechanicalVentilation/steps',
        component: () => import('@/views/reservesManagement/mechanicalVentilation/steps'),
        name: 'Step',
        hidden: true,
        meta: { title: '新增', icon: 'dashboard', affix: false, noCache: true }
      },

      //  储量管理/机械通风/已完成
      {
        path: '/mechanicalVentilation/completed',
        component: () => import('@/views/reservesManagement/mechanicalVentilation/completed'),
        name: 'Completed',
        hidden: true,
        meta: { title: '已完成', icon: 'dashboard', affix: false, noCache: true }
      },

      //  储量管理/熏蒸管理
      /* {
        path: 'fumigationManagement',
        component: () => import('@/views/reservesManagement/fumigationManagement'),
        name: 'FumigationManagement',
        meta: { title: '熏蒸管理', icon: 'dashboard', affix: false }
      } */
    ]
  },

  // 药剂管理
/*   {
    path: '/medicamentManagement',
    component: Layout,
    name: 'MedicamentManagement',
    meta: { title: '药剂管理', icon: 'dashboard', affix: false },

    children: [
      //  药剂管理/药剂采购
      {
        path: 'medicamentProcurement',
        component: () => import('@/views/medicamentManagement/medicamentProcurement'),
        name: 'MedicamentProcurement',
        meta: { title: '药剂采购', icon: 'dashboard', affix: false }
      },
      //  药剂管理/药剂保管
      {
        path: 'medicamentStorage',
        component: () => import('@/views/medicamentManagement/medicamentStorage'),
        name: 'MedicamentStorage',
        meta: { title: '药剂保管', icon: 'dashboard', affix: false }
      },

      //  药剂管理/药剂领用
      {
        path: 'medicamentApplication',
        component: () => import('@/views/medicamentManagement/medicamentApplication'),
        name: 'MedicamentApplication',
        meta: { title: '药剂领用', icon: 'dashboard', affix: false }
      }
    ]
  },

  // 设施设备
  {
    path: '/facilitiesEquipment',
    component: Layout,
    // redirect: '/guide/index',
    name: 'FacilitiesEquipment',
    meta: { title: '设施设备', icon: 'dashboard', affix: false },
    //  设施设备/设施管理
    children: [
      {
        path: 'facilitiesManagement',
        redirect: 'facilitiesManagement/newFacilities',
        component: facilitiesTabs,
        name: 'FacilitiesManagemen',
        meta: { title: '设施管理', icon: 'dashboard', affix: false },



        children: [
          {
            path: 'newFacilities',
            component: () => import('@/views/facilitiesEquipment/facilitiesManagement/newFacilities/index'),
            name: 'NewFacilities',

            hidden: true,
            meta: { title: '最新设施检查记录', icon: 'dashboard', affix: false }
          },



          {
            path: 'allFacilities',
            component: () => import('@/views/facilitiesEquipment/facilitiesManagement/allFacilities/index'),
            name: 'AllFacilities',

            hidden: true,
            meta: { title: '全部设施检查记录', icon: 'dashboard', affix: false }
          },


          {
            path: 'maintenance',
            component: () => import('@/views/facilitiesEquipment/facilitiesManagement/maintenance/index'),
            name: 'Maintenance',

            hidden: true,
            meta: { title: '设施维修改造', icon: 'dashboard', affix: false }
          },


        ]


      },


      //  设施设备/设施管理/新增
      {
        path: '/facilitiesManagement/addType',
        component: () => import('@/views/facilitiesEquipment/facilitiesManagement/newFacilities/addType'),
        name: 'AddType',
        hidden: true,
        meta: { title: '新增', icon: 'dashboard', affix: false, noCache: true }
      },


      //  设施设备/设备管理
      {
        path: 'equipmentManagement',
        redirect: 'equipmentManagement/deviceManagement',
        component: equipementTabs,
        name: 'EquipmentManagement',
        meta: { title: '设备管理', icon: 'dashboard', affix: false },
        children: [
          {
            path: 'deviceManagement',
            component: () => import('@/views/facilitiesEquipment/equipmentManagement/deviceManagement/index'),
            name: 'DeviceManagement',

            hidden: true,
            meta: { title: '设备管理', icon: 'dashboard', affix: false }
          },
          {
            path: 'deviceProfile',
            component: () => import('@/views/facilitiesEquipment/equipmentManagement/deviceProfile/index'),
            name: 'DeviceProfile',

            hidden: true,
            meta: { title: '设备管理规范', icon: 'dashboard', affix: false }
          },

          {
            path: 'deviceProcurement',
            component: () => import('@/views/facilitiesEquipment/equipmentManagement/deviceProcurement/index'),
            name: 'DeviceProcurement',

            hidden: true,
            meta: { title: '设备采购', icon: 'dashboard', affix: false }
          },
        ]
      },


    ]


  },

  // 安全生产
  {
    // path: '/safeProduction',
    // component: safeTabs,

    // redirect: 'safeProduction/newSafe',
    // name: 'SafeProduction',
    // meta: { title: '安全生产', icon: 'dashboard', affix: false },

    path: '/safeProduction',
    component: Layout,

    name: 'SafeProduction',
    meta: { title: '安全生产', icon: 'dashboard', affix: false },

    children: [
      {

        path: 'safeTabs',
        component: safeTabs,
        name: 'SafeTabs',
        redirect: '/safeProduction/newSafe',

        //   安全生产/最新安全巡查记录
        children: [
          {
            path: 'newSafe',

            component: () => import('@/views/safeProduction/newSafe'),
            name: 'NewSafe',
            hidden: true,
            meta: { title: '最新安全巡查记录', icon: 'dashboard', affix: false }

          },
          //   安全生产/全部安全巡查记录
          {
            path: 'allSafe',
            component: () => import('@/views/safeProduction/allSafe'),
            name: 'AllSafe',
            hidden: true,
            meta: { title: '全部安全巡查记录', icon: 'dashboard', affix: false }
          }
        ]
      }

    ]

  },

  // 监督检查
  {
    path: '/supervisionInspection',
    component: Layout,
    // redirect: '/guide/index',
    name: 'SupervisionInspection',
    meta: { title: '监督检查', icon: 'dashboard', affix: false },
    // 监督检查/本库
    children: [
      {
        path: 'library',
        component: Layout,
        component: () => import('@/views/supervisionInspection/library/index'),
        name: 'Library',
        meta: { title: '本库检查', icon: 'dashboard', affix: false }
      },
      // 监督检查/本库详情
      {
        path: 'libraryDetail',
        component: () => import('@/views/supervisionInspection/library/libraryDetail'),
        name: 'LibraryDetail',
        hidden: true,
        meta: { title: '本库检查详情', icon: 'dashboard', affix: false }
      },

      // 监督检查/分库
      {
        path: 'subTreasury',
        component: () => import('@/views/supervisionInspection/subTreasury'),
        name: 'SubTreasury',
        meta: { title: '分库检查', icon: 'dashboard', affix: false }
      },

      // 监督检查/租仓、委托库点
      {
        path: 'entrustedRepository',
        component: () => import('@/views/supervisionInspection/entrustedRepository'),
        name: 'EntrustedRepository',
        meta: { title: '租仓、委托库点检查', icon: 'dashboard', affix: false }
      }
    ]
  },

  // 库外管理
  {
    path: '/warehouseOutsideManagement',
    component: Layout,
    // redirect: '/guide/index',
    name: 'WarehouseOutsideManagement',
    meta: { title: '库外管理', icon: 'dashboard', affix: false },
    //   库外管理/租仓管理
    children: [
      {
        path: 'warehouseLeasing',
        component: () => import('@/views/WarehouseOutsideManagement/warehouseLeasing'),
        name: 'WarehouseLeasing',
        meta: { title: '租仓管理', icon: 'dashboard', affix: false }
      },
      //   库外管理/委托管理
      {
        path: 'entrusted',
        component: () => import('@/views/WarehouseOutsideManagement/entrusted'),
        name: 'Entrusted',
        meta: { title: '委托管理', icon: 'dashboard', affix: false }
      }
    ]
  },

  // 专家指导
  {
    path: '/guidanceExperts',
    component: Layout,
    // redirect: '/guide/index',
    name: 'GuidanceExperts',
    meta: { title: '专家指导', icon: 'dashboard', affix: false },
    //   专家指导/指导中心
    children: [
      {
        path: 'guidanceCenter',
        component: () => import('@/views/guidanceExperts/guidanceCenter'),
        name: 'GuidanceCenter',
        meta: { title: '指导中心', icon: 'dashboard', affix: false }
      },
      //   专家指导/我的问题
      {
        path: 'myQuestion',
        component: () => import('@/views/guidanceExperts/myQuestion'),
        name: 'MyQuestion',
        meta: { title: '我的问题', icon: 'dashboard', affix: false }
      },

      //   专家指导/问题中心

      {
        path: 'questionCenter',
        component: () => import('@/views/guidanceExperts/questionCenter'),
        name: 'QuestionCenter',
        meta: { title: '问题中心', icon: 'dashboard', affix: false }
      }
    ]
  }, */

  // 系统管理
  {
    path: '/systemManagement',
    component: Layout,

    name: 'SystemManagement',
    meta: { title: '系统管理', icon: 'dashboard', affix: false },

    children: [

      //    //   系统管理/公告管理
      {
        path: 'notice',
        component: reservesTab,
        name: 'Notice',
        redirect: 'notice/newNotice',
        meta: { title: '通知公告', icon: 'dashboard', affix: false },
        children: [
          {
            path: 'newNotice',
            component: () => import('@/views/systemManagement/notice/newNotice/index'),
            name: 'NewNotice',

            hidden: true,
            meta: { title: '公告管理', icon: 'dashboard', affix: false }
          },
          {
            path: 'allNotice',
            component: () => import('@/views/systemManagement/notice/allNotice/index'),
            name: 'AllNotice',

            hidden: true,
            meta: { title: '草稿箱', icon: 'dashboard', affix: false }
          }

        ]

      },
      {
        path: '/notice/addnotice',
        component: () => import('@/views/systemManagement/notice/newNotice/addnotice'),
        name: 'Addnotice',
        hidden: true,
        meta: { title: '新建公告', icon: 'dashboard', affix: false, noCache: true }
      },
      {
        path: '/notice/detail',
        component: () => import('@/views/systemManagement/notice/newNotice/detail'),
        name: 'detail',
        hidden: true,
        meta: { title: '查看公告', icon: 'dashboard', affix: false, noCache: true }
      },
      //   系统管理/组织架构管理
      {
        path: 'organizationalStructureManagement',
        component: organizationalStructureTabs,
        name: 'OrganizationalStructureManagement',
        redirect: 'organizationalStructureManagement/granaryOrganizationalStructureManagement',
        meta: { title: '组织架构管理', icon: 'dashboard', affix: false },
        children: [
          //   系统管理/组织架构管理/粮仓组织架构管理
          {
            path: 'granaryOrganizationalStructureManagement',
            component: () => import('@/views/systemManagement/organizationalStructureManagement/granaryOrganizationalStructureManagement/index'),
            name: 'GranaryOrganizationalStructureManagement',

            hidden: true,
            meta: { title: '粮仓组织架构管理', icon: 'dashboard', affix: false }
          },

          //   系统管理/组织架构管理/人员组织架构管理
          {
            path: 'personnelOrganizationalStructureManagement',
            component: () => import('@/views/systemManagement/organizationalStructureManagement/personnelOrganizationalStructureManagement/index'),
            name: 'PersonnelOrganizationalStructureManagement',
            hidden: true,
            meta: { title: '人员组织架构管理', icon: 'dashboard', affix: false }
          },
          // 系统管理/组织架构管理/仓房基本信息
          {
            path: 'warehouseBasicInformation',
            component: () => import('@/views/systemManagement/organizationalStructureManagement/warehouseBasicInformation/index'),
            name: 'WarehouseBasicInformation',
            hidden: true,
            meta: { title: '粮库基本信息', icon: 'dashboard', affix: false }
          }

        ]
      },

      //   系统管理/组织架构管理/粮仓组织架构管理/新增直属库
      {
        path: '/granaryOrganizationalStructureManagement/directlyLibrary',
        component: () => import('@/views/systemManagement/organizationalStructureManagement/granaryOrganizationalStructureManagement/addDirectlyLibrary'),
        name: 'AddDirectlyLibrary',
        hidden: true,
        meta: { title: '新增直属库', icon: 'dashboard', affix: false, noCache: true }
      },

      //   系统管理/组织架构管理/粮仓组织架构管理/新增分库
      {
        path: '/granaryOrganizationalStructureManagement/sub',
        component: () => import('@/views/systemManagement/organizationalStructureManagement/granaryOrganizationalStructureManagement/subWarehouse/addSub'),
        name: 'AddSub',
        hidden: true,
        meta: { title: '新增分库', icon: 'dashboard', affix: false, noCache: true }
      },

      //   系统管理/组织架构管理/粮仓组织架构管理/新增仓房
      {
        path: '/granaryOrganizationalStructureManagement/warehouse',
        component: () => import('@/views/systemManagement/organizationalStructureManagement/granaryOrganizationalStructureManagement/subWarehouse/addWarehouse'),
        name: 'AddWarehouse',
        hidden: true,
        meta: { title: '新增仓房', icon: 'dashboard', affix: false, noCache: true }
      },

      //   系统管理/组织架构管理/人员组织架构/新增工作人员
      {
        path: '/personnelOrganizationalStructureManagement/personnel',
        component: () => import('@/views/systemManagement/organizationalStructureManagement/personnelOrganizationalStructureManagement/addPersonnel'),

        name: 'AddPersonnel',
        hidden: true,
        meta: { title: '新增工作人员', icon: 'dashboard', affix: false, noCache: true }
      },
      {
        path: '/personnelOrganizationalStructureManagement/personnels',
        component: () => import('@/views/systemManagement/organizationalStructureManagement/personnelOrganizationalStructureManagement/addPersonnels'),

        name: 'AddPersonnels',
        hidden: true,
        meta: { title: '新增工作人员', icon: 'dashboard', affix: false, noCache: true }
      },

      //   系统管理/用户管理
      {
        path: 'user',
        component: userTabs,
        name: 'user',
        redirect: 'user/userManagement',
        meta: { title: '用户管理', icon: 'dashboard', affix: false },

        children: [
          //   系统管理/用户管理/用户管理
          {
            path: 'userManagement',
            component: () => import('@/views/systemManagement/userManagement/userManagement/index'),
            name: 'UserManagement',
            hidden: true,
            meta: { title: '用户管理', icon: 'dashboard', affix: false }
          },

          //   系统管理/用户管理/部门管理
          {
            path: 'departmentManagement',
            component: () => import('@/views/systemManagement/userManagement/departmentManagement/index'),
            name: 'DepartmentManagement',
            hidden: true,
            meta: { title: '部门管理', icon: 'dashboard', affix: false }
          },
          // 系统管理/用户管理/角色管理
          {
            path: 'roleManagement',
            component: () => import('@/views/systemManagement/userManagement/roleManagement/index'),
            name: 'RoleManagement',
            hidden: true,
            meta: { title: '角色管理', icon: 'dashboard', affix: false }
          },
          // 系统管理/用户管理/审批人管理

          {
            path: 'approverManagement',
            component: () => import('@/views/systemManagement/userManagement/approverManagement/index'),
            name: 'ApproverManagement',
            hidden: true,
            meta: { title: '审批人管理', icon: 'dashboard', affix: false }
          }

        ]
      },

      //   系统管理/用户管理/新增用户
      {
        path: '/userManagement/addUser',
        component: () => import('@/views/systemManagement/userManagement/userManagement/addUser'),
        name: 'AddUser',
        hidden: true,
        meta: { title: '新增用户', icon: 'dashboard', affix: false, noCache: true }
      },

      //   系统管理/角色管理/新增角色
      {
        path: '/roleManagement/addRole',
        component: () => import('@/views/systemManagement/userManagement/roleManagement/addRole'),
        name: 'AddRole',
        hidden: true,
        meta: { title: '新增角色', icon: 'dashboard', affix: false, noCache: true }
      },

      //   系统管理/部门管理/新增部门
      {
        path: '/departmentManagement/addDepartment',
        component: () => import('@/views/systemManagement/userManagement/departmentManagement/addDepartment'),
        name: 'AddDepartment',
        hidden: true,
        meta: { title: '新增部门', icon: 'dashboard', affix: false, noCache: true }
      },

      //   系统管理/预警管理
      {
        path: 'earlyWarningManagement',
        component: () => import('@/views/systemManagement/earlyWarningManagement/index'),
        name: 'EarlyWarningManagement',
        meta: { title: '预警管理', icon: 'dashboard', affix: false }
      },
      {
        path: '/earlyWarningManagement/addEarlyWarningManagement',
        component: () => import('@/views/systemManagement/earlyWarningManagement/addEarlyWarningManagement'),
        name: 'addEarlyWarningManagement',
        hidden: true,
        meta: { title: '新增预警', icon: 'dashboard', affix: false, noCache: true }
      },

      //   系统管理/器材库
/*       {
        path: 'equipmentWarehouse',
        component: () => import('@/views/systemManagement/equipmentWarehouse/index'),
        name: 'EquipmentWarehouse',
        meta: { title: '器材库', icon: 'dashboard', affix: false }
      },

      //   系统管理/政策制度
      {
        path: 'policySystem',
        component: () => import('@/views/systemManagement/policySystem/index'),
        name: 'PolicySystem',
        meta: { title: '政策制度', icon: 'dashboard', affix: false }
      }, */

      //   系统管理/操作日志
      {
        path: 'operationLog',
        component: () => import('@/views/systemManagement/operationLog/index'),
        name: 'OperationLog',
        meta: { title: '操作日志', icon: 'dashboard', affix: false }
      }
    ]
  }

]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [

  /** when your routing map is too long, you can split it into small modules **/

  // {
  //   path: 'external-link',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'https://github.com/PanJiaChen/vue-element-admin',
  //       meta: { title: 'External Link', icon: 'link' }
  //     }
  //   ]
  // },

  // 404 page must be placed at the end !!!
  // { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
