From 7885ad510c6246a35ba14faff7cfdbc066e269cd Mon Sep 17 00:00:00 2001 From: web <candymxq888@outlook.com> Date: 星期四, 17 四月 2025 14:51:30 +0800 Subject: [PATCH] feat: 添加报表,报警,首页 --- src/views/screen/home/index.vue | 413 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 400 insertions(+), 13 deletions(-) diff --git a/src/views/screen/home/index.vue b/src/views/screen/home/index.vue index 7727726..e4cd659 100644 --- a/src/views/screen/home/index.vue +++ b/src/views/screen/home/index.vue @@ -1,6 +1,71 @@ <template> <div class="container"> + <div class="left"> + <div class="warn"> + <div class="warn-t">报警次数排名</div> + <div class="warn-c"> + <div class="warnCharts" ref="warnChart"></div> + </div> + </div> + <div class="pumpList"> + <div class="pumpList-t">泵站列表</div> + <div class="pumpList-c"> + <div class="list"> + <div class="listItem"> + <div class="name">西南楼新风井泵房</div> + <div class="value default">正常运行</div> + </div> + <div class="listItem"> + <div class="name">西南楼新风井泵房</div> + <div class="value default">正常运行</div> + </div> + <div class="listItem"> + <div class="name">西南楼新风井泵房</div> + <div class="value error">异常运行</div> + </div> + <div class="listItem"> + <div class="name">西南楼新风井泵房</div> + <div class="value default">正常运行</div> + </div> + <div class="listItem"> + <div class="name">西南楼新风井泵房</div> + <div class="value offline">离线断开</div> + </div> + <div class="listItem"> + <div class="name">西南楼新风井泵房</div> + <div class="value default">正常运行</div> + </div> + <div class="listItem"> + <div class="name">西南楼新风井泵房</div> + <div class="value default">正常运行</div> + </div> + <div class="listItem"> + <div class="name">西南楼新风井泵房</div> + <div class="value default">正常运行</div> + </div> + </div> + </div> + </div> + </div> <div class="center" > + <div class="info"> + <div class="infoItem" :class="{active: openStatus.bengfang}" @click="setOpenStatus('bengfang')"> + <div class="infoItem-t">泵房数目</div> + <div class="infoItem-c" v-if="openStatus.bengfang"><span>36</span>个</div> + </div> + <div class="infoItem" :class="{active: openStatus.shuibeng}" @click="setOpenStatus('shuibeng')"> + <div class="infoItem-t">水泵数量</div> + <div class="infoItem-c" v-if="openStatus.shuibeng"><span>44</span>个</div> + </div> + <div class="infoItem" :class="{active: openStatus.liuliangji}" @click="setOpenStatus('liuliangji')"> + <div class="infoItem-t">流量计个数</div> + <div class="infoItem-c" v-if="openStatus.liuliangji"><span>25</span>个</div> + </div> + <div class="infoItem" :class="{active: openStatus.shuijin}" @click="setOpenStatus('shuijin')"> + <div class="infoItem-t">水浸传感器数量</div> + <div class="infoItem-c" v-if="openStatus.shuijin"><span>25</span>个</div> + </div> + </div> <!-- 地图窗口 --> <div class="map"> <div class="point-box" v-if="tucengVal === 0"> @@ -31,6 +96,79 @@ <div class="message-item"> <span class="name">其他详细信息:</span> <router-link class="val" to="/screen/pumpInfo">点击跳转</router-link> + </div> + </div> + </div> + </div> + </div> + <div class="yunxing"> + <div class="yunxing-t">运行情况统计</div> + <div class="yunxing-c"> + <div class="list"> + <div class="item"> + <div class="item-t"> + <div class="type">运行正常</div> + <div class="num default">68</div> + </div> + <div class="item-c"> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + </div> + </div> + <div class="item"> + <div class="item-t"> + <div class="type">运行异常</div> + <div class="num error">8</div> + </div> + <div class="item-c"> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + </div> + </div> + <div class="item"> + <div class="item-t"> + <div class="type">离线断开</div> + <div class="num offline">16</div> + </div> + <div class="item-c"> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> + <div class="name">西风楼新风井泵房</div> </div> </div> </div> @@ -84,21 +222,55 @@ </template> <script setup lang="ts"> -import {onMounted, onUnmounted, ref} from "vue"; +import {onMounted, reactive, onUnmounted, ref} from "vue"; import {getPumpData, getPumpWarning} from '@/api/screen/index.js' import { ElMessageBox } from 'element-plus' +import * as echarts from 'echarts/core'; +import { GridComponent, TooltipComponent } from 'echarts/components'; +import { BarChart } from 'echarts/charts'; +import { CanvasRenderer } from 'echarts/renderers'; +echarts.use([GridComponent, TooltipComponent, BarChart, CanvasRenderer]); + +const warnChart = ref(null) const tucengVal = ref(0); const warnList = ref([]) const showMsg = ref(0) const pointList = ref([]) const dislogOpen = ref(false) let timer = null; +let warnCharts = null + +const openStatus = reactive({ + bengfang: false, + shuibeng: false, + liuliangji: false, + shuijin: false +}) const warnCode = ['B001StartNumber', 'B002StartNumber', 'B003StartNumber', 'B004StartNumber'] const clickMsgFun = (index: number) => { showMsg.value = showMsg.value === index ? null : index; +} + +const setOpenStatus = (type: string) => { + switch (type) { + case "bengfang": + openStatus.bengfang = openStatus.bengfang ? false : true; + break; + case "shuibeng": + openStatus.shuibeng = openStatus.shuibeng ? false : true; + break; + case "liuliangji": + openStatus.liuliangji = openStatus.liuliangji ? false : true; + break + case "shuijin": + openStatus.shuijin = openStatus.shuijin ? false : true; + break + default: + break; + } } // 获取报警数据 @@ -130,7 +302,7 @@ const v2 = el.parameterVOList.find(item => item.columnsCode === '2001B') const v3 = el.parameterVOList.find(item => item.columnsCode === '2001C') pump.push({ - left: 84, top: 28, + left: 80, top: 20, name: el.facilityName, totalTime: el.totalTime, gongdain: gongdainStatus(Number(v1.columnValue), Number(v2.columnValue), Number(v3.columnValue)), @@ -143,6 +315,58 @@ }) } +const initWarnCharts = () => { + if(warnChart.value) { + warnCharts = echarts.init(warnChart.value); + const option = { + grid: { + top: '10%', + bottom: '10%', + left: '12%' + }, + tooltip: { + trigger: 'item', + }, + xAxis: { + type: 'category', + data: ['西南楼', '文化中心', '天津宾馆', '体育中心'], + axisLabel: { + color: '#fff', + fontSize: '0.8rem' + }, + }, + yAxis: { + type: 'value', + axisLabel: { + color: '#fff', + fontSize: '0.8rem' + }, + }, + series: [ + { + data: [120, 200, 150, 80], + type: 'bar', + itemStyle: { + color: { + type: 'linear', + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [{ + offset: 0, color: '#ff0000' // 0% 处的颜色 + }, { + offset: 1, color: 'rgba(255,255,255,0)' // 100% 处的颜色 + }], + } + } + } + ] + } + warnCharts.setOption(option); + } +} + const gongdainStatus = (n1, n2, n3) => { if ((n1 > 350 && n1 < 400) && (n2 > 350 && n2 < 400) && (n3 > 350 && n3 < 400)) { @@ -153,6 +377,7 @@ } onMounted(() => { + initWarnCharts() getPumpInfo() getWarning() // 定时获取报警信息 @@ -199,13 +424,123 @@ justify-content: space-between; color: white; overflow: hidden; - - .center { - width: 80%; + gap: 1rem; + .left{ + width: 20%; + height: 100%; display: flex; flex-direction: column; + justify-content: space-between; + .warn{ + height: 40%; + background-image: url('@/assets/images_lc/realTimeMonitoring.png'); + backdrop-filter: blur(3px); + background-repeat: no-repeat; + background-size: 100% 100%; + &-t { + background-image: url('@/assets/images_lc/title_font.png'); + background-repeat: no-repeat; + background-size: 100% 100%; + padding-left: 16%; + font-size: 1.2rem; + } + + &-c { + height: 90%; + .warnCharts{ + width: 100%; + height: 100%; + } + } + } + .pumpList{ + height: 58%; + background-image: url('@/assets/images_lc/warnRecord.png'); + backdrop-filter: blur(3px); + background-repeat: no-repeat; + background-size: 100% 100%; + &-t{ + background-image: url('@/assets/images_lc/title_font.png'); + background-repeat: no-repeat; + background-size: 100% 100%; + padding-left: 16%; + font-size: 1.3rem; + } + &-c{ + height: 90%; + padding: 1rem; + .list{ + height: 100%; + overflow-y: scroll; + &::-webkit-scrollbar{ + display: none; + } + .listItem{ + width: 100%; + padding: 1rem 0; + display: flex; + justify-content: space-between; + align-items: center; + .value{ + padding: 0.5rem 1rem; + border-radius: 0.5rem; + } + .default{ + background-color: #1ab394; + } + .error{ + background-color: #d53333; + } + .offline{ + background-color: #aaaaaa; + } + } + } + } + } + } + .center { + width: 58%; + display: flex; + flex-direction: column; + .info{ + height: 17%; + display: flex; + justify-content: space-between; + .infoItem{ + width: 18%; + height: 3.5rem; + background: url("@/assets/images_lc/data_info_bg.png") no-repeat; + background-size: 100% 100%; + overflow: hidden; + position: relative; + cursor: pointer; + &-t{ + font-size: 1.3rem; + width: 100%; + height: 3rem; + line-height: 3rem; + text-align: center; + } + &-c{ + width: 100%; + text-align: center; + position: absolute; + bottom: 20%; + span{ + font-size:2rem; + } + } + &.active{ + width: 18%; + height: 8.6rem; + background: url("@/assets/images_lc/data_info_bg_zk.png") no-repeat; + background-size: 100% 100%; + } + } + } .map { - height: 100%; + height: 53%; .point-box{ width: 100%; height: 100%; @@ -244,6 +579,65 @@ } } } + .yunxing{ + height: 30%; + background-image: url('@/assets/images_lc/yunxing-statis.png'); + backdrop-filter: blur(3px); + background-repeat: no-repeat; + background-size: 100% 100%; + &-t{ + background-image: url('@/assets/images_lc/title_font.png'); + background-repeat: no-repeat; + background-size: 40% 100%; + padding-left: 6%; + font-size: 1.3rem; + } + &-c{ + height: 90%; + .list{ + height: 100%; + width: 100%; + display: flex; + padding-left: 1rem; + .item{ + width: 33%; + &-t{ + display: flex; + align-items: center; + height: 20%; + .type{ + width: 50%; + } + .num{ + font-size: 1.3rem; + } + .default{ + color: #1ab394; + } + .error{ + color: #f61731; + } + .offline{ + color: #acacac; + } + } + &-c{ + height: 70%; + display: flex; + flex-wrap: wrap; + overflow-y: scroll; + &::-webkit-scrollbar{ + display: none; + } + .name{ + width: 50%; + padding-top: 1rem; + } + } + } + } + } + } } .right { @@ -254,11 +648,6 @@ justify-content: space-between; .js-box{ height: 40%; - &:hover{ - .jiankong{ - transform: translateX(0); - } - } } .jiankong { height: 100%; @@ -266,8 +655,6 @@ backdrop-filter: blur(3px); background-repeat: no-repeat; background-size: 100% 100%; - transform: translateX(100%); - transition: all .5s; &-t { background-image: url('@/assets/images_lc/title_font.png'); background-repeat: no-repeat; -- Gitblit v1.9.3