Newer
Older
operation_web / src / router / index.js
import Vue from "vue";
import Router from "vue-router";
import store from "@/store";
import { getSession, removeSession, message } from "./../util/item";

const routerPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error => error);
};

Vue.use(Router);
import axios from "axios";
import qs from "qs";

Vue.prototype.$axios = axios; //全局注册,使用方法为:this.$axios
Vue.prototype.qs = qs; //全局注册,使用方法为:this.qs
const router = new Router({
  routes: [
    {
      path: "/index",
      name: "index",
      component: resolve => require(["@/components/index.vue"], resolve),
      children: [
        {
          path: "/welcome",
          name: "welcome",
          component: resolve => require(["@/components/welcome"], resolve)
        },
        {
          path: "/overview",
          name: "overview",
          component: resolve => require(["@/components/overview"], resolve)
        },
        {
          path: "/site/previewOfSiteStatus", //站点状况预览图--站点状况预览图
          name: "PreviewOfSiteStatus",
          component: resolve =>
            require(["@/components/site/previewOfSiteStatus"], resolve)
        },
        {
          path: "/newFiber/NewFiberSearch", //新烽查询系统
          name: "NewFiberSearch",
          component: resolve =>
            require(["@/components/newFiber/NewFiberSearch"], resolve)
        },
        {
          path: "/configure/AlarmConfiguration", // 配置中心--报警配置
          name: "AlarmConfiguration",
          component: resolve =>
            require(["@/components/configure/AlarmConfiguration"], resolve)
        },
        {
          path: "/configure/PushRules", // 配置中心--推送规则
          name: "PushRules",
          component: resolve =>
            require(["@/components/configure/PushRules"], resolve)
        },
        {
          path: "/configure/AlarmLog", // 配置中心--报警日志
          name: "AlarmLog",
          component: resolve =>
            require(["@/components/configure/AlarmLog"], resolve)
        },
        {
          path: "/configure/PatrolConfiguration", // 配置中心--巡检配置
          name: "PatrolConfiguration",
          component: resolve =>
            require(["@/components/configure/PatrolConfiguration"], resolve)
        },
        {
          path: "/ConfigManager/project", // 配置管理--项目设置
          name: "ProjectConfigManager",
          component: resolve =>
            require(["@/components/ConfigManager/project"], resolve)
        },
        {
          path: "/ConfigManager/SiteManagement", // 配置管理--站点设置
          name: "SiteManagement",
          component: resolve =>
            require(["@/components/ConfigManager/SiteManagement"], resolve)
        },
        {
          path: "/ConfigManager/device", // 配置管理--设备管理
          name: "DeviceConfigManager",
          component: resolve =>
            require(["@/components/ConfigManager/device"], resolve)
        },
        {
          path: "/ConfigManager/factor", // 配置管理--因子管理
          name: "FactorConfigManager",
          component: resolve =>
            require(["@/components/ConfigManager/factor"], resolve)
        },
        {
          path: "/ConfigManager/RtuConfig", // 配置管理--rtu配置
          name: "RtuConfig",
          component: resolve =>
            require(["@/components/ConfigManager/RtuConfig"], resolve)
        },
        {
          path: "/ConfigManager/userGroup", // 配置管理--用户组管理
          name: "UserGroup",
          component: resolve =>
            require(["@/components/ConfigManager/userGroup"], resolve)
        },
        {
          path: "/MessageManagement/MessageQuery", // 消息管理--消息查询
          name: "MessageQuery",
          component: resolve =>
            require(["@/components/MessageManagement/MessageQuery"], resolve)
        },
        {
          path: "/MessageManagement/MessageStatistics", // 消息管理--消息统计
          name: "MessageStatistics",
          component: resolve =>
            require([
              "@/components/MessageManagement/MessageStatistics"
            ], resolve)
        },
        {
          path: "/DataAnalysis/dataScreening", // 数据分析--数据总览
          name: "DataScreening",
          component: resolve =>
            require(["@/components/DataAnalysis/dataScreening"], resolve)
        },
        {
          path: "/DataAnalysis/StatisticalReport", // 数据分析--统计报表
          name: "StatisticalReport",
          component: resolve =>
            require(["@/components/DataAnalysis/StatisticalReport"], resolve)
        },
        {
          path: "/ServiceWatch/serverManage", // 服务监控-服务器管理
          name: "ServerManage",
          component: resolve => require(["@/components/ServiceWatch/serverManage"], resolve)
        },
        {
          path: "/ServiceWatch/detail", // 服务监控-服务器详情
          name: "ServiceWatch",
          component: resolve => require(["@/components/ServiceWatch/serverDetail"], resolve),
          redirect: '/ServiceWatch/serverDetail',
          children: [
            {
              path: "/ServiceWatch/serverDetail", // 服务监控-服务器详情
              name: "ServerDetail",
              component: resolve => require(["@/components/ServiceWatch/components/detail"], resolve)
            },
            {
              path: "/ServiceWatch/serverMonitor", // 服务监控-服务器监控
              name: "ServerMonitor",
              component: resolve => require(["@/components/ServiceWatch/components/monitor"], resolve)
            },
            {
              path: "/ServiceWatch/serverApplied", // 服务监控-服务应用
              name: "ServerApplied",
              component: resolve => require(["@/components/ServiceWatch/components/applied"], resolve)
            },
            {
              path: "/ServiceWatch/nginxWatch", // 服务监控-nginx监控
              name: "NginxWatch",
              component: resolve => require(["@/components/ServiceWatch/components/nginx"], resolve)
            }
          ]
        },
        {
          path: "/Engineering/Nowfault", // 查询实时故障数据
          name: "Nowfault",
          component: resolve =>
            require(["@/components/Engineering/Nowfault"], resolve)
        },
        {
          path: "/Engineering/HistoricalFault", // 查询历史故障数据
          name: "HistoricalFault",
          component: resolve =>
            require(["@/components/Engineering/HistoricalFault"], resolve)
        },
        {
          path: "/Engineering/MyHomework", // 查询历史故障数据
          name: "MyHomework",
          component: resolve =>
            require(["@/components/Engineering/MyHomework"], resolve)
        },
        {
          path: "/LED/LEDConfig", //LED屏
          name: "LEDConfig",
          component: resolve => require(["@/components/LED/LEDConfig"], resolve)
        },
        {
          path: "/Data/connectManager", //数据滤网-连接管理
          name: "connectManager",
          component: resolve => require(["@/components/shujulvwang/connectManager"], resolve)
        },
        {
          path: "/quality/dataProcess/scheduledTasks", //数据滤网-任务列表
          name: "scheduledTasks",
          component: resolve => require(["@/components/shujulvwang/dailyDatas"], resolve),
          children: [{
            path: '/quality/daily',
            name: 'daily',
            component: resolve => require(["@/components/shujulvwang/daily"], resolve),
           
        }, {
            path: '/dailyWindow',
            name: 'dailyModel',
            component: resolve => require(["@/components/shujulvwang/dailyModel"], resolve),

            
        }]
        },
        {
          path: '/filter/dataAnalysis/dataBrowsing',//数据滤网-数据浏览
          name: 'dataBrowsing',
          component: resolve => require(["@/components/shujulvwang/dataBrowsing"], resolve),

        
      },
      {
        path: '/filter/dataAnalysis/dataBrowsingQuery',//数据滤网-数据浏览(弹框页面)
        name: 'dataBrowsingQuery',
        component: resolve => require(["@/components/shujulvwang/dataBrowsingQuery"], resolve),

      },
      {
        path: '/modelManager/timeSeriesPrediction',//数据滤网-时序预测
        name: 'timeSeriesPrediction',
        component: resolve => require(["@/components/shujulvwang/timeSeriesPrediction"], resolve),

    },
    {
      'path': '/quality/ruleEngine/alarmHistory',
      'name': 'alarmHistory',
      component: resolve => require(["@/components/shujulvwang/ruleAlarm"], resolve),

  },
    {
      path: '/quality/ruleEngine/ruleList',//数据滤网-规则列表
      name: 'ruleList',
      component: resolve => require(["@/components/shujulvwang/ruleAddendum"], resolve),

      children: [{
          path: '/ruleModel',
          name: 'ruleModel',
          component: resolve => require(["@/components/shujulvwang/ruleModel"], resolve),

      }]
  },
        {
          path: "/sys/user", //用户管理
          name: "user",
          component: resolve => require(["@/components/sys/user"], resolve)
        },
        {
          path: "/sys/menu", //菜单管理
          name: "menu",
          component: resolve => require(["@/components/sys/menu"], resolve)
        },
        {
          path: "/sys/org", //组织信息
          name: "org",
          component: resolve => require(["@/components/sys/org"], resolve)
        },
        {
          path: "/sys/role", //角色管理
          name: "role",
          component: resolve => require(["@/components/sys/role"], resolve)
        }
      ]
    },
    {
      path: "/Login",
      name: "login",
      component: resolve => require(["@/components/login"], resolve)
    },
    // {
    //   path: "/",
    //   redirect: "/Login"
    // },
    {
      path: "*",
      redirect: "/index"
    }
  ]
});
router.beforeEach((to, from, next) => {
  /*   使用过程为,
  先判断vuex里面一条数据,
  判断是否登陆 */
  if (to.name === "login") {
    next();
  } else if (JSON.parse(getSession("logins")) === "true") {
    if (!store.state.common.allDept.length) {
      store
        .dispatch("common/getAllDept")
        .then(res => {
          store.dispatch("common/getAllCity").then(() => {
            // store.dispatch("common/getAllCity");
          });
        })
        .catch(e => {
          console.log(777, e);
          removeSession("logins");
          next("/Login");
        });
    }
    next();
  } else {
    message({
      data: {
        code: 1,
        msg: "请先登录在进行操作!"
      }
    });
    next(`/Login`);
  }
});
export default router;