From af47db0998f8129a260393fe91d20dd75a3d196a Mon Sep 17 00:00:00 2001 From: zmt Date: Thu, 30 Dec 2021 13:36:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E4=B8=AD=E6=8E=A7=E5=85=BC=E5=AE=B9-f?= =?UTF-8?q?ix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/pages/switch_manage/switch_manage.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/subpackage/device/pages/switch_manage/switch_manage.vue b/src/subpackage/device/pages/switch_manage/switch_manage.vue index 2f29df0..4ee252e 100644 --- a/src/subpackage/device/pages/switch_manage/switch_manage.vue +++ b/src/subpackage/device/pages/switch_manage/switch_manage.vue @@ -358,6 +358,7 @@ export default { // 数据结构参考 src\subpackage\device\js\ouxuanac.md // 空调开关数据结构独立判断处理 hardware_type === 'Air' getSwitchQuery({ switchInfo, status = '' }){ + let { hardware_connect_method, hardware_type, @@ -365,17 +366,19 @@ export default { node_id, hardware_net_addr } = switchInfo; - + const _hardware_connect_method = this.changeLowerCase(hardware_connect_method) + const postData = { name: this.getQueryName(switchInfo), value: { id: hardware_id + '', } // value 内值全为String }; - if (this.changeLowerCase(hardware_connect_method) === 'gpio') postData.value['status'] = this.getRelayStatus(status); + if (_hardware_connect_method === 'gpio') postData.value['status'] = this.getRelayStatus(status); // tcp 连接需要 hardware_net_addr - if (this.changeLowerCase(hardware_connect_method) === 'tcp') postData.value['tcp'] = hardware_net_addr + ''; - let _flag = this.changeLowerCase(hardware_connect_method) === 'serialport485' || this.changeLowerCase(hardware_connect_method) === 'tcp'; + if (_hardware_connect_method === 'tcp') postData.value['tcp'] = hardware_net_addr + ''; + // let _flag = _hardware_connect_method === 'serialport485' || _hardware_connect_method === 'tcp'||_hardware_connect_method==='yzk'; + let _flag = ['serialport485','tcp','yzk'].some(e=> e===_hardware_connect_method); if (_flag){ if(hardware_type === 'Air'){ // 空调开关状态 key为 op postData.value['op'] = this.getAirRelayStatus(status); @@ -386,10 +389,11 @@ export default { postData.value['o'] = this.getRelayStatus(status); // 开关状态 } } + return postData; }, changeLowerCase(str){ - return str.toString().toLocaleLowerCase(); + return str.toString().toLocaleLowerCase(); }, // 常规开关状态 // Low = "low", // 低电位,为开启