From ef6117ad94e2801940bd8695b4d5d91e66564488 Mon Sep 17 00:00:00 2001
From: selia-zx <1771203023@qq.com>
Date: Fri, 26 Jun 2026 15:10:57 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B9=BF=E5=90=88=E7=9A=84?=
=?UTF-8?q?=E9=A3=8E=E6=9C=BA=E9=A2=91=E7=8E=87=E5=92=8C=E8=BF=90=E8=A1=8C?=
=?UTF-8?q?=E7=8A=B6=E6=80=81=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 4 +-
.../centerairC/sysMonitor/monitorCenter.vue | 192 +++++-------------
2 files changed, 48 insertions(+), 148 deletions(-)
diff --git a/.env.development b/.env.development
index 5a51382..5fb1a1f 100644
--- a/.env.development
+++ b/.env.development
@@ -7,11 +7,11 @@ ENV = 'development'
# 开发环境
# VUE_APP_BASE_API = '/dev-api'
# 后台
-VUE_APP_BASE_API = 'http://192.168.1.222:8080'
+# VUE_APP_BASE_API = 'http://192.168.1.222:8080'
# 梅州云端
# VUE_APP_BASE_API = 'http://106.55.173.225:8091'
# 广合
-# VUE_APP_BASE_API = 'http://106.55.173.225:8092'
+VUE_APP_BASE_API = 'http://106.55.173.225:8092'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
diff --git a/src/views/centerairC/sysMonitor/monitorCenter.vue b/src/views/centerairC/sysMonitor/monitorCenter.vue
index 9cc2687..22c47a9 100644
--- a/src/views/centerairC/sysMonitor/monitorCenter.vue
+++ b/src/views/centerairC/sysMonitor/monitorCenter.vue
@@ -203,15 +203,15 @@
- {{ coolingTowerHz2 }}Hz
+
+ {{ coolingTowerHz(2, 1) }}Hz

-

@@ -222,8 +222,8 @@
{{ freezingOutWater }}m³/h
-
{{ freezingInPre }}kpa
-
{{ freezingOutPre }}kpa
+
{{ freezingInPre }}bar
+
{{ freezingOutPre }}bar
{{ coolingInTem }}℃
{{ coolingOutTem }}℃
@@ -485,13 +485,13 @@ export default {
// 设置定时器,每 10 秒执行一次
this.timer = setInterval(() => {
- // this.getWeatherData();
- // this.getSystemMode();
- // this.getPerformance();
- // this.getOneKeyButton();
- // this.getMonitorList();
- // this.getAlarnStatus();
- // this.getDayData();
+ this.getWeatherData();
+ this.getSystemMode();
+ this.getPerformance();
+ this.getOneKeyButton();
+ this.getMonitorList();
+ this.getAlarnStatus();
+ this.getDayData();
}, 10000);
// 每秒更新一次时间
this.nowTimer = setInterval(() => {
@@ -1310,152 +1310,52 @@ export default {
// 否则代表运行状态中的不运行
return false;
},
- // 冷却塔风机运行状态,index为多少号风机,1表示1号风机;item表示风机x
+ /** 冷却塔风机运行状态, index为冷却塔编号(如1号冷却塔), item为风机编号(如风机1) */
coolingTowerRunClass(index, item) {
- // 从 this.coolingTower 中查找 deviceName 第一个数字与 index 相同的对象
- let targetDevice = null;
+ // coolingTower 经过 processDeviceList 处理后,所有风机数据合并到一个对象中
+ // 需要遍历所有对象的 properties 数组,用 collectName 匹配
for (let i = 0; i < this.coolingTower.length; i++) {
const device = this.coolingTower[i];
- const deviceName = device.deviceName.toString();
- // 使用正则表达式匹配 deviceName 开头的数字,提取 deviceName 的第一个词(以非数字字符分割)
- const firstWordMatch = deviceName.match(/^\d+/);
- if (firstWordMatch && firstWordMatch[0] === index.toString()) {
- targetDevice = device;
- break;
- }
- }
-
- // 如果未找到匹配的设备,返回 false
- if (!targetDevice) {
- return false;
- }
-
- // 获取匹配设备的 properties 数组
- const properties = targetDevice.properties;
-
- // 检查 properties 数组是否存在
- if (!properties || properties.length === 0) {
- return false;
- }
-
- // 创建一个新数组,用于存储 paramType === 1 的对象
- const filteredProperties = [];
- let filterItem = {};
- for (let i = 0; i < properties.length; i++) {
- // console.log('properties[i].paramType',properties[i].paramType)
- if (properties[i].paramType === "1") {
- filteredProperties.push(properties[i]);
- // filterItem = properties[i]
- }
- }
- // // 将处理后的对象添加到 deviceList 中
- // if (Object.keys(filterItem).length > 1) {
- // filteredProperties.push(filterItem);
- // }
- // console.log("paramType为1的对象", filteredProperties);
- // console.log("index, item", index, item);
- // 根据 index 和 item 生成目标属性名称
- const towerNumber = index;
- const targetPropertyName = `${towerNumber}号冷却塔风机${item}运行`;
- // console.log("targetPropertyName",targetPropertyName)
- // 在新数组中查找与目标名称匹配的对象,并检查其 collectValue 是否不为 "0.00"
- for (let i = 0; i < filteredProperties.length; i++) {
- const collectName = filteredProperties[i].collectName;
- if (
- collectName.includes(`${towerNumber}号冷却塔风机${item}`) &&
- collectName.includes("运行") &&
- Number(filteredProperties[i].collectValue) !== 0
- ) {
- if (index === 0 && item === 1) {
- // console.log(
- // "返回的true",
- // filteredProperties[i].collectName === targetPropertyName &&
- // Number(filteredProperties[i].collectValue) !== 0
- // );
+ const properties = device.properties;
+ if (!properties || properties.length === 0) continue;
+ for (let j = 0; j < properties.length; j++) {
+ const prop = properties[j];
+ const collectName = prop.collectName;
+ // collectName 格式: "2号冷却塔风机1_运行状态"
+ if (
+ collectName &&
+ collectName.includes(`${index}号冷却塔风机${item}`) &&
+ collectName.includes('运行状态') &&
+ prop.paramType === '1' &&
+ Number(prop.collectValue) !== 0
+ ) {
+ return true;
}
- return true;
}
}
-
- // 否则代表运行状态中的不运行
return false;
},
- // 冷却塔风机频率,index为多少号风机,1表示1号风机;item表示风机x
+ /** 冷却塔风机频率, index为冷却塔编号(如1号冷却塔), item为风机编号(如风机1),返回频率数值或false */
coolingTowerHz(index, item) {
- // 从 this.coolingTower 中查找 deviceName 第一个数字与 index 相同的对象
- let targetDevice = null;
+ // 遍历 coolingTower 中所有对象的 properties,用 collectName 匹配
for (let i = 0; i < this.coolingTower.length; i++) {
const device = this.coolingTower[i];
- const deviceName = device.deviceName.toString();
- // 使用正则表达式匹配 deviceName 开头的数字,提取 deviceName 的第一个词(以非数字字符分割)
- const firstWordMatch = deviceName.match(/^\d+/);
- if (firstWordMatch && firstWordMatch[0] === index.toString()) {
- targetDevice = device;
- break;
- }
- }
-
- // 如果未找到匹配的设备,返回 false
- if (!targetDevice) {
- return false;
- }
-
- // 获取匹配设备的 properties 数组
- const properties = targetDevice.properties;
-
- // 检查 properties 数组是否存在
- if (!properties || properties.length === 0) {
- return false;
- }
-
- // 创建一个新数组,用于存储 paramType === 4 的对象
- const filteredProperties = [];
- let filterItem = {};
- for (let i = 0; i < properties.length; i++) {
- // console.log('properties[i].paramType',properties[i].paramType)
- if (properties[i].paramType === "4") {
- filteredProperties.push(properties[i]);
- // filterItem = properties[i]
- }
- }
- // // 将处理后的对象添加到 deviceList 中
- // if (Object.keys(filterItem).length > 1) {
- // filteredProperties.push(filterItem);
- // }
- // console.log("paramType为4的对象", filteredProperties);
- // console.log("index, item", index, item);
- // 根据 index 和 item 生成目标属性名称
- const towerNumber = index;
- const targetPropertyName = `${towerNumber}号冷却塔风机${item}频率反馈`;
- // console.log("targetPropertyName",targetPropertyName)
- // console.log("filteredProperties",filteredProperties)
- // 在新数组中查找与目标名称匹配的对象,并检查其 collectValue 是否不为 "0.00"
- for (let i = 0; i < filteredProperties.length; i++) {
- const collectName = filteredProperties[i].collectName;
- if (
- collectName.includes(`${towerNumber}号冷却塔风机${item}`) &&
- collectName.includes("频率反馈")
- ) {
- // 动态构造 coolingTowerHz 相关属性名
- const coolingTowerHzPropertyName = `coolingTowerHz${item}`;
- // console.log(
- // `coolingTowerHz${towerNumber}`,
- // coolingTowerHzPropertyName
- // );
- // 获取 collectValue 转换为数字后的值
- const value = Number(filteredProperties[i].collectValue);
- // 使用方括号语法动态设置属性值
- this[coolingTowerHzPropertyName] = value;
- // console.log(
- // "coolingTowerHzPropertyName])",
- // coolingTowerHzPropertyName
- // );
- // console.log(`${coolingTowerHzPropertyName}`, value);
- return true;
+ const properties = device.properties;
+ if (!properties || properties.length === 0) continue;
+ for (let j = 0; j < properties.length; j++) {
+ const prop = properties[j];
+ const collectName = prop.collectName;
+ // collectName 格式: "2号冷却塔风机1_频率反馈"
+ if (
+ collectName &&
+ collectName.includes(`${index}号冷却塔风机${item}`) &&
+ collectName.includes('频率反馈') &&
+ prop.paramType === '4'
+ ) {
+ return Number(prop.collectValue);
+ }
}
}
-
- // 否则代表运行状态中的不运行
return false;
},
// 冷却塔出水蝶阀启停状态