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


// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const Login = () => import('@/components/Login')
const Index = () => import('@/components/Indexold')

// --------------------------------------首页模块 --------------------------------------------------
const Home01 = () => import( /* webpackChunkName: "shouye" */ '@/components/home/Home01')
const Home02 = () => import( /* webpackChunkName: "shouye" */ '@/components/home/Home02')
const MapView = () => import( /* webpackChunkName: "shouye" */ '@/components/home/MapView')

// --------------------------------------个人中心 --------------------------------------------------
const PersonMsg = () => import( /* webpackChunkName: "shouye" */ '@/pages/personage/personMsg')

// --------------------------------------数据展示模块--------------------------------------------------
const BfourSituations = () => import('@/Pages/bigdata/fourSituations/FourSituations')
const BequipDistribute = () => import('@/Pages/bigdata/equipDistributeMap/EquipDistributeMap')
const Bcbd = () => import('@/Pages/bigdata/bcbd/Bcbd')
const Bqxz = () => import('@/Pages/bigdata/bqxz/Bqxz')
const Bsy = () => import('@/Pages/bigdata/sy/Sy')
const Bbzy = () => import('@/Pages/bigdata/bzy/Bzy')
const Bhome = () => import('@/Pages/bigdata/home/index')


// --------------------------------------环境监测模块--------------------------------------------------
const EnvironmentMonitor = () => import( /* webpackChunkName: "qxz" */ '@/Pages/hjjc/environmentMonitor/EnvironmentMonitor')
const HistoryData = () => import( /* webpackChunkName: "qxz" */ '@/Pages/hjjc/environmentMonitor/HistoryData')
const Data24 = () => import( /* webpackChunkName: "qxz" */ '@/Pages/hjjc/environmentMonitor/Data24')


// --------------------------------------测报模块---------------------------测报灯-----------------------
const Cbd = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/Cbd')
const CbdDataDetails = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/DataDetails')
const cbdDataPhotos = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/CbdDataPhotos')
const PestsStats = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/PestsStats')
const MessageWarn = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/MessageWarn')


//---------------------------------------测报模块-----------------------------孢子仪-------------------------
const Bzy = () => import( /* webpackChunkName: "bzy" */ '@/Pages/forecasting/bzy/Bzy')
const BzyPhotos = () => import( /* webpackChunkName: "bzy" */ '@/Pages/forecasting/bzy/BzyPhotos')
const DataDetail = () => import( /* webpackChunkName: "bzy" */ '@/Pages/forecasting/bzy/DataDetail')

//---------------------------------------测报模块-----------------------------性诱测报-------------------------
const Xycb = () => import( /* webpackChunkName: "xycb" */ '@/Pages/forecasting/xycb/Xycb')
const xycbDataPhotos = () => import( /* webpackChunkName: "xycb" */ '@/Pages/forecasting/xycb/XycbDataPhotos')
const xycbDataDetail = () => import( /* webpackChunkName: "xycb" */ '@/Pages/forecasting/xycb/XycbDataDetail')

// --------------------------------------测报模块---------------------------糖醋测报-----------------------
const Tccb = () => import( /* webpackChunkName: "tccb" */ '@/Pages/forecasting/tccb/Tccb')
const TcDataDetail = () => import( /* webpackChunkName: "tccb" */ '@/Pages/forecasting/tccb/TcDataDetail')
const TcDataPhotos = () => import( /* webpackChunkName: "tccb" */ '@/Pages/forecasting/tccb/TcDataPhotos')


//---------------------------------------监控模块---------------------------监控-------------------------
// const Monitor = () => import( /* webpackChunkName: "monitor" */ '@/Pages/monitor/monitorSystem/Monitor')
// const PhotoView = () => import( /* webpackChunkName: "monitor" */ '@/Pages/monitor/monitorSystem/PhotoView')

//---------------------------------------防治模块---------------------------杀虫灯-------------------------
const Scd = () => import( /* webpackChunkName: "scd" */ '@/Pages/cure/scd/scd')
const ScdDetail = () => import( /* webpackChunkName: "scd" */ '@/Pages/cure/scd/scdDetail')

//---------------------------------------设备管理----------------------------------------------------
const EquipDistribute = () => import( /* webpackChunkName: "equipmanger" */ '@/Pages/equipmanger/EquipDistribute')
const EquipList = () => import( /* webpackChunkName: "equipmanger" */ '@/Pages/equipmanger/EquipList')
const UserList = () => import( /* webpackChunkName: "equipmanger" */ '@/Pages/equipmanger/UserList')
//---------------------------------------售后模块----------------------------------------------------
const FaultUp = () => import( /* webpackChunkName: "equipmanger" */ '@/Pages/equipmanger/FaultUp')
const FaulList = () => import( /* webpackChunkName: "equipmanger" */ '@/Pages/equipmanger/FaultList')
//---------------------------------------系统管理----------------------------------------------------
const UserManger = () => import('@/Pages/systemmanger/UserManger')
const UserGroupManger = () => import('@/Pages/systemmanger/UserGroupManger')
const Role = () => import('@/Pages/systemmanger/Role')
const AgentDistribute = () => import('@/Pages/systemmanger/AgentDistribute')
const CbdDistinguish = () => import('@/Pages/systemmanger/CbdDistinguish')
const DayRecord = () => import('@/Pages/systemmanger/DayRecord')
const Warning = () => import('@/Pages/systemmanger/Warning')

//---------------------------------------溯源模块------------------------------农场管理----------------------
const FarmUserManger = () => import('@/Pages/symanger/farm/User')
const FarmFieldsManger = () => import('@/Pages/symanger/farm/Fields')
const FarmBaseManger = () => import( /* webpackChunkName: "syFarmBase" */ '@/Pages/symanger/farm/Base')
const FarmAddBase = () => import( /* webpackChunkName: "syFarmBase" */ '@/Pages/symanger/farm/AddBase')
const FarmEditBase = () => import( /* webpackChunkName: "syFarmBase" */ '@/Pages/symanger/farm/EditBase')

//---------------------------------------溯源模块------------------------------溯源信息----------------------
const ResultInfoList = () => import( /* webpackChunkName: "resultInfo" */ '@/Pages/symanger/resultInfo/resultInfoList')
const ResultInfoEdit = () => import( /* webpackChunkName: "resultInfo" */ '@/Pages/symanger/resultInfo/resultInfoEdit')
const TracebackDetail = () => import( /* webpackChunkName: "resultInfo" */ '@/Pages/symanger/resultInfo/tracebackDetail')
const TracebackDetailApp = () => import( /* webpackChunkName: "resultInfo" */ '@/Pages/symanger/resultInfo/tracebackDetailApp')

//---------------------------------------溯源模块------------------------------农事管理----------------------
const FarmThingPlant = () => import('@/Pages/symanger/farmThing/plant')
const FarmThingspray = () => import('@/Pages/symanger/farmThing/spray')
const FarmThingApplyFertilizer = () => import('@/Pages/symanger/farmThing/applyFertilizer')
const FarmThingWatering = () => import('@/Pages/symanger/farmThing/watering')
const FarmThingHarvest = () => import('@/Pages/symanger/farmThing/harvest')
const FarmThingMore = () => import('@/Pages/symanger/farmThing/more')
const FarmThingSale = () => import('@/Pages/symanger/farmThing/sale')
const FarmThingTransport = () => import('@/Pages/symanger/farmThing/transport')
//---------------------------------------四情基地管理----------------------------------------------------
const FourMoodBase = () => import('@/Pages/fourMoodBase/BaseManage')
const BaseShow = () => import('@/Pages/fourMoodBase/BaseShow')
//---------------------------------------专家诊断----------------------------------------------------
import ExpertAnswers from '@/pages/expertDiagnosis/expertAnswers/ExpertAnswers'
import ExpertDatabase from '@/pages/expertDiagnosis/expertDatabase/ExpertDatabase'
import ExpertIntr from '@/pages/expertDiagnosis/expertIntr/ExpertIntr'
import PicRec from '@/pages/expertDiagnosis/picRec/PicRec'
import expertAudit from '@/pages/expertDiagnosis/expertAudit/expertAudit'
import expertWriteBack from '@/pages/expertDiagnosis/expertWriteBack/expertWriteBack'

import expertPostList from '@/pages/expertDiagnosis/posts/PostList'
import expertPostDetail from '@/pages/expertDiagnosis/posts/PostDetail'
//---------------------------------------售后服务----------------------------------------------------
import SaleAppli from '@/pages/afterSale/SaleAppli'
import SaleAfterDetail from '@/pages/afterSale/SaleAfterdetail'
import SaleAllotPeople from '@/pages/afterSale/AllotPeople'
import ProgressInquiry from '@/pages/afterSale/ProgressInquiry'
import MRecords from '@/pages/afterSale/MRecords'

//---------------------------------------农林植保----------------------------------------------------
const PlantGuard = () => import('@/components/index')
const Page1 = () => import('@/Pages/plantGuard/page1')
const Page2 = () => import('@/Pages/plantGuard/page2')
const Page3 = () => import('@/Pages/plantGuard/page3')
const Page4 = () => import('@/Pages/plantGuard/page4') //系统管理-用户管理
const Page5 = () => import('@/Pages/plantGuard/page5') //系统管理-设备分配
const Page6 = () => import('@/Pages/plantGuard/page6') //系统管理-角色管理
const Page7 = () => import('@/Pages/plantGuard/page7') //系统管理-主题定制
const Page8 = () => import('@/Pages/plantGuard/page8') //设备管理-设备列表 
const CbdPhoto = () => import('@/Pages/plantGuard/cbdphoto/cbdphoto') //测报灯图片
const CbdPestStats = () => import('@/Pages/plantGuard/cbdPestStats') //测报灯图片
const Monitor = () => import('@/Pages/monitor/monitorSystem/Monitor')
const BaseAll = () => import('@/Pages/plantGuard/baseAll') //管理员查看项目基地
const PhotoView = () => import( /* webpackChunkName: "monitor" */ '@/Pages/monitor/monitorSystem/PhotoView')

const Page9 = () => import('@/Pages/plantGuard/page9') //水价管理-地图展示
const Page10 = () => import('@/Pages/plantGuard/page10') //水价管理-地图展示
const Page11 = () => import('@/Pages/plantGuard/page11') //水价管理-地图展示

Vue.use(Router)

export default new Router({
  routes: [{
      path: '',
      redirect: '/login'
    },
    {
      path: '/login',
      component: Login
    },
    // -----------------农林植保------------------------ 
    {
      path: '/plantGuard',
      name:'PlantGuard',
      component: PlantGuard,
      children:[
        {
          path: 'baseAll',
          name: 'BaseAll',
          component: BaseAll,
          meta: { title: '数据监测',order:1,navname: '项目基地', }
        },
        {
          path: 'page1',
          name:'page1',
          component: Page1,
          meta: { title: '数据监测',order:0, navname:'设备列表',}
        },
        {
          path: 'page2',
          name: 'page2',
          component: Page2,
          meta: { title: '数据监测',order:0 ,navname:'数据目录管理',}
        },
        {
          path: 'page3',
          name: 'page3',
          component: Page3,
          meta: { title: '智能灌溉系统',order:2 ,navname:'系统管理',}
        },
        {
          path: 'page4',
          name: 'page4',
          component: Page4,
          meta: { title: '系统管理',order:6, navname: '用户管理',}
        },
        {
          path: 'page5',
          name: 'page5',
          component: Page5,
          meta: { title: '系统管理',order:6,navname: '设备分配', }
        },
        {
          path: 'page6',
          name: 'page6',
          component: Page6,
          meta: { title: '系统管理',order:6,navname: '角色管理', }
        },
        {
          path: 'page7',
          name: 'page7',
          component: Page7,
          meta: { title: '系统管理',order:6,navname: '主题定制', }
        },
        {
          path: 'page8',
          name: 'page8',
          component: Page8,
          meta: { title: '设备管理',order:7,navname: '设备管理', }
        },
        {
          path: 'cbdPhoto',
          name: 'cbdPhoto',
          component: CbdPhoto,
          meta: { title: '',order:0,navname: '测报灯图片', }
        },
        {
          path: 'cbdPestStats',
          name: 'CbdPestStats',
          component: CbdPestStats,
          meta: { title: '',order:0,navname: '害虫统计', }
        },
        {
          path: 'monitor',
          name: 'Monitor',
          component: Monitor,
          meta: { title: '',order:1,navname: '可视化系统', }
        },
        {
          path: 'photoView/:id',
          name: 'PhotoView',
          component: PhotoView,
          meta: { title: '',order:0,navname: '图片详情', }
        },
        {
          path: 'page9',
          name: 'page9',
          component: Page9,
          meta: { title: '水价管理',order:3,navname: '地图展示', }
        },
        {
          path: 'page10',
          name: 'page10',
          component: Page10,
          meta: { title: '水价管理',order:3,navname: '水井信息', }
        },
        {
          path: 'page11',
          name: 'page11',
          component: Page11,
          meta: { title: '水价管理',order:3,navname: '用户信息', }
        },
        
      ]
    },
    // -----------------大数据平台------------------------ 
    {
      path: '/bFourSituations',
      component: BfourSituations
    },
    {
      path: '/equipDistribute',
      component: BequipDistribute
    },
    {
      path: '/bCbd',
      component: Bcbd,
    },
    {
      path: '/bQxz',
      component: Bqxz
    },
    {
      path: '/bSy',
      component: Bsy
    },
    {
      path: '/bBzy',
      component: Bbzy
    },
    {
      path: '/bHome',
      component: Bhome
    },
    {
      path: '/index',
      component: Index,
      children: [{
          path: '',
          redirect: (window.sessionStorage.getItem('activePath') || '/index/home')
        }, {
          path: 'home',
          component: Home01
        },
        {
          path: 'home02',
          component: Home02
        },
        {
          path: 'mapView',
          component: MapView
        },
        {
          path: 'personMsg',
          name:'PersonMsg',
          component: PersonMsg
        },
        // -----------------环境监测模块------------------------
        {
          path: 'envi',
          component: EnvironmentMonitor
        },
        {
          path: 'historyData/:id',
          component: HistoryData
        },
        {
          path: 'data24/:id',
          component: Data24
        },
        // -----------------测报模块------------测报灯------------
        {
          path: 'cbd',
          component: Cbd,
          meta: {
            keepAlive: true //留存数据
          }
        },
        {
          path: 'cbdDataDetails/:e_id/:d_id',
          name:"CbdDataDetails",
          component: CbdDataDetails
        },
        {
          path: 'cbdDataPhotos/:id',
          name:'cbdDataPhotos',
          component: cbdDataPhotos
        },
        {
          path: 'pestsStats/:d_id/:id',
          name:'PestsStats',
          component: PestsStats
        },
        {
          path: 'messageWarn/:id',
          name:'MessageWarn',
          component: MessageWarn
        },
        //------------------测报模块-------------监控-------------
        // {
        //   path: 'monitor',
        //   component: Monitor,
        // },
        // {
        //   path: 'photoView/:id',
        //   component: PhotoView
        // },
        //------------------测报模块-------------孢子仪-------------
        {
          path: 'bzy',
          component: Bzy,
          meta: {
            keepAlive: true //留存数据
          }
        },
        {
          path: 'bzyPhotos/:id',
          name:'BzyPhotos',
          component: BzyPhotos
        },
        {
          path: 'dataDetail/:e_id/:d_id',
          name:'DataDetail',
          component: DataDetail
        },
        //------------------测报模块-------------性诱测报-------------
        {
          path: 'xycb',
          component: Xycb,
          meta: {
            keepAlive: true //留存数据
          }
        },
        {
          path: 'xycbDataPhotos/:id',
          name:'xycbDataPhotos',
          component: xycbDataPhotos
        },
        {
          path: 'xycbDataDetail/:e_id/:d_id',
          name:'xycbDataDetail',
          component: xycbDataDetail
        },
        //------------------测报模块-------------糖醋测报-------------
        {
          path: 'tccb',
          component: Tccb,
          meta: {
            keepAlive: true //留存数据
          }
        },
        {
          path: 'tcDataPhotos/:id',
          component: TcDataPhotos
        },
        {
          path: 'tcDataDetail/:e_id/:d_id',
          component: TcDataDetail
        },
        //------------------防治模块-------------杀虫灯-------------
        {
          path: 'scd',
          component: Scd,
          meta: {
            keepAlive: true //留存数据
          }
        },
        {
          path: 'scdDetail/:e_id/:d_id',
          name:'ScdDetail',
          component: ScdDetail
        },
        //------------------设备管理--------------------------
        {
          path: 'equipdis/:id',
          component: EquipDistribute
        },
        {
          path: 'equipList',
          component: EquipList
        },
        {
          path: 'userList',
          component: UserList
        },
        //------------------售后模块--------------------------
        {
          path:'faulList',
          component:FaulList
        },
        //------------------系统管理--------------------------
        {
          path: 'userManger',
          component: UserManger,
        },
        {
          path: 'userGroupManger',
          component: UserGroupManger
        },
        {
          path: 'role',
          component: Role
        },
        {
          path: 'agentDistribute',
          component: AgentDistribute
        },
        {
          path: 'cbdDistinguish',
          component: CbdDistinguish
        },
        {
          path: 'dayRecord',
          component: DayRecord
        },
        {
          path: 'warning',
          component: Warning
        },
        //-------------------溯源模块-----------农场管理----------
        {
          path: 'farmUserManger',
          component: FarmUserManger
        },
        {
          path: 'farmFieldsManger',
          component: FarmFieldsManger
        },
        {
          path: 'farmBaseManger',
          component: FarmBaseManger
        },
        {
          path: 'farmAddBase',
          component: FarmAddBase
        },
        {
          path: 'farmEditBase',
          component: FarmEditBase
        },
        //-------------------溯源模块-----------溯源信息----------
        {
          path: 'resultInfoList',
          component: ResultInfoList
        },
        {
          path: 'resultInfoEdit',
          component: ResultInfoEdit
        },
        //-------------------溯源模块-----------农事管理----------
        {
          path: 'farmThingPlant',
          component: FarmThingPlant
        },
        {
          path: 'farmThingspray',
          component: FarmThingspray
        },
        {
          path: 'farmThingApplyFerti',
          component: FarmThingApplyFertilizer
        },
        {
          path: 'farmThingWatering',
          component: FarmThingWatering
        },
        {
          path: 'farmThingHarvest',
          component: FarmThingHarvest
        },
        {
          path: 'farmThingMore',
          component: FarmThingMore
        },
        {
          path: 'farmThingSale',
          component: FarmThingSale
        },
        {
          path: 'farmThingTransport',
          component: FarmThingTransport
        },
        // {
        //   path: 'table',
        //   name: 'table',
        //   component: resolve=>(require(["@/pages/symanger/table.vue"],resolve))
        // },
        //-------------------四情基地管理---------------------
        {
          path: 'fourMoodBase',
          component: FourMoodBase
        },
        {
          path: 'baseShow',
          component: BaseShow
        },
        //-------------------专家诊断---------------------
        {
          path: 'expertAnswers',
          component: ExpertAnswers
        },
        {
          path: 'expertDatabase',
          component: ExpertDatabase
        },
        {
          path: 'expertIntr',
          component: ExpertIntr
        },
        {
          path: 'picRec',
          component: PicRec
        },
        {
          path: 'expertAudit',
          component: expertAudit
        },
        {
          path: 'expertWriteBack',
          component: expertWriteBack
        },
        {
          path: 'expertPostList',
          component: expertPostList
        },
        {
          path: 'expertPostDetail',
          component: expertPostDetail
        },
        //-------------------售后管理---------------------
        {
          path: 'saleAppli',
          component: SaleAppli
        },
        {
          path: 'saleAfterDetail',
          component: SaleAfterDetail
        },
        {
          path: 'saleAllotPeople',
          component: SaleAllotPeople
        },
        {
          path: 'progressInquiry',
          component: ProgressInquiry
        },
        {
          path: 'mRecords',
          component: MRecords
        },
      ]
    },
    //-------------------溯源模块-----------溯源中心----------
    {
      path: '/tracebackDetail/:backcode',
      name:'TracebackDetail',
      component: TracebackDetail,
    },
    {
      path: '/tracebackDetailApp/:backcode',
      name:'TracebackDetailApp',
      component: TracebackDetailApp,
    },
    {
      path: '/faultUp',
      name:'FaultUp',
      component: FaultUp,
    },
  ],
  // mode:'history'
})