From 28ea77ec45bd860e23c0edfb6ee81a7d6599b25f Mon Sep 17 00:00:00 2001
From: web <candymxq888@outlook.com>
Date: 星期六, 12 四月 2025 19:11:02 +0800
Subject: [PATCH] fix:修改配置文件

---
 src/views/screen/home/index.vue |  300 ++++++++++++++++++++++-------------------------------------
 1 files changed, 113 insertions(+), 187 deletions(-)

diff --git a/src/views/screen/home/index.vue b/src/views/screen/home/index.vue
index 601b0fa..7727726 100644
--- a/src/views/screen/home/index.vue
+++ b/src/views/screen/home/index.vue
@@ -10,23 +10,23 @@
                         <div class="message" v-show="showMsg === index">
                             <div class="message-item">
                                 <span class="name">泵房名称:</span>
-                                <span class="val">{{item.name}}</span>
+                                <span class="val">下瓦房新风井泵房</span>
                             </div>
                             <div class="message-item">
                                 <span class="name">水浸状态:</span>
-                                <span class="val-status">{{item.shuijin}}</span>
-                            </div>
-                            <div class="message-item">
-                                <span class="name">运行时长:</span>
-                                <span class="val-status">{{}}</span>
+                                <span :class="item.shuijin === '正常' ? 'val-status' : 'err-status'">{{item.shuijin}}</span>
                             </div>
                             <div class="message-item">
                                 <span class="name">工作状态:</span>
-                                <span class="val-status">{{}}</span>
+                                <span :class="item.status === '排水' ? 'val-status' : 'err-status'">{{item.status}}</span>
                             </div>
                             <div class="message-item">
-                                <span class="name">水池水位:</span>
-                                <span class="val-status">{{item.yewei}}</span>
+                                <span class="name">供电状态:</span>
+                                <span :class="item.gongdain ? 'val-status' : 'err-status'">{{item.gongdain ? '正常' : '异常'}}</span>
+                            </div>
+                            <div class="message-item">
+                                <span class="name">总运行时长:</span>
+                                <span class="val-status">{{item.totalTime}}</span>
                             </div>
                             <div class="message-item">
                                 <span class="name">其他详细信息:</span>
@@ -38,69 +38,44 @@
             </div>
         </div>
         <div class="right">
-            <div class="right-box">
-                <!-- 实时监控 -->
+            <!-- 实时监控 -->
+            <div class="js-box">
                 <div class="jiankong">
                     <div class="jiankong-t">实时监控</div>
                     <div class="jiankong-c">
                         <div class="switch">
                             <div class="switch-l">泵房监控</div>
-                            <div class="switch-r">
-                                <div class="more" :class="{active: selectType==='two'}" @click="changeType('two')">多屏模式 </div>
-                                <div class="single" :class="{active: selectType==='single'}" @click="changeType('single')">单屏模式</div>
-                            </div>
                         </div>
                         <div class="video-box">
-                            <div class="two" v-if="selectType==='two'">
-                                <div class="list" v-for="(item, index) in showList" :key="index">
-                                    <div class="item" v-if="item?.deviceId">
-                                        <VideoPlayer :item="item" />
-                                    </div>
-                                    <div v-else class="item"></div>
-                                </div>
-                            </div>
-                            <div class="single" v-else>
-                                <div class="item" v-if="showList[0]?.deviceId">
-                                    <VideoPlayer :item="showList[0]" />
-                                </div>
-                                <div v-else class="item"></div>
-                            </div>
+                            <router-link to="/screen/monitor" class="item">
+                                <el-icon><VideoPlay /></el-icon>
+                            </router-link>
                         </div>
                     </div>
                 </div>
-                <!-- 报警记录 -->
-                <div class="warnRecord">
-                    <div class="warnRecord-title">报警记录</div>
-                    <div class="warnRecord-info">
-                        <div class="into-t">报警信息</div>
-                        <div class="info-list">
-                            <div class="item" v-for="(item, index) in warnList" :key="index">
-                                <el-tooltip
-                                    effect="dark"
-                                    :content="item.pointName"
-                                    placement="top"
-                                >
-                                    {{item.pointName}}
-                                </el-tooltip>
-                                <el-tooltip
-                                    effect="dark"
-                                    :content="item.facilityName"
-                                    placement="top"
-                                >
-                                    {{item.facilityName}}
-                                </el-tooltip>
-                                <el-tooltip
-                                    effect="dark"
-                                    :content="item.description"
-                                    placement="top"
-                                >
-                                    {{item.description}}
-                                </el-tooltip>
-                            </div>
+            </div>
+            <!-- 报警记录 -->
+            <div class="warnRecord" v-if="warnList?.length > 0">
+                <div class="warnRecord-title">报警记录</div>
+                <div class="warnRecord-info">
+                    <div class="into-t">报警信息</div>
+                    <div class="info-list">
+                        <div class="item" v-for="(item, index) in warnList" :key="index">
+                            <el-tooltip
+                                effect="dark"
+                                :content="item.facilityName"
+                                placement="top"
+                            >
+                                {{item.facilityName}}
+                            </el-tooltip>
+                            <el-tooltip
+                                effect="dark"
+                                :content="item.description"
+                                placement="top"
+                            >
+                                {{item.description}}
+                            </el-tooltip>
                         </div>
-                    </div>
-                    <div class="warnRecord-datashow">
-                        <div ref="warningRef" class="warning" />
                     </div>
                 </div>
             </div>
@@ -109,103 +84,39 @@
 </template>
 
 <script setup lang="ts">
-import { use } from "echarts/core";
-import * as echarts from 'echarts/core';
-import {GridComponent, TooltipComponent, LegendComponent} from "echarts/components";
-import { LineChart, PieChart } from "echarts/charts";
-import { UniversalTransition, LabelLayout } from "echarts/features";
-import { CanvasRenderer } from "echarts/renderers";
-import {onMounted, reactive, ref} from "vue";
-import {getPumpData} from '@/api/screen/index.js'
-import {getVideoList} from '@/api/screen/video.js'
-import VideoPlayer from "@/components/VideoPlayer/VideoPlayer.vue";
-
-
-use([
-    GridComponent,
-    LineChart,
-    CanvasRenderer,
-    UniversalTransition,
-    TooltipComponent,
-    LegendComponent,
-    PieChart,
-    CanvasRenderer,
-    LabelLayout,
-]);
-
-const warningRef = ref();
-let warningCharts = null;
+import {onMounted, onUnmounted, ref} from "vue";
+import {getPumpData, getPumpWarning} from '@/api/screen/index.js'
+import { ElMessageBox } from 'element-plus'
 
 const tucengVal = ref(0);
-const selectType = ref('single')
-const videoList = ref([])
-const showList = ref([])
 const warnList = ref([])
 const showMsg = ref(0)
 const pointList = ref([])
+const dislogOpen = ref(false)
+let timer = null;
+
+const warnCode = ['B001StartNumber', 'B002StartNumber', 'B003StartNumber', 'B004StartNumber']
 
 const clickMsgFun = (index: number) => {
     showMsg.value = showMsg.value === index ? null : index;
 }
 
-const setWarningCharts = (data) => {
-    if(warningRef.value) {
-        warningCharts = echarts.init(warningRef.value);
-        const option = {
-            tooltip: {
-                trigger: 'item'
-            },
-            series: [
-                {
-                    type: 'pie',
-                    radius: '50%',
-                    data: data,
-                    emphasis: {
-                        itemStyle: {
-                            shadowBlur: 10,
-                            shadowOffsetX: 0,
-                            shadowColor: 'rgba(0, 0, 0, 0.5)'
-                        }
-                    }
-                }
-            ]
-        }
-        warningCharts.setOption(option);
-    }
-}
-
-// 切换播放模式
-const changeType = (type) => {
-    selectType.value = type
-    showList.value = []
-    if(type === 'two') {
-        showList.value = videoList.value.slice(0, 2).concat(Array(2 - videoList.value.length).fill(null))
-    } else {
-        showList.value = videoList.value.slice(0, 1)
-    }
-}
-
 // 获取报警数据
 const getWarning = () => {
-    getHomeWarning().then(res => {
-        warnList.value = res.data.alarmHistoryVOList
-        let data = [
-            { value: res.data.facilityCount, name: '设备启动异常' },
-            { value: res.data.waterEnterCount, name: '进水压力异常' },
-            { value: res.data.waterOutCount, name: '出口压力异常' },
-        ]
-        setWarningCharts(data)
+    getPumpWarning({limit: 10, page:1}).then(res => {
+        warnList.value = res.data.list
+        const warnDialogList = res.data.list.filter(el => warnCode.includes(el.code))
+        if(!dislogOpen.value && warnDialogList.length > 0) {
+            dislogOpen.value=true
+            ElMessageBox.confirm(warnDialogList[0].facilityName, warnDialogList[0].description, {
+                showCancelButton: false,
+                confirmButtonText: '关闭',
+                type: 'error'
+            }).then(() => {
+                console.log('关闭')
+            })
+        }
     })
-}
-
-// 获取视频列表
-const getVideo = async (id) => {
-    if(id) {
-        getVideoList({pointId: id}).then(res => {
-            videoList.value = res.data;
-            changeType(selectType.value)
-        })
-    }
 }
 
 // 获取泵房信息
@@ -213,13 +124,18 @@
     const pump = []
     getPumpData().then(res => {
         res.data.forEach((el, index) => {
-            const yewei = el.parameterVOList.find(item => item.columnsCode === '1001')
             const shuijin = el.parameterVOList.find(item => item.columnsCode === 'SQ')
+            const status = el.parameterVOList.find(item => item.columnsCode === '1012')
+            const v1 = el.parameterVOList.find(item => item.columnsCode === '2001A')
+            const v2 = el.parameterVOList.find(item => item.columnsCode === '2001B')
+            const v3 = el.parameterVOList.find(item => item.columnsCode === '2001C')
             pump.push({
                 left: 84, top: 28,
                 name: el.facilityName,
-                yewei: yewei.columnValue + yewei?.columnsUnits,
+                totalTime: el.totalTime,
+                gongdain: gongdainStatus(Number(v1.columnValue), Number(v2.columnValue), Number(v3.columnValue)),
                 shuijin: !Number(shuijin.columnValue) ? '正常' : '异常',
+                status: Number(status.columnValue) < 0 ? '吸水' : '排水',
             })
         })
 
@@ -227,9 +143,27 @@
     })
 }
 
+
+const gongdainStatus = (n1, n2, n3) => {
+    if ((n1 > 350 && n1 < 400) && (n2 > 350 && n2 < 400) && (n3 > 350 && n3 < 400)) {
+        return true
+    } else {
+        return false
+    }
+}
+
 onMounted(() => {
     getPumpInfo()
-    // getWarning()
+    getWarning()
+    // 定时获取报警信息
+    timer = setInterval(() => {
+        getWarning()
+    }, 5000)
+})
+onUnmounted(() => {
+    if(timer){
+        clearInterval(timer)
+    }
 })
 </script>
 
@@ -284,7 +218,7 @@
                     }
                     .message{
                         width: 12rem;
-                        height: 14rem;
+                        height: 12rem;
                         background: url("@/assets/images_lc/point-message.png") no-repeat;
                         backdrop-filter: blur(3px);
                         background-size: 100% 100%;
@@ -302,6 +236,9 @@
                             .val-status{
                                 color: #22E195;
                             }
+                            .err-status{
+                                color: red;
+                            }
                         }
                     }
                 }
@@ -311,27 +248,30 @@
 
     .right {
         width: 20%;
-        &:hover{
-            .right-box{
-                transform: translateX(0);
+        height: 100%;
+        display: flex;
+        flex-direction: column;
+        justify-content: space-between;
+        .js-box{
+            height: 40%;
+            &:hover{
+                .jiankong{
+                    transform: translateX(0);
+                }
             }
         }
-        .right-box{
-            height: 100%;
-            display: flex;
-            flex-direction: column;
-            gap: 1rem;
-            transform: translateX(100%);
-            transition: all .5s;
-        }
         .jiankong {
-            height: 45%;
+            height: 100%;
             background-image: url('@/assets/images_lc/realTimeMonitoring.png');
             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;
+                background-size: 100% 100%;
                 padding-left: 16%;
                 font-size: 1.2rem;
             }
@@ -378,38 +318,22 @@
                     }
                 }
                 .video-box{
-                    height: 85%;
+                    height: 80%;
                     padding: 0 1rem;
-                    .two{
-                        width: 100%;
+                    .item{
                         height: 100%;
+                        background-color: #000;
                         display: flex;
-                        flex-direction: column;
                         align-items: center;
-                        .list{
-                            width: 100%;
-                            height: 48%;
-                            .item{
-                                height: 100%;
-                                background-color: #000;
-                            }
-                        }
-                    }
-                    .single{
-                        width: 100%;
-                        height: 100%;
-                        .item{
-                            height: 95%;
-                            width: 100%;
-                            background-color: #000;
-                        }
+                        justify-content: center;
+                        font-size: 3rem;
                     }
                 }
             }
         }
 
         .warnRecord {
-            height: 55%;
+            height: 58%;
             background-image: url('@/assets/images_lc/warnRecord.png');
             backdrop-filter: blur(3px);
             background-repeat: no-repeat;
@@ -418,31 +342,33 @@
             flex-direction: column;
             .warnRecord-title {
                 background-image: url('@/assets/images_lc/title_font.png');
+                background-repeat: no-repeat;
+                background-size: 100% 100%;
                 padding-left: 16%;
                 font-size: 1.3rem;
             }
             .warnRecord-info {
                 width: 90%;
-                height: 50%;
+                height: 90%;
                 margin: auto;
                 overflow-y: scroll;
                 &::-webkit-scrollbar{
                     display: none;
                 }
                 .into-t{
-                    height: 15%;
+                    height: 10%;
                     font-size: 1.2rem;
                     padding-top: 0.3rem;
                 }
                 .info-list{
-                    height: 85%;
+                    height: 90%;
                     .item{
                         padding: 0.5rem 0;
                         display: flex;
                         justify-content: space-between;
                         font-size: 0.8rem;
                         :deep(.el-only-child__content){
-                            width: 30%;
+                            width: 50%;
                             overflow: hidden;
                             text-overflow: ellipsis;
                             white-space: nowrap;

--
Gitblit v1.9.3