From f6b881910412825b647534461ca5ffb1dc0e5ba4 Mon Sep 17 00:00:00 2001 From: selia-zx <1771203023@qq.com> Date: Tue, 28 Apr 2026 11:13:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=83=AD=E6=B0=B4=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E4=B8=AD=E4=B8=BB=E6=A5=BC=E5=BE=AA=E7=8E=AF=E6=B3=B5?= =?UTF-8?q?=E3=80=81=E8=B4=B5=E5=AE=BE=E6=A5=BC=E6=B0=B4=E7=AE=B1=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E7=9A=84=E5=BC=B9=E6=A1=86=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/monitor/hotWaterMonitor.vue | 368 ++++++++++++++---- src/views/components/monitor/index.vue | 2 +- 2 files changed, 297 insertions(+), 73 deletions(-) diff --git a/src/views/components/monitor/hotWaterMonitor.vue b/src/views/components/monitor/hotWaterMonitor.vue index d6ceaa3..72cfb46 100644 --- a/src/views/components/monitor/hotWaterMonitor.vue +++ b/src/views/components/monitor/hotWaterMonitor.vue @@ -78,8 +78,10 @@ - - + +
@@ -292,7 +294,8 @@ : require('../../../assets/flowimg/onlineweb.png') " alt="" /> - + @@ -390,58 +393,191 @@
-
- -
- - - -
+ + + + + + +
@@ -502,9 +638,9 @@ export default { // 热泵弹框相关 hotPumpDialogVisible: false, // 弹框显示状态 - currentHotPump: null, // 当前点击的热泵对象 hotPumpOperateData: null, // 热泵操作数据 hotPumpTitle: "", //弹框标题 + currentPumpType: "", // 当前点击的类型:hotpump(热泵) / cyclepump(循环泵) / tank(水箱) / sensor(传感器) 等 }; }, computed: { @@ -581,7 +717,7 @@ export default { if (this.level4Nodes.length > 0) { this.treeAutoRotateTimer = setInterval(() => { this.autoRotateTree(); - }, 300000); // 5分钟 = 300000毫秒 + }, 5 * 60 * 1000); // 5分钟 = 300000毫秒 console.log("树形结构自动轮播定时器已启动,间隔:5分钟"); } @@ -917,32 +1053,50 @@ export default { // 点击热泵图片事件 handleHotPumpClick(item) { console.log("点击热泵", item); - this.currentHotPump = item; - this.hotPumpTitle = item.pumpName - // 请求热泵操作数据 + this.currentPumpType = "hotpump"; + this.hotPumpTitle = item.pumpName; + this.loadOperateData("热泵", item.pumpName); + }, + // 点击水箱事件 + handleWaterBoxClick(boxName) { + console.log("水箱", boxName); + this.currentPumpType = "waterBox"; + this.hotPumpTitle = boxName; + this.loadOperateData("水箱", boxName); + }, + // 点击循环泵事件 + handleCyclePumpClick(pumpName) { + console.log("点击循环泵", pumpName); + this.currentPumpType = "cyclepump"; + this.hotPumpTitle = pumpName; + this.loadOperateData("贵宾楼循环泵", pumpName); + }, + // 加载操作数据(通用方法) + loadOperateData(groupName, itemName) { + console.log("groupName, itemName", groupName, itemName) let data = { systemType: "1", floorId: this.currentId, }; waterOperateList(data).then((res) => { - console.log("热泵操作数据返回", res); + console.log("操作数据返回", res); if (res.code === 200 && res.rows) { - // 找到name为"热泵"的children数组 - let hotPumpGroup = null; + // 找到对应组的children数组 + let targetGroup = null; if (Array.isArray(res.rows)) { - hotPumpGroup = res.rows.find(group => group.name === "热泵"); + targetGroup = res.rows.find(group => group.name === groupName); } else if (res.rows.children && Array.isArray(res.rows.children)) { - hotPumpGroup = res.rows.children.find(group => group.name === "热泵"); + targetGroup = res.rows.children.find(group => group.name === groupName); } - if (hotPumpGroup && hotPumpGroup.children) { - // 根据pumpName匹配对应的子项 - const matchedItem = hotPumpGroup.children.find(child => child.name === item.pumpName); + if (targetGroup && targetGroup.children) { + // 根据name匹配对应的子项 + const matchedItem = targetGroup.children.find(child => child.name === itemName); if (matchedItem) { - // 设置弹框数据 this.hotPumpOperateData = { ...matchedItem, + waterLevel: Number(matchedItem.waterLevel), runningStatus: Number(matchedItem.runningStatus) === 0 ? "停止" : "运行", //运行状态 hotPumpStatus: Number(matchedItem.switchStatus) === 0 @@ -952,21 +1106,26 @@ export default { : "", // 热泵开关状态 switchStatus: Number(matchedItem.switchStatus) == 0 ? false : true, //启停控制 alarmStatus: Number(matchedItem.alarmStatus) == 0 ? "无故障" : "故障", //故障状态 + handAutomaticSwitch: + Number(matchedItem.handAutomaticSwitch) == 0 ? false : true, //手自动状态 + openSwitch: Number(matchedItem.openSwitch) == 0 ? false : true, //一键启动 + closeSwitch: Number(matchedItem.closeSwitch) == 0 ? false : true, //一键停止 + exceptionReset: Number(matchedItem.exceptionReset) == 0 ? false : true, //异常复位 }; - console.log("匹配到的热泵操作数据", this.hotPumpOperateData); + console.log("匹配到的操作数据", this.hotPumpOperateData); this.hotPumpDialogVisible = true; } else { - this.$message.warning(`未找到热泵"${item.pumpName}"的操作数据`); + this.$message.warning(`未找到"${itemName}"的操作数据`); } } else { - this.$message.warning("未找到热泵操作数据"); + this.$message.warning(`未找到${groupName}操作数据`); } } else { - this.$message.error("获取热泵操作数据失败1"); + this.$message.error("获取操作数据失败"); } }).catch((error) => { - console.error("获取热泵操作数据失败", error); - this.$message.error("获取热泵操作数据失败2"); + console.error("获取操作数据失败", error); + this.$message.error("获取操作数据失败"); }); }, // 计算水位百分比(最高值maxLevel) @@ -1004,6 +1163,62 @@ export default { item.switchStatus = !item.switchStatus; }); }, + // 设置供水泵手自动状态 + handAutomatic(item) { + this.$confirm( + `确定要切换设备"${item.name}"的状态为:${item.handAutomaticSwitch ? "手动" : "自动 吗?" + }`, + "提示", + { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + } + ) + .then(() => { + // 这里调用请求函数,示例中只是简单打印信息 + console.log("请求后台", item.handAutomaticSwitch); + let param = null; + if (item.handAutomaticSwitch) { + param = 0; + } else { + param = 1; + } + this.hadleOperationConrol(item.handAutomaticSwitchId, param); + }) + .catch(() => { + // 用户取消操作,恢复开关状态 + item.handAutomaticSwitch = !item.handAutomaticSwitch; + }); + }, + // 设置启停控制 + handleSwitch(item) { + this.$confirm( + `确定要切换设备"${item.name}"的状态为:${item.switchStatus ? "开启" : "停止 吗?" + }`, + "提示", + { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + } + ) + .then(() => { + // 这里调用请求函数,示例中只是简单打印信息 + console.log("请求后台", item.switchStatus); + let param = null; + if (item.switchStatus) { + param = 1; + } else { + param = 0; + } + this.hadleOperationConrol(item.switchStatusId, param); + }) + .catch(() => { + // 用户取消操作,恢复开关状态 + item.switchStatus = !item.switchStatus; + }); + }, // input设置 handleEnter(item, value, id, set, unit) { this.$confirm( @@ -1081,10 +1296,6 @@ export default {