3067418132@qq.com 3 weeks ago
parent
commit
eb3216bb25
  1. 8
      src/router/index.js
  2. 116
      src/store/modules/permission.js
  3. 2
      src/views/centerairC/sysMonitor/hostDetails.vue
  4. 2
      src/views/centerairC/sysMonitor/index.vue
  5. 3190
      src/views/components/monitor/centerairMonitor.vue
  6. 2584
      src/views/components/monitor/hotWaterMonitor.vue
  7. 648
      src/views/components/monitor/index.vue
  8. 2
      src/views/hotWater/waterMonitor/index.vue

8
src/router/index.js

@ -96,6 +96,14 @@ export const constantRoutes = [
component: () => import("@/views/bigScreen/bigScreen"),
meta: { title: "大屏总览", icon: "screen" },
},
// 轮播监测
{
path: '/path/to/monitor/:page?',
name:"monitor",
hidden: true,
component: () => import("@/views/components/monitor/index"),
meta: { title: "系统监测", icon: "monitor" },
},
];
// 动态路由,基于用户权限动态去加载

116
src/store/modules/permission.js

@ -55,14 +55,6 @@ const permission = {
// );
// 定义要添加的多个路由对象数组
const additionalRoutes = [
{
path: "/monitorCenter",
name: "monitorCenter",
hidden: true,
component: () =>
import("@/views/centerairC/sysMonitor/monitorCenter"),
meta: { title: "系统监测", icon: "screen" },
},
{
path: "/hostDetails",
name: "hostDetails",
@ -91,90 +83,6 @@ const permission = {
// console.log("不满足条件");
}
// // 风柜
// const result2 = sidebarRoutes.find(
// (item) => item.name === "AircAndWindc"
// );
// if (result2) {
// // 定义要添加的多个路由对象数组
// const additionalRoutes2 = [
// {
// path: "/asSysMonitorDetails",
// name: "asSysMonitorDetails",
// hidden: true,
// component: () =>
// import(
// "@/views/aircAndWindc/awSysMonitor/asSysMonitorDetails"
// ),
// meta: { title: "系统监控", icon: "screen" },
// },
// // 可以继续添加更多路由对象
// ];
// // 循环添加额外的路由对象到各路由数组
// additionalRoutes2.forEach((route) => {
// sidebarRoutes.push(route);
// rewriteRoutes.push(route);
// asyncRoutes.push(route);
// });
// } else {
// // console.log("不满足条件");
// }
// // 锅炉
// const result3 = sidebarRoutes.find(
// (item) => item.name === "BoilerSys"
// );
// if (result3) {
// // 定义要添加的多个路由对象数组
// const additionalRoutes3 = [
// {
// path: "/boilerMonitorDetails",
// name: "boilerMonitorDetails",
// hidden: true,
// component: () =>
// import(
// "@/views/boilerSys/boilerMonitor/boilerMonitorDetails"
// ),
// meta: { title: "锅炉监控", icon: "screen" },
// },
// {
// path: "/hotWaterBoilerDetails",
// name: "hotWaterBoilerDetails",
// hidden: true,
// component: () =>
// import(
// "@/views/boilerSys/hotWaterBoiler/hotWaterBoilerDetails"
// ),
// meta: { title: "热水锅炉监控", icon: "screen" },
// },
// {
// path: "/heatingPumpDetails",
// name: "heatingPumpDetails",
// hidden: true,
// component: () =>
// import("@/views/boilerSys/heatingPump/heatingPumpDetails"),
// meta: { title: "采暖泵监控", icon: "screen" },
// },
// {
// path: "/steamHeatingDetails",
// name: "steamHeatingDetails",
// hidden: true,
// component: () =>
// import("@/views/boilerSys/steamHeating/steamHeatingDetails"),
// meta: { title: "蒸汽采暖运行监控", icon: "screen" },
// },
// // 可以继续添加更多路由对象
// ];
// // 循环添加额外的路由对象到各路由数组
// additionalRoutes3.forEach((route) => {
// sidebarRoutes.push(route);
// rewriteRoutes.push(route);
// asyncRoutes.push(route);
// });
// } else {
// // console.log("不满足条件");
// }
// 热水
const result4 = sidebarRoutes.find(
(item) => item.name === "HotWater"
@ -202,30 +110,6 @@ const permission = {
// console.log("不满足条件");
}
// // 温度监测
// const result5 = sidebarRoutes.find((item) => item.name === "TemSys");
// if (result5) {
// // 定义要添加的多个路由对象数组
// const additionalRoutes5 = [
// {
// path: "/temMonitorDeatils",
// name: "temMonitorDeatils",
// hidden: true,
// component: () =>
// import("@/views/temSys/temMonitor/temMonitorDeatils"),
// meta: { title: "温度监测", icon: "screen" },
// },
// ];
// // 循环添加额外的路由对象到各路由数组
// additionalRoutes5.forEach((route) => {
// sidebarRoutes.push(route);
// rewriteRoutes.push(route);
// asyncRoutes.push(route);
// });
// } else {
// // console.log("不满足条件");
// }
commit("SET_ROUTES", rewriteRoutes);
commit("SET_SIDEBAR_ROUTERS", constantRoutes.concat(sidebarRoutes));
commit("SET_DEFAULT_ROUTES", sidebarRoutes);

2
src/views/centerairC/sysMonitor/hostDetails.vue

@ -374,7 +374,7 @@ export default {
},
//
goBack() {
this.$router.back();
this.$router.push('/path/to/monitor/0');
},
//
getDayData() {

2
src/views/centerairC/sysMonitor/index.vue

@ -11,7 +11,7 @@ export default {
toPage() {
console.log("需要跳转的")
//
this.$router.push("/monitorCenter")
this.$router.push('/path/to/monitor/0');
},
},
};

3190
src/views/components/monitor/centerairMonitor.vue

File diff suppressed because it is too large Load Diff

2584
src/views/components/monitor/hotWaterMonitor.vue

File diff suppressed because it is too large Load Diff

648
src/views/components/monitor/index.vue

@ -0,0 +1,648 @@
<template>
<div class="monitor" v-loading="loading">
<div class="monitor-top">
<img class="title-left" src="../../../assets/images/title-left.png" alt="" />
<img class="title-center" src="../../../assets/images/title-center.png" alt="" />
<img class="title-right" src="../../../assets/images/title-right.png" alt="" />
<div class="sys-title">{{ currentPageTitle }}</div>
<!-- logo -->
<img src="../../../assets/images/logo-3.png" class="sys-logo" alt="" />
<div class="nowTime">{{ formattedDate }}</div>
<div class="monitor-time">已监测时长:{{ dayData }}</div>
<img class="icon_warning" src="../../../assets/images/warning.png" title="报警记录" @click="goWarning"
v-if="isShowWarning" alt="" />
<img class="icon_home" src="../../../assets/images/icon_home.png" title="首页" @click="goSys" alt="" />
<img class="back-icon" src="../../../assets/images/back-icon.png" title="返回" @click="goBack" alt="" />
</div>
<!-- 轮播内容区域 -->
<div class="carousel-container">
<!-- 轮播开关按钮 -->
<div class="carousel-toggle" @click="toggleAutoPlay" :title="isAutoPlaying ? '停止轮播' : '开始轮播'">
<i :class="isAutoPlaying ? 'el-icon-video-pause' : 'el-icon-video-play'"></i>
</div>
<!-- 左箭头 -->
<div class="arrow arrow-left" @click="prevPage" @mouseenter="handleArrowHover(true)"
@mouseleave="handleArrowHover(false)">
<i class="el-icon-arrow-left"></i>
</div>
<!-- 轮播内容 -->
<div class="carousel-content">
<transition :name="transitionName">
<component :is="currentPageComponent" :key="currentPage" class="carousel-item"></component>
</transition>
</div>
<!-- 右箭头 -->
<div class="arrow arrow-right" @click="nextPage" @mouseenter="handleArrowHover(true)"
@mouseleave="handleArrowHover(false)">
<i class="el-icon-arrow-right"></i>
</div>
</div>
<!-- 指示器 -->
<!-- <div class="indicators">
<span
v-for="(item, index) in pages"
:key="index"
:class="['indicator', { active: currentPage === index }]"
@click="goToPage(index)"
></span>
</div> -->
</div>
</template>
<script>
import {
weatherData,
sysPerformance,
oneKeyButton,
monitorList,
operationConrol,
systemMode,
runTime,
} from "@/api/centerairC/sysMonitor";
import LineChildren from "../../centerairC/sysMonitor/components/lineChildren.vue";
import { alarmRecordList } from "@/api/alarm/alarmRecord";
import { policyListData } from "@/api/centerairC/strategy";
import { getDay } from "@/utils/datetime";
import centerairMonitor from "./centerairMonitor.vue";
import hotWaterMonitor from "./hotWaterMonitor.vue";
export default {
components: {
LineChildren,
centerairMonitor,
hotWaterMonitor,
},
data() {
return {
loading: false,
timer: null, // ID
carouselTimer: null, //
currentDate: new Date(),
nowTimer: null,
isShowWarning: false, //
dayData: "", //
//
currentPage: 0, //
transitionName: "slide-left", //
isAutoPlaying: true, //
isArrowHovered: false, //
autoPlayTimeout: null, //
autoPlayInterval: 1000000, //
};
},
computed: {
// pages
dynamicPages() {
const pages = [];
// store
const sidebarRouters = this.$store.state.permission.sidebarRouters || [];
// CenterairC -> MonitorControl
const centerairRoute = sidebarRouters.find(item => item.name === 'CenterairC');
if (centerairRoute && centerairRoute.children) {
const monitorControl = centerairRoute.children.find(
child => child.name === 'MonitorControl'
);
if (monitorControl) {
pages.push({
title: "铭汉高效冷源站管理系统",
component: "centerairMonitor",
});
}
}
// HotWater -> WaterMonitor
const hotWaterRoute = sidebarRouters.find(item => item.name === 'HotWater');
if (hotWaterRoute && hotWaterRoute.children) {
const waterMonitor = hotWaterRoute.children.find(
child => child.name === 'WaterMonitor'
);
if (waterMonitor) {
pages.push({
title: "生活热水供水监控系统",
component: "hotWaterMonitor",
});
}
}
console.log("有多少个监测页面",pages)
return pages;
},
formattedDate() {
const year = this.currentDate.getFullYear();
const month = String(this.currentDate.getMonth() + 1).padStart(2, "0");
const day = String(this.currentDate.getDate()).padStart(2, "0");
const hours = String(this.currentDate.getHours()).padStart(2, "0");
const minutes = String(this.currentDate.getMinutes()).padStart(2, "0");
const seconds = String(this.currentDate.getSeconds()).padStart(2, "0");
const weekDays = [
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六",
];
const weekDay = weekDays[this.currentDate.getDay()];
return `${year}${month}${day}${hours}:${minutes}:${seconds} ${weekDay}`;
},
currentPageTitle() {
return this.dynamicPages[this.currentPage]?.title || '';
},
currentPageComponent() {
return this.dynamicPages[this.currentPage]?.component || '';
},
},
created() { },
mounted() {
// 使使
let page = this.$route.params.page; // /path/to/monitor/1
if (page === undefined) {
page = this.$route.query.page; // /path/to/monitor?page=1
}
if (page !== undefined) {
this.currentPage = parseInt(page);
}
// currentPage
if (this.currentPage >= this.dynamicPages.length) {
this.currentPage = 0;
}
//
this.requestFullscreen();
this.getDayData();
this.getAlarnStatus();
//
this.nowTimer = setInterval(() => {
this.currentDate = new Date();
}, 1000);
//
this.startAutoPlay();
},
beforeDestroy() {
//
if (this.timer) {
clearInterval(this.timer);
}
//
if (this.nowTimer) {
clearInterval(this.nowTimer);
}
//
if (this.carouselTimer) {
clearInterval(this.carouselTimer);
}
// 退
this.exitFullscreen();
},
methods: {
//
startAutoPlay() {
if (this.isAutoPlaying) {
this.carouselTimer = setInterval(() => {
this.nextPage();
}, this.autoPlayInterval);
}
},
//
stopAutoPlay() {
if (this.carouselTimer) {
clearInterval(this.carouselTimer);
this.carouselTimer = null;
}
},
//
toggleAutoPlay() {
this.isAutoPlaying = !this.isAutoPlaying;
if (this.isAutoPlaying) {
this.startAutoPlay();
} else {
this.stopAutoPlay();
}
},
//
restartAutoPlay() {
if (!this.isArrowHovered) {
this.stopAutoPlay();
this.startAutoPlay();
}
},
//
handleArrowHover(isHovered) {
this.isArrowHovered = isHovered;
if (isHovered) {
//
this.stopAutoPlay();
} else if (this.isAutoPlaying) {
//
this.startAutoPlay();
}
},
//
nextPage() {
this.transitionName = "slide-left";
const totalPages = this.dynamicPages.length;
if (totalPages > 0) {
this.currentPage = (this.currentPage + 1) % totalPages;
this.restartAutoPlay();
}
},
//
prevPage() {
this.transitionName = "slide-right";
const totalPages = this.dynamicPages.length;
if (totalPages > 0) {
this.currentPage = (this.currentPage - 1 + totalPages) % totalPages;
this.restartAutoPlay();
}
},
//
goToPage(index) {
if (index >= 0 && index < this.dynamicPages.length) {
if (index > this.currentPage) {
this.transitionName = "slide-left";
} else if (index < this.currentPage) {
this.transitionName = "slide-right";
}
this.currentPage = index;
this.restartAutoPlay();
}
},
//
requestFullscreen() {
const element = document.documentElement;
console.log("全屏操作没有进行中啊~~~~~~~~~~~~~~~~", element);
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) {
// Firefox
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) {
// Chrome, Safari and Opera
element.webkitRequestFullscreen();
} else if (element.msRequestFullscreen) {
// IE/Edge
element.msRequestFullscreen();
}
},
// 退
exitFullscreen() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
// Firefox
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
// Chrome, Safari and Opera
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
// IE/Edge
document.msExitFullscreen();
}
},
//
goSys() {
// 退
// this.exitFullscreen();
this.$router.push("/");
},
//
goBack() {
// 退
// this.exitFullscreen();
window.history.go(-2);
},
//
getDayData() {
runTime().then((res) => {
if (res.code == 200) {
this.dayData = res.data.runTime;
}
});
},
//
getAlarnStatus() {
let data = {
pageNum: 1,
pageSize: 10,
status: "0",
};
let timeArr = [getDay(0), getDay(0)];
alarmRecordList(this.addDateRange(data, timeArr)).then((res) => {
if (res.code == 200 && res.rows.length > 0) {
this.isShowWarning = true;
} else {
this.isShowWarning = false;
}
});
},
goWarning() {
// this.exitFullscreen();
this.$router.push("/alarm/alarmRecord");
},
},
};
</script>
<style lang="scss" scoped>
.monitor {
width: 100%;
min-height: 100vh;
height: auto;
background-color: black;
color: #fff;
overflow-y: auto;
overflow-x: hidden;
.monitor-top {
width: 100%;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
flex-wrap: nowrap;
padding: 0.1rem 0.2rem;
position: relative;
.title-left {
width: 3.41rem;
height: 0.8rem;
}
.title-center {
width: 9.46rem;
height: 0.69rem;
}
.title-right {
width: 5.04rem;
height: 0.61rem;
}
.sys-title {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 0.28rem;
color: #ffffff;
font-weight: bold;
z-index: 100;
}
.nowTime {
position: absolute;
top: 0.3rem;
right: 0.6rem;
font-size: 0.18rem;
color: #ffffff;
font-weight: bold;
z-index: 100;
}
.sys-logo {
width: 1.8rem;
height: 0.5rem;
position: absolute;
top: 0.26rem;
left: 0.8rem;
z-index: 10;
}
.monitor-time {
position: absolute;
top: 0.44rem;
left: 4.2rem;
z-index: 10;
font-size: 0.18rem;
color: #ffffff;
font-weight: bold;
}
.icon_warning {
position: absolute;
top: 0.33rem;
right: 4.4rem;
z-index: 10;
width: 0.3rem;
height: 0.27rem;
margin: 0 0.25rem 0 0.27rem;
cursor: pointer;
/* 添加闪烁动画 */
animation: blink 1s infinite;
}
@keyframes blink {
100% {
opacity: 1;
}
50% {
opacity: 0;
}
}
.icon_home {
position: absolute;
top: 0.33rem;
right: 4rem;
z-index: 10;
width: 0.3rem;
height: 0.27rem;
margin: 0 0.2rem 0 0.27rem;
cursor: pointer;
}
.back-icon {
position: absolute;
top: 0.33rem;
right: 3.7rem;
z-index: 10;
width: 0.3rem;
height: 0.27rem;
cursor: pointer;
}
}
//
.carousel-container {
display: flex;
align-items: flex-start;
justify-content: center;
position: relative;
width: 100%;
min-height: calc(100vh - 1rem);
overflow: visible;
//
.carousel-toggle {
position: fixed;
top: 1.2rem;
right: 0.3rem;
width: 0.6rem;
height: 0.6rem;
background: rgba(0, 0, 0, 0.5);
border-radius: 0.1rem;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 200;
transition: all 0.3s ease;
border: 1px solid rgba(255, 255, 255, 0.3);
pointer-events: auto;
&:hover {
background: rgba(0, 0, 0, 0.8);
transform: scale(1.1);
border-color: rgba(255, 255, 255, 0.6);
}
&:active {
transform: scale(0.95);
}
i {
font-size: 0.35rem;
color: #ffffff;
}
}
.carousel-content {
flex: 1;
width: 100%;
position: relative;
z-index: 50;
overflow: visible;
.carousel-item {
width: 100%;
height: auto;
position: relative;
display: block;
z-index: 1;
}
}
.arrow {
position: fixed;
top: 50%;
transform: translateY(-50%);
width: 0.6rem;
height: 0.6rem;
background: rgba(0, 0, 0, 0.5);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 200;
transition: all 0.3s ease;
border: 1px solid rgba(255, 255, 255, 0.2);
pointer-events: auto;
&:hover {
background: rgba(0, 0, 0, 0.8);
transform: translateY(-50%) scale(1.1);
border-color: rgba(255, 255, 255, 0.5);
}
&:active {
transform: translateY(-50%) scale(0.95);
}
i {
font-size: 0.3rem;
color: #ffffff;
}
&.arrow-left {
left: 0.3rem;
}
&.arrow-right {
right: 0.3rem;
}
}
}
//
.indicators {
position: absolute;
bottom: 0.3rem;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 0.15rem;
z-index: 100;
.indicator {
width: 0.15rem;
height: 0.15rem;
border-radius: 50%;
background: rgba(255, 255, 255, 0.3);
cursor: pointer;
transition: all 0.3s ease;
&.active {
background: #ffffff;
transform: scale(1.2);
}
&:hover {
background: rgba(255, 255, 255, 0.8);
}
}
}
//
.slide-left-enter-active,
.slide-left-leave-active,
.slide-right-enter-active,
.slide-right-leave-active {
transition: all 0.5s ease;
}
.slide-left-enter {
opacity: 0;
transform: translateX(100%);
}
.slide-left-leave-to {
opacity: 0;
transform: translateX(-100%);
}
.slide-right-enter {
opacity: 0;
transform: translateX(-100%);
}
.slide-right-leave-to {
opacity: 0;
transform: translateX(100%);
}
}
</style>

2
src/views/hotWater/waterMonitor/index.vue

@ -11,7 +11,7 @@ export default {
toPage() {
console.log("需要跳转的")
//
this.$router.push("/waterMonitorDetails")
this.$router.push('/path/to/monitor/1');
},
},
};

Loading…
Cancel
Save