From 944c727cc5f2ccf5b4d2e5c2c524a9af8271ab74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E6=B4=81?= <209192278@qq.com> Date: Wed, 13 Dec 2023 09:43:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=93=E6=B4=81=20:=20=E9=A3=8E=E5=8E=8B?= =?UTF-8?q?=E9=A3=8E=E9=80=9F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/largeScreen.js | 8 ++ src/components/content/airInfo/AirInfo.vue | 86 ++++++++++++------- .../content/airInfo/childComps/ItemInfo.vue | 27 +++--- .../content/windPressure/WindPressureList.vue | 84 ++++++------------ .../childComps/WindPressureItem.vue | 19 ++-- src/components/manageBtn/index.vue | 9 +- src/views/tunnel/index.vue | 19 ++-- 7 files changed, 127 insertions(+), 125 deletions(-) create mode 100644 src/api/largeScreen.js diff --git a/src/api/largeScreen.js b/src/api/largeScreen.js new file mode 100644 index 0000000..37e00f3 --- /dev/null +++ b/src/api/largeScreen.js @@ -0,0 +1,8 @@ +import request from '@/utils/request.js' + +export const getLargeScreen = (tunnelId) => { + return request({ + url: `/tunnel/large/screen/equipment/${tunnelId}`, + method: 'get' + }) +} diff --git a/src/components/content/airInfo/AirInfo.vue b/src/components/content/airInfo/AirInfo.vue index 5772f7e..d4616a2 100644 --- a/src/components/content/airInfo/AirInfo.vue +++ b/src/components/content/airInfo/AirInfo.vue @@ -39,43 +39,63 @@ import {ref, reactive} from "vue"; import ItemInfo from "./childComps/ItemInfo.vue"; const props = defineProps({ - list: Array + list: Array, + airData: Array }); -const info = reactive({ - windPId: 0, //编号 - max: 120, //最大值 - value: 70, //测量值 - point: 60, //阈值 -}); -const info1 = reactive({ - windPId: 0, //编号 - max: 120, //最大值 - value: 60, //测量值 - point: 70, //阈值 -}); -const info2 = reactive({ - windPId: 0, //编号 - max: 120, //最大值 - value: 90, //测量值 - point: 100, //阈值 -}); -const info3 = reactive({ - windPId: 0, //编号 - max: 120, //最大值 - value: 80, //测量值 - point: 88, //阈值 +let info = reactive({ + // windPId: 0, //编号 + // max: 120, //最大值 + // value: 70, //测量值 + // point: 60, //阈值 }); +let info1 = reactive({}); +let info2 = reactive({}); +let info3 = reactive({}); +watch(() => props.airData, (now) => { + getAirInfo(now.sensorList) +}, {deep: true}); + watch(() => props.list, (now, old) => { console.log('传感器 ', now, old) - // wpList.value=now + now.map(item=>{ + getInfo(item) + }) }, {deep: true}); -// setInterval(() => { -// info.value = parseInt(Math.random() * 10) * 10; -// info1.value = parseInt(Math.random() * 10) * 10; -// info2.value = parseInt(Math.random() * 10) * 10; -// info3.value = parseInt(Math.random() * 10) * 10; -// }, 2000); - +const changeData=(item,flag)=>{ + return{ + equipmentId: item.equipmentId, + max: 120, + value: flag?flag.value:item.value, + point: item.valueThreshold, + unit:item.unit + } +} +const getInfo=(item)=>{ + if(item.equipmentId==info.equipmentId){ + // info.value=item.value + changeData(item,info1) + console.log('info',info) + }else if(item.equipmentId==info1.equipmentId){ + changeData(item,info1) + }else if(item.equipmentId==info2.equipmentId){ + changeData(item,info2) + }else if(item.equipmentId==info3.equipmentId){ + changeData(item,info3) + } +} +const getAirInfo = (now) => { + now.map(item => { + if (item.equipmentType === "dust") {//粉尘 + info3 = changeData(item) + } else if (item.equipmentType === "oxygen") {//氧气 + info = changeData(item) + } else if (item.equipmentType === "temperature") {//温度 + info1 = changeData(item) + } else if (item.equipmentType === "humidness") {//湿度 + info2 = changeData(item) + } + }) +}