ming il y a 3 ans
Parent
commit
9a9a6ddb72

+ 3 - 3
public/static/config.js

@@ -1,9 +1,9 @@
 // api 请求路径
 var PLATFROM_CONFIG = {};
-PLATFROM_CONFIG.baseUrl = "http://172.16.120.104:8010/" //杨强本地
-    // PLATFROM_CONFIG.baseUrl = "http://172.16.1.196:8010/" //超博本地
+// PLATFROM_CONFIG.baseUrl = "http://172.16.120.104:8010/" //杨强本地
+// PLATFROM_CONFIG.baseUrl = "http://172.16.1.196:8010/" //超博本地
 
-// PLATFROM_CONFIG.baseUrl = "https://qhome.usky.cn/fivapi/" //线上
+PLATFROM_CONFIG.baseUrl = "https://qhome.usky.cn/fivapi/" //线上
 PLATFROM_CONFIG.images = "https://qhome.usky.cn/file/" //线上图片
 PLATFROM_CONFIG.fileUrl = "https://qhome.usky.cn/file/" //xlsx文件访问路径
 

+ 1 - 1
src/router/index.js

@@ -65,7 +65,7 @@ export const asyncRoutes = [
 
     {
         path: '/',
-        redirect: '/alarmManage/index',
+        redirect: '/index',
         meta: {
             title: '告警管理',
             icon: 'alarmManage',

+ 489 - 4
src/store/modules/routes.js

@@ -5,6 +5,7 @@
 import { asyncRoutes, constantRoutes } from '@/router'
 import { getRouterList } from '@/api/router'
 import { convertRouter, filterRoutes } from '@/utils/routes'
+import { Layout } from 'ant-design-vue'
 
 const state = () => ({
     routes: [],
@@ -41,12 +42,496 @@ const actions = {
      * @returns
      */
     async setAllRoutes({ commit }) {
-        let { data } = await getRouterList()
-        if (data[data.length - 1].path !== '*')
-            data.push({ path: '*', redirect: '/404', hidden: true })
+        getRouterList
+        // let { data } = await getRouterList()
+        let data = [
+
+                // {
+                //     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: 'external-link',
+                    component: Layout,
+                    children: [{
+                        path: '/home',
+                        meta: { title: '首页', icon: 'home', }
+                    }]
+                },
+
+                {
+                    path: '/',
+                    redirect: '/index',
+                    meta: {
+                        title: '告警管理',
+                        icon: 'alarmManage',
+                        affix: true,
+                    },
+                    component: Layout,
+                    children: [{
+                        meta: {
+                            title: '告警管理',
+                            icon: 'alarmManage',
+                        },
+                        path: 'index',
+                        component: () =>
+                            import ('@/views/alarmManage/index'),
+                    }, ]
+                },
+                // {
+                //     path: '/alarmManage',
+                //     redirect: '/alarmManage/index',
+                //     meta: {
+                //         title: '告警管理',
+                //         icon: 'alarmManage',
+                //         affix: true,
+                //     },
+                //     component: Layout,
+                //     children: [{
+                //         meta: {
+                //             title: '告警管理',
+                //             icon: 'alarmManage',
+                //             affix: true,
+                //         },
+                //         path: 'alarmManage',
+                //         component: () =>
+                //             import ('@/views/alarmManage/index'),
+
+                //     }, ]
+                // },
+                {
+                    path: '/siteManage',
+                    redirect: '/siteManage/index',
+                    meta: {
+                        title: '站点管理',
+                        icon: 'siteManage',
+                    },
+                    component: Layout,
+                    children: [{
+                        meta: {
+                            title: '站点管理',
+                            icon: 'siteManage',
+                        },
+                        path: '/siteManage',
+                        component: () =>
+                            import ('@/views/siteManage/index'),
+                        hidden: true
+                    }]
+                },
+
+                {
+                    path: '/stationManage',
+                    redirect: '/stationManage/index',
+                    meta: {
+                        title: '台区管理',
+                        icon: 'stationManage',
+                    },
+                    component: Layout,
+                    children: [{
+                        meta: {
+                            title: '台区管理',
+                            icon: 'stationManage',
+                        },
+                        path: '/stationManage',
+                        component: () =>
+                            import ('@/views/stationManage/index'),
+                        hidden: true
+                    }]
+                },
+
+                /**
+                 * deviceManage 设备管理
+                 * powerEquip 电力监测设备
+                 * videoEquip 视频监测设备
+                 * communicateEquip 通信设备
+                 * channelList 通道列表
+                 * attribTemplate 属性模板
+                 */
+
+                {
+                    path: '/deviceManage',
+                    redirect: '/deviceManage/powerEquip',
+                    meta: {
+                        title: '设备管理',
+                        icon: 'deviceManage',
+                    },
+                    component: Layout,
+                    children: [{
+                        meta: {
+                            title: '设备管理',
+                            icon: 'deviceManage',
+                        },
+                        path: '/deviceManage',
+                        component: () =>
+                            import ('@/views/deviceManage/powerEquip'),
+                        hidden: true
+                    }]
+                },
+
+
+                // {
+                //     meta: { icon: 'deviceManage', title: '设备管理', },
+                //     path: '/deviceManage',
+                //     component: Layout,
+                //     redirect: '/deviceManage/powerEquip',
+                //     children: [{
+                //             meta: { icon: 'powerEquip', title: '设备管理', },
+                //             path: 'powerEquip',
+                //             component: () =>
+                //                 import ('@/views/deviceManage/powerEquip/index.vue'),
+                //         },
+                //         {
+                //             meta: { icon: 'attribTemplate', 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/index',
+                    children: [{
+                            meta: { icon: 'sameAnalysis', title: '同比分析报表', },
+                            path: 'sameAnalysis',
+                            component: () =>
+                                import ('@/views/dataManage/sameAnalysis/index'),
+                        },
+                        {
+                            meta: { icon: 'chainAnalysis', title: '环比分析报表', },
+                            path: 'chainAnalysis',
+                            component: () =>
+                                import ('@/views/dataManage/chainAnalysis/index'),
+                        },
+                        // {
+                        //     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'),
+                        },
+                        {
+                            meta: { icon: 'demandAnalysis', title: '需量分析', },
+                            title: 'index-layout.menu.dataManage.demandAnalysis',
+                            path: 'demandAnalysis',
+                            component: () =>
+                                import ('@/views/dataManage/demandAnalysis/index'),
+                        },
+                        // {
+                        //     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/index',
+                    children: [{
+                            meta: { icon: 'harmonicReport', title: '谐波报表', },
+                            path: 'harmonicReport',
+                            component: () =>
+                                import ('@/views/powerQuality/harmonicReport/index'),
+                        },
+                        {
+                            meta: { icon: 'realTimeMonitoring', title: '实时监测' },
+                            path: 'realTimeMonitoring',
+                            component: () =>
+                                import ('@/views/powerQuality/realTimeMonitoring/index'),
+                        },
+                        {
+                            meta: { icon: 'asseReport', title: '评估报告', },
+                            path: 'asseReport',
+                            component: () =>
+                                import ('@/views/powerQuality/asseReport/index'),
+                        },
+                        {
+                            meta: { icon: 'unbalanceAnalysis', title: '三相不平衡分析', },
+                            path: 'unbalanceAnalysis',
+                            component: () =>
+                                import ('@/views/powerQuality/unbalanceAnalysis/index'),
+                        },
+
+                    ]
+                },
+
+
+                /**
+                 * monthReport 月度报告
+                 */
+                // {
+                //     path: '/monthReport',
+                //     redirect: '/monthReport',
+                //     meta: { title: '月度报告', icon: 'monthReport', },
+                //     component: Layout,
+                //     children: [{
+                //             meta: { title: '月度报告', icon: 'monthReport', },
+                //             path: '/monthReport',
+                //             component: () =>
+                //                 import ('@/views/monthReport/index'),
+                //             hidden: true
+                //         },
+                //         {
+                //             meta: { title: '月报模板', icon: 'reportModel', },
+                //             path: '/reportModel',
+                //             component: () =>
+                //                 import ('@/views/monthReport/reportModel'),
+                //             hidden: true
+                //         }
+                //     ]
+                // },
+
+
+                {
+                    path: '/planOutage',
+                    redirect: '/planOutage/index',
+                    meta: { title: '计划停电', icon: 'planOutage', },
+                    component: Layout,
+                    children: [{
+                        meta: { title: '计划停电', icon: 'planOutage', },
+                        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: '巡检计划', icon: 'patrolPlan' },
+                //             path: 'patrolPlan',
+                //             name: 'patrolPlan',
+                //             component: () =>
+                //                 import ('@/views/patrolManage/patrolPlan/index.vue'),
+                //         },
+                //         {
+                //             meta: { title: '巡检记录', icon: 'patrolRecord' },
+                //             path: 'patrolRecord',
+                //             name: 'patrolRecord',
+                //             component: () =>
+                //                 import ('@/views/patrolManage/patrolRecord/index.vue'),
+                //         },
+                //         {
+                //             meta: { title: '巡检内容', icon: '巡检内容' },
+                //             path: 'patrolContent',
+                //             name: 'patrolContent',
+                //             component: () =>
+                //                 import ('@/views/patrolManage/patrolContent/index.vue'),
+                //         },
+                //         {
+                //             meta: { title: '检查条目', icon: '检查条目' },
+                //             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: '现场档案', icon: 'siteAchives', },
+                //             path: 'siteAchives',
+                //             component: () =>
+                //                 import ('@/views/operManage/siteAchives/index.vue'),
+                //         },
+                //         {
+                //             meta: { title: '缺陷管理', icon: 'defectManage', },
+                //             path: 'defectManage',
+                //             component: () =>
+                //                 import ('@/views/operManage/defectManage/index.vue'),
+                //         },
+                //         {
+                //             meta: { title: '工单管理', icon: 'workManage', },
+                //             path: 'workManage',
+                //             component: () =>
+                //                 import ('@/views/operManage/workManage/index.vue'),
+                //         },
+                //         {
+                //             meta: { title: '运维统计', icon: 'operStatistics', },
+                //             path: 'operStatistics',
+                //             component: () =>
+                //                 import ('@/views/operManage/operStatistics/index.vue'),
+                //         },
+                //         {
+                //             meta: { title: '工作量统计', icon: 'workStatistics', },
+                //             path: 'workStatistics',
+                //             component: () =>
+                //                 import ('@/views/operManage/workStatistics/index.vue'),
+                //         },
+
+                //     ]
+                // },
+
+                /** 
+                 * systemManage 系统管理
+                 * userManage 用户管理
+                 * rolePermission 权限管理
+                 */
+                {
+                    meta: { title: '系统管理', icon: 'systemManage', },
+                    path: '/systemManage',
+                    component: Layout,
+                    redirect: '/systemManage/userManage/index',
+                    children: [{
+                            meta: { title: '用户管理', icon: 'userManage', },
+                            path: 'userManage',
+                            component: () =>
+                                import ('@/views/systemManage/userManage/index'),
+                        },
+                        {
+                            meta: { title: '权限管理', icon: 'rolePermission', },
+                            path: 'rolePermission',
+                            component: () =>
+                                import ('@/views/systemManage/rolePermission/index'),
+                        },
+                    ]
+                },
+
+
+
+
+                // {
+                //   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,
+                },
+            ]
+            // if (data[data.length - 1].path !== '*')
+            //     data.push({ path: '*', redirect: '/404', hidden: true })
         const asyncRoutes = convertRouter(data)
         const finallyRoutes = filterRoutes([...constantRoutes, ...asyncRoutes])
-        console.log(finallyRoutes)
         commit('setRoutes', finallyRoutes)
         return [...asyncRoutes]
     },

+ 4 - 1
src/utils/routes.js

@@ -31,8 +31,9 @@ export function convertRouter(constantRoutes) {
                     path = route.component.slice(1)
                 } else {
                     path = route.component
+                    console.log('path' + path)
                 }
-                route.component = (resolve) => require([`@/${path}`], resolve)
+                route.component = (resolve) => require([`${path}`], resolve)
             }
         }
         if (route.children && route.children.length)
@@ -40,6 +41,8 @@ export function convertRouter(constantRoutes) {
 
         if (route.children && route.children.length === 0) delete route.children
 
+        console.log("aaaaaaaaaaaaaaaaaaa", route)
+
         return route
     })
 }

+ 12 - 2
src/vab/plugins/permissions.js

@@ -18,14 +18,20 @@ router.beforeEach(async(to, from, next) => {
     if (!loginInterception) hasToken = true
 
     if (hasToken) {
-        // debugger;
+        console.log(1)
         if (to.path === '/login') {
+            console.log(3)
             next({ path: '/' })
         } else {
+            console.log(4)
+
+            console.log(store)
+            console.log(store.getters)
             const hasRoles =
                 store.getters['acl/admin'] ||
                 store.getters['acl/role'].length > 0 ||
                 store.getters['acl/ability'].length > 0
+            console.log(hasRoles)
             if (hasRoles) {
                 next()
             } else {
@@ -43,13 +49,17 @@ router.beforeEach(async(to, from, next) => {
                     } else if (authentication === 'all') {
                         accessRoutes = await store.dispatch('routes/setAllRoutes')
                     }
+
+                    console.log("aaaaaaaaaaa", accessRoutes)
                     accessRoutes.forEach((item) => {
                         router.addRoute(item)
                     })
-
+                    console.log("bbbbbbbbbbb", accessRoutes)
                     next({...to, replace: true })
                 } catch {
                     await store.dispatch('user/resetAll')
+
+                    console.log(recordRoute)
                     if (recordRoute)
                         next({
                             path: '/login',