Commit 87c753b3 authored by jiaxu.yan's avatar jiaxu.yan

feat : 路由更新

parent c33ffbf0
// 创建路由为历史
import { createRouter, createWebHistory } from "vue-router";
import LoginPage from '@/views/login/login.vue'
import HomePage from '@/views/home.vue'
import AboutPage from '@/components/About.vue'
import store from '@/store'
import LoginPage from "@/views/login/login.vue";
import HomePage from "@/views/home.vue";
import AboutPage from "@/components/About.vue";
import store from "@/store";
//import nProgress from 'nprogress'
import screenDisplay from '@/views/Gis/screenDisplay.vue'
import iframe from '@/views/iframe.vue'
import screenDisplay from "@/views/Gis/screenDisplay.vue";
import iframe from "@/views/iframe.vue";
//import remote from './remote'
// 定义路由规则
const routes = [
{
path: '/',
component: HomePage
path: "/",
component: HomePage,
},
{
path: "/screenDisplay",
component: screenDisplay,
},
{
path: '/screenDisplay',
component: screenDisplay
},{
path:'/iframe',
name: 'iframe',
component: iframe
path: "/iframe",
name: "iframe",
component: iframe,
},
{
path: '/Login',
path: "/Login",
name: "/Login",
component: LoginPage
component: LoginPage,
},
{
path: '/Home',
path: "/Home",
name: "Home",
component: HomePage,
children: [
// ...remote,//远程控制
{
path: '/RealSupply',
name: 'RealSupplyPage',
component: () => import('@/views/RealPage/RealSupplyPage.vue'),
path: "/RealSupply",
name: "RealSupplyPage",
component: () => import("@/views/RealPage/RealSupplyPage.vue"),
meta: {
title: '首页-实时热源'
}
},{
path: '/RealTransfer',
name: '/RealTransPage',
component: () => import('@/views/RealPage/RealTransPage.vue'),
title: "首页-实时热源",
},
},
{
path: "/RealTransfer",
name: "/RealTransPage",
component: () => import("@/views/RealPage/RealTransPage.vue"),
meta: {
title: '实时换热站'
}
},{
path: '/RealPipe',
name: 'RealPipePage',
component: () => import('@/views/RealPage/RealPipePage.vue'),
title: "实时换热站",
},
},
{
path: "/RealPipe",
name: "RealPipePage",
component: () => import("@/views/RealPage/RealPipePage.vue"),
meta: {
title: '实时总管'
}
},{
path: '/RealBoiler',
name: 'RealBoilerPage',
component: () => import('@/views/RealPage/RealBoilerPage.vue'),
title: "实时总管",
},
},
{
path: "/RealBoiler",
name: "RealBoilerPage",
component: () => import("@/views/RealPage/RealBoilerPage.vue"),
meta: {
title: '实时锅炉'
}
},{
path: '/RealEnergy',
name: 'RealEnergyPage',
component: () => import('@/views/RealPage/RealEnergyPage.vue'),
title: "实时锅炉",
},
},
{
path: "/RealEnergy",
name: "RealEnergyPage",
component: () => import("@/views/RealPage/RealEnergyPage.vue"),
meta: {
title: '实时能耗'
}
title: "实时能耗",
},
},
// },{
// path: '/RealGas',
......@@ -100,398 +105,435 @@ const routes = [
// }
// },
{
path: '/PipeStatus',
name: 'PipeStatusPage',
component: () => import('@/views/StatusPage/PipeStatusPage.vue'),
path: "/PipeStatus",
name: "PipeStatusPage",
component: () => import("@/views/StatusPage/PipeStatusPage.vue"),
meta: {
title: '总管状态'
}
},{
path: '/BoilerStatus',
name: 'BoilerStatusPage',
component: () => import('@/views/StatusPage/BoilerStatusPage.vue'),
meta: {
title: '锅炉状态'
}
},{
path: '/TransferStatus',
name: 'TransferStatusPage',
component: () => import('@/views/StatusPage/TransferStatusPage.vue'),
title: "总管状态",
},
},
{
path: "/BoilerStatus",
name: "BoilerStatusPage",
component: () => import("@/views/StatusPage/BoilerStatusPage.vue"),
meta: {
title: '换热站状态'
}
},{
path: '/BoilerArtwork',
name: 'BoilerArtworkPage',
component: () => import('@/views/ArtworkPage/BoilerArtworkPage.vue'),
title: "锅炉状态",
},
},
{
path: "/TransferStatus",
name: "TransferStatusPage",
component: () => import("@/views/StatusPage/TransferStatusPage.vue"),
meta: {
title: '锅炉工艺图'
}
},{
path: '/MeasurementArtwork',
name: 'MeasurementArtworkPage',
component: () => import('@/views/ArtworkPage/MeasurementArtworkPage.vue'),
title: "换热站状态",
},
},
{
path: "/BoilerArtwork",
name: "BoilerArtworkPage",
component: () => import("@/views/ArtworkPage/BoilerArtworkPage.vue"),
meta: {
title: '计量站工艺图'
}
},{
path: '/AllBoilerArtwork',
name: 'AllBoilerArtworkPage',
component: () => import('@/views/ArtworkPage/AllBoilerArtworkPage.vue'),
title: "锅炉工艺图",
},
},
{
path: "/MeasurementArtwork",
name: "MeasurementArtworkPage",
component: () =>
import("@/views/ArtworkPage/MeasurementArtworkPage.vue"),
meta: {
title: '全景工艺图'
}
},{
path: '/TransferArtwork',
name: 'TransferArtworkPage',
component: () => import('@/views/ArtworkPage/TransferArtworkPage.vue'),
title: "计量站工艺图",
},
},
{
path: "/AllBoilerArtwork",
name: "AllBoilerArtworkPage",
component: () => import("@/views/ArtworkPage/AllBoilerArtworkPage.vue"),
meta: {
title: '换热站工艺图'
}
},{
path: '/AlarmStatus',
name: 'AlarmStatusPage',
component: () => import('@/views/AlarmPage/AlarmStatusPage.vue'),
title: "全景工艺图",
},
},
{
path: "/TransferArtwork",
name: "TransferArtworkPage",
component: () => import("@/views/ArtworkPage/TransferArtworkPage.vue"),
meta: {
title: '报警状态'
}
},{
path: '/Alarm',
name: 'AlarmInfoPage',
component: () => import('@/views/AlarmPage/AlarmInfoPage.vue'),
title: "换热站工艺图",
},
},
{
path: "/AlarmStatus",
name: "AlarmStatusPage",
component: () => import("@/views/AlarmPage/AlarmStatusPage.vue"),
meta: {
title: '报警信息'
}
},{
path: '/DataAnalysis',
name: 'DataAnalysisPage',
component: () => import('@/views/HandlerPage/DataAnalysisPage.vue'),
title: "报警状态",
},
},
{
path: "/Alarm",
name: "AlarmInfoPage",
component: () => import("@/views/AlarmPage/AlarmInfoPage.vue"),
meta: {
title: '能耗分析'
}
},{
path: '/EnergyConsumption',
name: 'EnergyConsumptionPage',
component: () => import('@/views/HandlerPage/EnergyConsumptionPage.vue'),
title: "报警信息",
},
},
{
path: "/DataAnalysis",
name: "DataAnalysisPage",
component: () => import("@/views/HandlerPage/DataAnalysisPage.vue"),
meta: {
title: '能耗排名'
}
},{
path: '/Handler/EnerpriseEnergyView',
name: 'EnerpriseEnergyView',
component: () => import('@/views/HandlerPage/EnerpriseEnergyView.vue'),
title: "能耗分析",
},
},
{
path: "/EnergyConsumption",
name: "EnergyConsumptionPage",
component: () =>
import("@/views/HandlerPage/EnergyConsumptionPage.vue"),
meta: {
title: '企业趋势图'
}
},{
path: '/Handler/TransferEnergyView',
name: 'EnergyViewPage',
component: () => import('@/views/HandlerPage/TransferEnergyView.vue'),
title: "能耗排名",
},
},
{
path: "/Handler/EnerpriseEnergyView",
name: "EnerpriseEnergyView",
component: () => import("@/views/HandlerPage/EnerpriseEnergyView.vue"),
meta: {
title: '换热站趋势图'
}
},{
path: '/Handler/QOQView',
name: 'QOQView',
component: () => import('@/views/HandlerPage/QOQ.vue'),
title: "企业趋势图",
},
},
{
path: "/Handler/TransferEnergyView",
name: "EnergyViewPage",
component: () => import("@/views/HandlerPage/TransferEnergyView.vue"),
meta: {
title: '用量环比'
}
},{
path: '/Handler/YOYView',
name: 'YOYView',
component: () => import('@/views/HandlerPage/YOY.vue'),
title: "换热站趋势图",
},
},
{
path: "/Handler/QOQView",
name: "QOQView",
component: () => import("@/views/HandlerPage/QOQ.vue"),
meta: {
title: '用量同比'
}
},{
path: '/HeatAnalysis',
name: 'HeatAnalysisPage',
component: () => import('@/views/Report/HeatAnalysisPage.vue'),
title: "用量环比",
},
},
{
path: "/Handler/YOYView",
name: "YOYView",
component: () => import("@/views/HandlerPage/YOY.vue"),
meta: {
title: '热量分析'
}
},{
path: '/Forecast',
name: 'ForecastPage',
component: () => import('@/views/Report/ForecastPage.vue'),
title: "用量同比",
},
},
{
path: "/HeatAnalysis",
name: "HeatAnalysisPage",
component: () => import("@/views/Report/HeatAnalysisPage.vue"),
meta: {
title: '明日预测'
}
},{
path: '/RealAnalysis',
name: 'RealAnalysisPage',
component: () => import('@/views/Report/RealAnalysisPage.vue'),
title: "热量分析",
},
},
{
path: "/Forecast",
name: "ForecastPage",
component: () => import("@/views/Report/ForecastPage.vue"),
meta: {
title: '实时热量分析'
}
},{
path: '/TransferEnergy',
name: 'TransferEnergyPage',
component: () => import('@/views/Report/TransferEnergyPage.vue'),
title: "明日预测",
},
},
{
path: "/RealAnalysis",
name: "RealAnalysisPage",
component: () => import("@/views/Report/RealAnalysisPage.vue"),
meta: {
title: '换热站能耗'
}
},{
path: '/AreaInfo',
name: 'AreaInfoPage',
component: () => import('@/views/Report/AreaInfoPage.vue'),
title: "实时热量分析",
},
},
{
path: "/TransferEnergy",
name: "TransferEnergyPage",
component: () => import("@/views/Report/TransferEnergyPage.vue"),
meta: {
title: '面积统计'
}
},{
path: '/TodayPatrol',
name: 'PatrolPage',
component: () => import('@/views/PatrolPage/TodayPatrolPage.vue'),
title: "换热站能耗",
},
},
{
path: "/AreaInfo",
name: "AreaInfoPage",
component: () => import("@/views/Report/AreaInfoPage.vue"),
meta: {
title: '今日巡更'
}
},{
path: '/HisPatrol',
name: 'HisPatrolPage',
component: () => import('@/views/PatrolPage/HisPatrolPage.vue'),
title: "面积统计",
},
},
{
path: "/TodayPatrol",
name: "PatrolPage",
component: () => import("@/views/PatrolPage/TodayPatrolPage.vue"),
meta: {
title: '巡更历史'
}
},{
path: '/HeatUser',
name: 'HeatUserPage',
component: () => import('@/views/HeatUserPage/HeatUserPage.vue'),
title: "今日巡更",
},
},
{
path: "/HisPatrol",
name: "HisPatrolPage",
component: () => import("@/views/PatrolPage/HisPatrolPage.vue"),
meta: {
title: '热用户'
}
},{
path: '/HeatUser/Tap',
name: 'TapPage',
component: () => import('@/views/HeatUserPage/TapPage.vue'),
title: "巡更历史",
},
},
{
path: "/HeatUser",
name: "HeatUserPage",
component: () => import("@/views/HeatUserPage/HeatUserPage.vue"),
meta: {
title: '阀门'
}
},{
path: '/History/Pipe',
name: 'HisPipe',
component: () => import('@/views/HistoryPage/HisPipePage.vue'),
title: "热用户",
},
},
{
path: "/HeatUser/Tap",
name: "TapPage",
component: () => import("@/views/HeatUserPage/TapPage.vue"),
meta: {
title: '总管历史数据'
}
},{
path: '/History/Boiler',
name: 'HisBoiler',
component: () => import('@/views/HistoryPage/HisBoilerPage.vue'),
title: "阀门",
},
},
{
path: "/History/Pipe",
name: "HisPipe",
component: () => import("@/views/HistoryPage/HisPipePage.vue"),
meta: {
title: '锅炉历史数据'
}
},{
path: '/History/Transfer',
name: 'HisTransfer',
component: () => import('@/views/HistoryPage/HisTransPage.vue'),
title: "总管历史数据",
},
},
{
path: "/History/Boiler",
name: "HisBoiler",
component: () => import("@/views/HistoryPage/HisBoilerPage.vue"),
meta: {
title: '换热站历史数据'
}
},{
path: '/History/Gas',
name: 'HisGas',
component: () => import('@/views/HistoryPage/HisGasPage.vue'),
title: "锅炉历史数据",
},
},
{
path: "/History/Transfer",
name: "HisTransfer",
component: () => import("@/views/HistoryPage/HisTransPage.vue"),
meta: {
title: '燃气历史数据'
}
},{
path: '/History/Water',
name: 'HisWater',
component: () => import('@/views/HistoryPage/HisWaterPage.vue'),
title: "换热站历史数据",
},
},
{
path: "/History/Gas",
name: "HisGas",
component: () => import("@/views/HistoryPage/HisGasPage.vue"),
meta: {
title: '水表历史数据'
}
},{
path: '/History/Heat',
name: 'HisHeat',
component: () => import('@/views/HistoryPage/HisHeatPage.vue'),
title: "燃气历史数据",
},
},
{
path: "/History/Water",
name: "HisWater",
component: () => import("@/views/HistoryPage/HisWaterPage.vue"),
meta: {
title: '热表历史数据'
}
},{
path: '/History/Electric',
name: 'HisElectric',
component: () => import('@/views/HistoryPage/HisElecPage.vue'),
title: "水表历史数据",
},
},
{
path: "/History/Heat",
name: "HisHeat",
component: () => import("@/views/HistoryPage/HisHeatPage.vue"),
meta: {
title: '电表历史数据'
}
},{
path: '/Handler/Overview',
name: 'Overview',
component: () => import('@/views/HandlerPage/OverviewPage.vue'),
title: "热表历史数据",
},
},
{
path: "/History/Electric",
name: "HisElectric",
component: () => import("@/views/HistoryPage/HisElecPage.vue"),
meta: {
title: '数据总览'
}
},{
path: '/Handler/EnergyView',
name: 'EnergyView',
component: () => import('@/views/HandlerPage/QOQ.vue'),//EnergyViewPage
title: "电表历史数据",
},
},
{
path: "/Handler/Overview",
name: "Overview",
component: () => import("@/views/HandlerPage/OverviewPage.vue"),
meta: {
title: '趋势图'
}
},{
path: '/Remote/Boiler',
name: 'BoilerRemotePage',
component: () => import('@/views/RemotePage/BoilerControlPage.vue'),
title: "数据总览",
},
},
{
path: "/Handler/EnergyView",
name: "EnergyView",
component: () => import("@/views/HandlerPage/QOQ.vue"), //EnergyViewPage
meta: {
title: '锅炉远程控制'
}
title: "趋势图",
},
},
{
path: '/Remote/ZdlmSelfTest',
name: 'ZdlmSelfTestPage',
component: () => import('@/views/RemotePage/ZdlmSelfTest.vue'),
path: "/Remote/Boiler",
name: "BoilerRemotePage",
component: () => import("@/views/RemotePage/BoilerControlPage.vue"),
meta: {
title: '电动阀自检'
}
title: "锅炉远程控制",
},
},
{
path: '/Remote/Transfer',
name: 'TransferRemotePage',
component: () => import('@/views/RemotePage/TransControlPage.vue'),
path: "/Remote/ZdlmSelfTest",
name: "ZdlmSelfTestPage",
component: () => import("@/views/RemotePage/ZdlmSelfTest.vue"),
meta: {
title: '换热站远程控制'
}
},{
path: '/Remote/TransferPump',
name: 'TransferPumpPage',
component: () => import('@/views/RemotePage/TransferPumpPage.vue'),
title: "电动阀自检",
},
},
{
path: "/Remote/Transfer",
name: "TransferRemotePage",
component: () => import("@/views/RemotePage/TransControlPage.vue"),
meta: {
title: '循环泵压差控制'
}
},{
path: '/Video',
name: 'VideoPage',
component: () => import('@/views/Video/VideoViewPage.vue'),
title: "换热站远程控制",
},
},
{
path: "/Remote/TransferPump",
name: "TransferPumpPage",
component: () => import("@/views/RemotePage/TransferPumpPage.vue"),
meta: {
title: '视频监控'
}
},{
path: '/Scheduling/WeatherManage',
name: 'WeatherManage',
component: () => import('@/views/Scheduling/WeatherManage.vue'),
title: "循环泵压差控制",
},
},
{
path: "/Video",
name: "VideoPage",
component: () => import("@/views/Video/VideoViewPage.vue"),
meta: {
title: '气象干预'
}
},{
path: '/Scheduling/EnergyManage',
name: 'EnergyManage',
component: () => import('@/views/Scheduling/EnergyManage.vue'),
title: "视频监控",
},
},
{
path: "/Scheduling/EnergyManage",
name: "EnergyManagePage",
component: () => import("@/views/SchedulingPage/EnergyManagePage.vue"),
meta: {
title: '能源消耗'
}
},{
path: '/Scheduling/AnalysisManage',
name: 'AnalysisManage',
component: () => import('@/views/Scheduling/AnalysisManage.vue'),
title: "能源消耗",
},
},
{
path: "/Scheduling/WeatherManage",
name: "WeatherManagePage",
component: () => import("@/views/SchedulingPage/WeatherManagePage.vue"),
meta: {
title: '生产与结算数据分析表'
}
},{
path: '/Scheduling/ConfigBoiler',
name: 'ConfigBoiler',
component: () => import('@/views/Scheduling/ConfigBoiler.vue'),
title: "气象干预",
},
},
{
path: "/Scheduling/AnnualParam",
name: "AnnualParamPage",
component: () => import("@/views/SchedulingPage/AnnualParamPage.vue"),
meta: {
title: '锅炉参数配置'
}
},{
path: '/Scheduling/Phenomenon',
name: 'Phenomenon',
component: () => import('@/views/Scheduling/Phenomenon.vue'),
title: "年度参数",
},
},
{
path: "/Scheduling/ConfigBoiler",
name: "ConfigBoiler",
component: () => import("../views/SchedulingPage/ConfigBoilerPage.vue"),
meta: {
title: '天气工况'
}
},{
path: '/Scheduling/InstantHeat',
name: 'InstantHeat',
component: () => import('@/views/Scheduling/InstantHeat.vue'),
title: "参数配置",
},
},
{
path: "/Scheduling/WindManage",
name: "WindManage",
component: () => import("../views/SchedulingPage/WindManagePage.vue"),
meta: {
title: '瞬时热量对比配置'
}
},{
path: '/Scheduling/WindManage',
name: 'WindManage',
component: () => import('@/views/Scheduling/WindManage.vue'),
title: "风力配置管理",
},
},
{
path: "/Scheduling/Phenomenon",
name: "Phenomenon",
component: () => import("../views/SchedulingPage/PhenomenonPage.vue"),
meta: {
title: '风力配置管理'
}
},{
path: '/Scheduling/AnnualParam',
name: 'AnnualParam',
component: () => import('@/views/Scheduling/AnnualParam.vue'),
title: "天气工况管理",
},
},
{
path: "/Scheduling/InstantHeat",
name: "InstantHeatPage",
component: () => import("@/views/SchedulingPage/InstantHeatPage.vue"),
meta: {
title: '年度参数管理'
}
}
]
title: "瞬时热量对比配置",
},
},
],
},
{
path: '/About',
path: "/About",
name: "/About",
component: AboutPage
component: AboutPage,
},
{
path:'/GisHome',
name:'/GisHome',
component: () => import('@/views/Gis/screenDisplay.vue'),
path: "/GisHome",
name: "/GisHome",
component: () => import("@/views/Gis/screenDisplay.vue"),
meta: {
title: '地图'
}
title: "地图",
},
},
//捕获404路由
{
path: '/:pathMatch(.*)*',
name: 'NotFound',
component: () => import('@/views/404.vue')
path: "/:pathMatch(.*)*",
name: "NotFound",
component: () => import("@/views/404.vue"),
},
{
path:'/TransferArt',
name:'/TransferArt',
component: () => import('@/components/art/TransferArt.vue'),
path: "/TransferArt",
name: "/TransferArt",
component: () => import("@/components/art/TransferArt.vue"),
meta: {
title: '换热站工艺图'
}
title: "换热站工艺图",
},
},
{
path:'/BoilerArt',
name:'/BoilerArt',
component: () => import('@/components/art/BoilerArt.vue'),
path: "/BoilerArt",
name: "/BoilerArt",
component: () => import("@/components/art/BoilerArt.vue"),
meta: {
title: '锅炉工艺图'
}
title: "锅炉工艺图",
},
},
{
path: '/AllBoilerArt',
name: 'AllBoilerArt',
component: () => import('@/components/art/AllBoilerArt.vue'),
path: "/AllBoilerArt",
name: "AllBoilerArt",
component: () => import("@/components/art/AllBoilerArt.vue"),
meta: {
title: '锅炉全景工艺图'
}
title: "锅炉全景工艺图",
},
},
{
path: '/MeasurementArt',
name: 'MeasurementArt',
component: () => import('@/components/art/MeasurementArt.vue'),
path: "/MeasurementArt",
name: "MeasurementArt",
component: () => import("@/components/art/MeasurementArt.vue"),
meta: {
title: '计量站全景工艺图'
}
title: "计量站全景工艺图",
},
},
{
path: '/Visualizations',
name: 'Visualizations',
component: () => import('@/views/Visualizations/index.vue'),
path: "/Visualizations",
name: "Visualizations",
component: () => import("@/views/Visualizations/index.vue"),
meta: {
title: '可视化'
}
}
]
title: "可视化",
},
},
];
//创建路由实例对象
const router = createRouter({
routes,
history: createWebHistory(import.meta.env.BASE_URL)
})
history: createWebHistory(import.meta.env.BASE_URL),
});
// // 使用路由守卫来判断是否已经加载了Home页面
// let homeLoaded = false
......@@ -507,8 +549,7 @@ const router = createRouter({
// }
// })
let isgetOrg = false
let isgetOrg = false;
//全局前置路由守卫
router.beforeEach(async (to, from, next) => {
//store.dispatch("onLoading", true);
......@@ -519,34 +560,33 @@ router.beforeEach(async (to, from, next) => {
const token = store.getters.getToken();
//console.log(token);
//如果未登录跳转到登录页面
if (!userInfo && to.path !== '/login') return next('/login')
if (!userInfo && to.path !== "/login") return next("/login");
//如果已登录避免重复登录
if (userInfo && to.path == '/login') {
return next({ path: from.path ? from.path : '/' })
if (userInfo && to.path == "/login") {
return next({ path: from.path ? from.path : "/" });
}
let hasNewRoutes = false
let hasNewRoutes = false;
//如果用户登录成功,调用Vuex方法,存储用户信息
if (userInfo && !isgetOrg) {
try
{
const res = await store.dispatch('getOrg')
isgetOrg = true
try {
const res = await store.dispatch("getOrg");
isgetOrg = true;
} catch (error) {
store.commit("clearUserInfo", "");
return next('/login')
return next("/login");
}
}
//手动指定路由
//如果确实有新路由加入手动指定路由,否则直接放行
hasNewRoutes ? next(to.fullPath) : next()
hasNewRoutes ? next(to.fullPath) : next();
//next()
})
});
// router.afterEach((to, from) => {
// store.dispatch("onLoading", false);
// })
// 共享路由实例对象
export default router
\ No newline at end of file
export default router;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment