Browse Source

Merge branch 'master' of http://192.168.2.241:3000/zxh/myyz

zxh 1 year ago
parent
commit
09e051aab6
3 changed files with 102 additions and 80 deletions
  1. 49 30
      src/router/_import.js
  2. 15 14
      src/router/index.js
  3. 38 36
      src/router/routes.js

+ 49 - 30
src/router/_import.js

@@ -1,39 +1,58 @@
-export default file => {
+export default (file) => {
   // console.log(file);
   // console.log(file);
-  return map[file] || null
-}
+  return map[file] || null;
+};
 const map = {
 const map = {
-  Layout: () => import('@/layout'),
-  Dashboard: () => import('@/views/currentSystem/dashboard'), // 首页
-  currentSystem: () => import('@/views/currentSystem/index'), // 当前系统的路由
-  Map: () => import('@/views/zhpt/index'),
-  funMap: () => import('@/views/currentSystem/map/funCom/index'),
+  Layout: () => import("@/layout"),
+  Dashboard: () => import("@/views/currentSystem/dashboard"), // 首页
+  currentSystem: () => import("@/views/currentSystem/index"), // 当前系统的路由
+  Map: () => import("@/views/zhpt/index"),
+  funMap: () => import("@/views/currentSystem/map/funCom/index"),
   // 系统权限
   // 系统权限
-  userManage: () => import('@/views/currentSystem/authorityManagement/userRights/index'), // 用户管理
-  roleManage: () => import('@/views/currentSystem/authorityManagement/rolePermission/index'), // 角色管理
-  journalManage: () => import('@/views/currentSystem/authorityManagement/journal/index'), // 日志管理
-  userAnalysis: () => import('@/views/currentSystem/authorityManagement/userAnalysis/index'), // 用户分析
-  appManage: () => import('@/views/currentSystem/authorityManagement/APPV/index'), // APP管理
-  ModulesManage: () => import('@/views/currentSystem/authorityManagement/modulesManage/index'), // 模块管理
-  departmentManage: () => import('@/views/currentSystem/authorityManagement/section/index'), // 单位管理
-  serviceManage: () => import('@/views/currentSystem/authorityManagement/serviceConfig/index'), // 服务配置
-  moduleAnalysis: () => import('@/views/currentSystem/authorityManagement/moduleAnalysis/index'), // 模块分析
+  userManage: () =>
+    import("@/views/currentSystem/authorityManagement/userRights/index"), // 用户管理
+  roleManage: () =>
+    import("@/views/currentSystem/authorityManagement/rolePermission/index"), // 角色管理
+  journalManage: () =>
+    import("@/views/currentSystem/authorityManagement/journal/index"), // 日志管理
+  userAnalysis: () =>
+    import("@/views/currentSystem/authorityManagement/userAnalysis/index"), // 用户分析
+  appManage: () =>
+    import("@/views/currentSystem/authorityManagement/APPV/index"), // APP管理
+  ModulesManage: () =>
+    import("@/views/currentSystem/authorityManagement/modulesManage/index"), // 模块管理
+  departmentManage: () =>
+    import("@/views/currentSystem/authorityManagement/section/index"), // 单位管理
+  serviceManage: () =>
+    import("@/views/currentSystem/authorityManagement/serviceConfig/index"), // 服务配置
+  moduleAnalysis: () =>
+    import("@/views/currentSystem/authorityManagement/moduleAnalysis/index"), // 模块分析
 
 
   // 区域计量
   // 区域计量
-  zoningManage: () => import('@/views/currentSystem/regionalMetering/DMAManage'), // DMA分区
-
+  zoningManage: () =>
+    import("@/views/currentSystem/regionalMetering/DMAManage"), // DMA分区
 
 
   //DMA分区子系统 /shiYuan//leakageRate
   //DMA分区子系统 /shiYuan//leakageRate
-  DMAHomePage: () => import('@/views/currentSystem/regionalMetering/DMAHomePage'), // DMA分区首页
-  sheetsForObserve: () => import('@/views/currentSystem/regionalMetering/zone/sheetsForObserve'), // 区域视察表
-  minStroomAnalyse: () => import('@/views/shiYuan/statisticalAnalysis/minStroomAnalyse/widget'), // 夜间最小流量
-  minuteWaterReport: () => import('@/views/currentSystem/regionalMetering/statisticalReport/minuteWaterReport'), // 统计报表-分时用水统计
-  waterSupplyReport:()=> import('@/views/shiYuan/statisticalAnalysis/waterSupplyReport/widget'), // 供水量报表
-  leakageRate: () => import('@/views/shiYuan/statisticalAnalysis/leakageRate/widget'), // 统计分析-漏损率指标分析
-  dayilyReport: () => import('@/views/shiYuan/monitoringCenter/dayilyReport/widget'), // 监测日报
-
+  DMAHomePage: () =>
+    import("@/views/currentSystem/regionalMetering/DMAHomePage"), // DMA分区首页
+  sheetsForObserve: () =>
+    import("@/views/currentSystem/regionalMetering/zone/sheetsForObserve"), // 区域视察表
+  minStroomAnalyse: () =>
+    import("@/views/shiYuan/statisticalAnalysis/minStroomAnalyse/widget"), // 夜间最小流量
+  minuteWaterReport: () =>
+    import(
+      "@/views/currentSystem/regionalMetering/statisticalReport/minuteWaterReport"
+    ), // 统计报表-分时用水统计
+  waterSupplyReport: () =>
+    import("@/views/shiYuan/statisticalAnalysis/waterSupplyReport/widget"), // 供水量报表
+  leakageRate: () =>
+    import("@/views/shiYuan/statisticalAnalysis/leakageRate/widget"), // 统计分析-漏损率指标分析
+  dayilyReport: () =>
+    import("@/views/shiYuan/monitoringCenter/dayilyReport/widget"), // 监测日报
 
 
   //配置管理
   //配置管理
-  indicatorsManage: () => import('@/views/shiYuan/configManage/indicatorsManage/widget'), // 指标类型管理
-  waringTypeManage: () => import('@/views/shiYuan/configManage/waringTypeManage/widget'), // 报警类型管理
-}
+  indicatorsManage: () =>
+    import("@/views/shiYuan/configManage/indicatorsManage/widget"), // 指标类型管理
+  waringTypeManage: () =>
+    import("@/views/shiYuan/configManage/waringTypeManage/widget"), // 报警类型管理
+};

+ 15 - 14
src/router/index.js

@@ -1,20 +1,21 @@
-import Vue from 'vue'
-import Router from 'vue-router'
-import { constantRoutes } from './routes'
+import Vue from "vue";
+import Router from "vue-router";
+import { constantRoutes } from "./routes";
 
 
-Vue.use(Router)
-const routerMap = constantRoutes
-const createRouter = () => new Router({
-  // mode: 'history', // 控制url地址中是否显示#
-  scrollBehavior: () => ({ y: 0 }),
-  routes: routerMap
-})
+Vue.use(Router);
+const routerMap = constantRoutes;
+const createRouter = () =>
+  new Router({
+    // mode: 'history', // 控制url地址中是否显示#
+    scrollBehavior: () => ({ y: 0 }),
+    routes: routerMap,
+  });
 // 创建路由
 // 创建路由
-const router = createRouter()
+const router = createRouter();
 
 
 export function resetRouter() {
 export function resetRouter() {
-  const newRouter = createRouter()
-  router.matcher = newRouter.matcher // 重置 router
+  const newRouter = createRouter();
+  router.matcher = newRouter.matcher; // 重置 router
 }
 }
 
 
-export default router
+export default router;

+ 38 - 36
src/router/routes.js

@@ -1,12 +1,12 @@
 export const constantRoutes = [
 export const constantRoutes = [
   {
   {
-    path: '/login',
-    meta: { title: '登录' },
-    type: 'sys',
-    label: '',
-    icon: 'el-icon-star-on',
-    component: () => import('@/views/login/index'),
-    hidden: true
+    path: "/login",
+    meta: { title: "登录" },
+    type: "sys",
+    label: "",
+    icon: "el-icon-star-on",
+    component: () => import("@/views/login/index"),
+    hidden: true,
   },
   },
   // {
   // {
   //   path: '/wq',
   //   path: '/wq',
@@ -28,20 +28,20 @@ export const constantRoutes = [
   //   hidden: true
   //   hidden: true
   // },
   // },
   {
   {
-    path: '/404',
+    path: "/404",
     hidden: true,
     hidden: true,
-    component: () => import('@/views/404')
-  }
-]
+    component: () => import("@/views/404"),
+  },
+];
 // 404
 // 404
 export const ERROR = [
 export const ERROR = [
   {
   {
-    path: '*',
-    redirect: '/404',
-    hidden: true
-  }
-]
-import _import from './_import' // 获取组件的方法
+    path: "*",
+    redirect: "/404",
+    hidden: true,
+  },
+];
+import _import from "./_import"; // 获取组件的方法
 /**
 /**
  * 生成路由
  * 生成路由
  * @param {Array} routerlist 格式化路由
  * @param {Array} routerlist 格式化路由
@@ -49,44 +49,46 @@ import _import from './_import' // 获取组件的方法
  */
  */
 export function packageRouter(routerlist) {
 export function packageRouter(routerlist) {
   function extractIcon(icon) {
   function extractIcon(icon) {
-    let result
+    let result;
     if (icon !== null && icon) {
     if (icon !== null && icon) {
-      result = icon.substr(9)
-    } else result = ''
-    return `iconfont ${result}`
+      result = icon.substr(9);
+    } else result = "";
+    return `iconfont ${result}`;
   }
   }
-  const router = []
+  const router = [];
   // console.log('参数:' + JSON.stringify(routerlist))
   // console.log('参数:' + JSON.stringify(routerlist))
   if (Array.isArray(routerlist) && routerlist.length > 0) {
   if (Array.isArray(routerlist) && routerlist.length > 0) {
-    routerlist.forEach(e => {
+    routerlist.forEach((e) => {
       // console.log('routerList:' + JSON.stringify(e))
       // console.log('routerList:' + JSON.stringify(e))
-      if (e == null) { return }
+      if (e == null) {
+        return;
+      }
       let e_new = {
       let e_new = {
-        path: e.path || '',
+        path: e.path || "",
         name: e.name,
         name: e.name,
         id: e.pathId,
         id: e.pathId,
         type: e.type,
         type: e.type,
         label: e.label,
         label: e.label,
         icon: extractIcon(e.icon),
         icon: extractIcon(e.icon),
-        widgetid: e.widgetid || '',
+        widgetid: e.widgetid || "",
         component: _import(e.component),
         component: _import(e.component),
-        meta: e.meta && e.meta !== null && JSON.parse(e.meta)
-      }
+        meta: e.meta && e.meta !== null && JSON.parse(e.meta),
+      };
       if (e.childrens && e.childrens.length > 0) {
       if (e.childrens && e.childrens.length > 0) {
         e_new = Object.assign({}, e_new, {
         e_new = Object.assign({}, e_new, {
-          children: packageRouter(e.childrens)
-        })
+          children: packageRouter(e.childrens),
+        });
       }
       }
       if (e.redirect) {
       if (e.redirect) {
-        e_new = Object.assign({}, e_new, { redirect: e.redirect })
+        e_new = Object.assign({}, e_new, { redirect: e.redirect });
       }
       }
-      if (e.path === '/map') {
-        e_new = Object.assign({}, e_new, { hidden: true })
+      if (e.path === "/map") {
+        e_new = Object.assign({}, e_new, { hidden: true });
       }
       }
-      router.push(e_new)
-    })
+      router.push(e_new);
+    });
   } else {
   } else {
     // console.log('JSON无数据')
     // console.log('JSON无数据')
   }
   }
-  return router
+  return router;
 }
 }