import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout'

export const constantRoutes = [{
        path: '/login',
        component: () =>
            import ('@/views/login'),
        hidden: true,
    },
    {
        path: '/403',
        name: '403',
        component: () =>
            import ('@/views/403'),
        hidden: true,
    },
    {
        path: '/404',
        name: '404',
        component: () =>
            import ('@/views/404'),
        hidden: true,
    },
]
export const asyncRoutes = [{
        path: '/',
        component: Layout,
        redirect: '/index',
        meta: {
            title: '首页',
            icon: 'home',
            affix: true,
        },
        children: [{
            path: 'index',
            name: 'Index',
            component: () =>
                import ('@/views/index'),
            meta: {
                title: '首页',
                icon: 'home',
                affix: true,
            },
        }, ],
    },

    {
        path: '/alarmManage',
        redirect: '/alarmManage/index',
        meta: {
            title: '告警管理',
            icon: 'alarmManage',
        },
        component: Layout,
        children: [{
                path: 'alarmTotal',
                component: () =>
                    import ('@/views/alarmManage/alarmTotal'),
                selectLeftMenu: '/alarmManage',
                meta: {
                    title: '告警总数',
                    icon: 'alarmManage',
                },
                hidden: true
            },
            {
                meta: {
                    title: '告警管理',
                    icon: 'alarmManage',
                },
                path: 'index',
                component: () =>
                    import ('@/views/alarmManage/index'),
                selectLeftMenu: '/alarmManage',
                hidden: true
            },

        ]
    },

    {
        path: '/siteManage',
        redirect: '/siteManage/index',
        meta: {
            title: '站点管理',
            icon: 'siteManage',
        },
        component: Layout,
        children: [{
            meta: {
                title: '站点管理',
                icon: 'siteManage',
            },
            path: '/siteManage',
            component: () =>
                import ('@/views/siteManage/index'),
            selectLeftMenu: '/alarmManage',
            hidden: true
        }]
    },


    {
        meta: {
            icon: 'stationManage',
            title: '台区管理',
        },
        path: '/stationManage',
        redirect: '/stationManage/index',
        component: Layout,
        children: [{
                meta: {
                    icon: 'stationManage',
                    title: '站点列表',
                },
                path: 'siteList',
                component: () =>
                    import ('@/views/stationManage/siteList.vue'),
                selectLeftMenu: '/stationManage',
                hidden: true
            },
            {
                meta: {
                    icon: 'stationManage',
                    title: '所有台区',
                },
                path: 'index',
                component: () =>
                    import ('@/views/stationManage/index.vue'),
                selectLeftMenu: '/stationManage',
                hidden: true
            }
        ]
    },

    /**
     * deviceManage 设备管理
     * powerEquip 电力监测设备
     * videoEquip 视频监测设备
     * communicateEquip 通信设备
     * channelList 通道列表
     * attribTemplate 属性模板
     */
    {
        meta: { icon: 'deviceManage', title: '设备管理', },
        path: '/deviceManage',
        component: Layout,
        redirect: '/deviceManage/powerEquip',
        children: [{
                meta: { icon: 'deviceManage', title: '设备管理', },
                path: 'powerEquip',
                component: () =>
                    import ('@/views/deviceManage/powerEquip/index.vue'),
            },
            // {
            //   title: 'index-layout.menu.deviceManage.videoEquip',
            //   path: 'videoEquip',
            //   component: () => import('@/views/deviceManage/videoEquip/index.vue'),
            // },
            // {
            //   title: 'index-layout.menu.deviceManage.communicateEquip',
            //   path: 'communicateEquip',
            //   component: () => import('@/views/deviceManage/communicateEquip/index.vue'),
            // },
            // {
            //   title: 'index-layout.menu.deviceManage.channelList',
            //   path: 'channelList',
            //   component: () => import('@/views/deviceManage/channelList/index.vue'),
            // },
            {
                meta: { icon: 'deviceManage', title: '属性模板', },
                path: 'attribTemplate',
                component: () =>
                    import ('@/views/deviceManage/attribTemplate/index.vue'),
            }
        ]
    },

    /**
     * dataManage 数据管理
     * sameAnalysis 同比分析报表
     * chainAnalysis 环比分析报表
     * handOpera 手动抄表
     * energyReport 用能月报
     * demandAnalysis 需量分析
     * consumConfig 能耗分析配置
     */
    {
        meta: { icon: 'dataManage', title: '数据管理', },
        path: '/dataManage',
        component: Layout,
        redirect: '/dataManage/sameAnalysis',
        children: [{
                meta: { icon: 'sameAnalysis', title: '同比分析报表', },
                path: 'sameAnalysis',
                component: () =>
                    import ('@/views/dataManage/sameAnalysis/index.vue'),
            },
            {
                meta: { icon: 'chainAnalysis', title: '环比分析报表', },
                path: 'chainAnalysis',
                component: () =>
                    import ('@/views/dataManage/chainAnalysis/index.vue'),
            },
            {
                meta: { icon: 'handOpera', title: '手动抄表', },
                title: 'index-layout.menu.dataManage.handOpera',
                path: 'handOpera',
                component: () =>
                    import ('@/views/dataManage/handOpera/index.vue'),
            },
            {
                meta: { icon: 'energyReport', title: '用能月报', },
                title: 'index-layout.menu.dataManage.energyReport',
                path: 'energyReport',
                component: () =>
                    import ('@/views/dataManage/energyReport/index.vue'),
            },
            {
                meta: { icon: 'demandAnalysis', title: '需量分析', },
                title: 'index-layout.menu.dataManage.demandAnalysis',
                path: 'demandAnalysis',
                component: () =>
                    import ('@/views/dataManage/demandAnalysis/index.vue'),
            },
            {
                meta: { icon: 'consumConfig', title: '能耗分析配置', },
                title: 'index-layout.menu.dataManage.consumConfig',
                path: 'consumConfig',
                component: () =>
                    import ('@/views/dataManage/consumConfig/index.vue'),
            }
        ]
    },

    /**
     * powerQuality 电能质量
     * harmonicReport 谐波报表
     * realTimeMonitoring 实时监测
     * asseReport 评估报告
     * unbalanceAnalysis 三相不平衡分析
     */
    {
        meta: { icon: 'powerQuality', title: '电能质量', },
        path: '/powerQuality',
        component: Layout,
        redirect: '/powerQuality/harmonicReport',
        children: [{
                meta: { icon: 'harmonicReport', title: '谐波报表', },
                path: 'harmonicReport',
                component: () =>
                    import ('@/views/powerQuality/harmonicReport/index.vue'),
            },
            {
                meta: { icon: 'realTimeMonitoring', title: '实时监测', },
                path: 'realTimeMonitoring',
                component: () =>
                    import ('@/views/powerQuality/realTimeMonitoring/index.vue'),
            },
            {
                meta: { icon: 'asseReport', title: '评估报告', },
                path: 'asseReport',
                component: () =>
                    import ('@/views/powerQuality/asseReport/index.vue'),
            },
            {
                meta: { icon: 'unbalanceAnalysis', title: '三相不平衡分析', },
                path: 'unbalanceAnalysis',
                component: () =>
                    import ('@/views/powerQuality/unbalanceAnalysis/index.vue'),
            },

        ]
    },


    /**
     * monthReport 月度报告
     */
    {
        path: '/monthReport',
        redirect: '/monthReport',
        meta: {
            title: '月度报告',
            icon: 'monthReport',
        },
        component: Layout,
        children: [{
            path: '/monthReport',
            component: () =>
                import ('@/views/monthReport/index'),
            hidden: true
        }]
    },


    {
        path: '/planOutage',
        redirect: '/planOutage',
        meta: {
            title: '计划停电',
            icon: 'planOutage',
        },
        component: Layout,
        children: [{
            path: '/planOutage',
            component: () =>
                import ('@/views/planOutage/index'),
            hidden: true
        }]
    },


    /**
     * patrolManage 巡检管理
     * patrolPlan 巡检计划
     * patrolRecord 巡检记录
     * patrolContent 巡检内容
     * checkEntries 检查条目
     */
    {
        meta: { title: '巡检管理', icon: 'patrolManage', },
        path: '/patrolManage',
        component: Layout,
        redirect: '/patrolManage/patrolPlan',
        name: 'patrolManage',
        children: [{
                meta: { title: '巡检计划' },
                path: 'patrolPlan',
                name: 'patrolPlan',
                component: () =>
                    import ('@/views/patrolManage/patrolPlan/index.vue'),
            },
            {
                meta: { title: '巡检记录' },
                path: 'patrolRecord',
                name: 'patrolRecord',
                component: () =>
                    import ('@/views/patrolManage/patrolRecord/index.vue'),
            },
            {
                meta: { title: '巡检内容' },
                path: 'patrolContent',
                name: 'patrolContent',
                component: () =>
                    import ('@/views/patrolManage/patrolContent/index.vue'),
            },
            {
                meta: { title: '检查条目' },
                path: 'checkEntries',
                name: 'checkEntries',
                component: () =>
                    import ('@/views/patrolManage/checkEntries/index.vue'),
            },
        ]
    },


    /**
     * operManage 运维管理
     * siteAchives 现场档案
     * defectManage 缺陷管理
     * workManage 工单管理
     * operStatistics 运维统计
     * workStatistics 工作量统计
     */
    {
        meta: { title: '运维管理', icon: 'operManage', },
        path: '/operManage',
        component: Layout,
        redirect: '/operManage/siteAchives',
        name: 'operManage',
        children: [{
                meta: { title: '现场档案' },
                path: 'siteAchives',
                component: () =>
                    import ('@/views/operManage/siteAchives/index.vue'),
            },
            {
                meta: { title: '缺陷管理' },
                path: 'defectManage',
                component: () =>
                    import ('@/views/operManage/defectManage/index.vue'),
            },
            {
                meta: { title: '工单管理' },
                path: 'workManage',
                component: () =>
                    import ('@/views/operManage/workManage/index.vue'),
            },
            {
                meta: { title: '运维统计' },
                path: 'operStatistics',
                component: () =>
                    import ('@/views/operManage/operStatistics/index.vue'),
            },
            {
                meta: { title: '工作量统计' },
                path: 'workStatistics',
                component: () =>
                    import ('@/views/operManage/workStatistics/index.vue'),
            },

        ]
    },

    /** 
     * systemManage 系统管理
     * userManage 用户管理
     * rolePermission 权限管理
     */
    {
        meta: { title: '系统管理', icon: 'systemManage', },
        path: '/systemManage',
        component: Layout,
        redirect: '/systemManage/userManage',
        children: [{
                meta: { title: '用户管理' },
                path: 'userManage',
                component: () =>
                    import ('@/views/systemManage/userManage/index.vue'),
            },
            {
                meta: { title: '权限管理' },
                path: 'rolePermission',
                component: () =>
                    import ('@/views/systemManage/rolePermission/index.vue'),
            },
        ]
    },




    {
        path: '/vab',
        component: Layout,
        redirect: '/vab/table',
        alwaysShow: true,
        meta: {
            title: '组件',
            icon: 'apps-line',
        },
        children: [{
                path: 'table',
                name: 'Table',
                component: () =>
                    import ('@/views/vab/table'),
                meta: {
                    title: '表格',
                    icon: 'table-2',
                },
            },
            {
                path: 'icon',
                name: 'Icon',
                component: () =>
                    import ('@/views/vab/icon'),
                meta: {
                    title: '图标',
                    icon: 'remixicon-line',
                },
            },
        ],
    },

    // {
    //   path: '/test',
    //   component: Layout,
    //   redirect: '/test/test',
    //   meta: {
    //     title: '动态路由测试',
    //     icon: 'test-tube-line',
    //   },
    //   children: [
    //     {
    //       path: 'test',
    //       name: 'Test',
    //       component: () => import('@/views/test'),
    //       meta: {
    //         title: '动态路由测试',
    //         icon: 'test-tube-line',
    //       },
    //     },
    //   ],
    // },

    // {
    //   path: '/error',
    //   name: 'Error',
    //   component: Layout,
    //   redirect: '/error/403',
    //   meta: {
    //     title: '错误页',
    //     icon: 'error-warning-line',
    //   },
    //   children: [
    //     {
    //       path: '403',
    //       name: 'Error403',
    //       component: () => import('@/views/403'),
    //       meta: {
    //         title: '403',
    //         icon: 'error-warning-line',
    //       },
    //     },
    //     {
    //       path: '404',
    //       name: 'Error404',
    //       component: () => import('@/views/404'),
    //       meta: {
    //         title: '404',
    //         icon: 'error-warning-line',
    //       },
    //     },
    //   ],
    // },
    {
        path: '/*',
        redirect: '/404',
        hidden: true,
    },
]
const router = createRouter({
    history: createWebHashHistory(),
    routes: constantRoutes,
})

export default router