|
|
@ -65,6 +65,7 @@ import deviceApi from '../../js/device_api'; |
|
|
|
|
|
|
|
import { mapState } from 'vuex'; |
|
|
|
import util from '../../../../utils/util'; |
|
|
|
import DEVICE_FUN from '../../js/device_fun.js'; |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
@ -174,10 +175,13 @@ export default { |
|
|
|
console.log("icon tap status: ",status,switchInfo) |
|
|
|
|
|
|
|
let _data = this.getOperateReqData({ switchInfo, status }) |
|
|
|
|
|
|
|
_data = DEVICE_FUN.AC_filterCloudACData(_data,switchInfo); |
|
|
|
|
|
|
|
//针对门禁没有关按钮发两条命令->开&关 20201224 后端: 直接发两条 关的那条这里填5 然后你那边不用管返回 |
|
|
|
|
|
|
|
//新增定时/长按拦截判断 |
|
|
|
if(status == 2) return util.showNone("该功能暂未开放") |
|
|
|
// if(status == 2) return util.showNone("该功能暂未开放") |
|
|
|
|
|
|
|
if(status == 4){ |
|
|
|
|
|
|
@ -214,6 +218,10 @@ export default { |
|
|
|
data: _query, // 后端数据结构, 参考src\subpackage\device\js\ouxuanac.md |
|
|
|
}; |
|
|
|
|
|
|
|
//2021-12-17 群里说的那个锁的 需要全部关闭灯的按钮从 set-rpio 变成 set-rpio-lock 普通开灯保持不变 加锁开灯(长开) set-rpio-lock |
|
|
|
if(switchInfo.hardware_type=="Light"&&_data.data.value.status=="high")_data.data.name = "set-rpio-lock" |
|
|
|
if(switchInfo.hardware_type=="Light"&&status==2)_data.data.name = "set-rpio-lock" |
|
|
|
|
|
|
|
//针对门禁没有关按钮发两条命令->开&关 20201224 后端: 直接发两条 关的那条这里填5 然后你那边不用管返回 |
|
|
|
if(switchInfo.hardware_type === 'AccessControl'&&status == 0)_data['delay'] = '5'; |
|
|
|
|
|
|
@ -263,8 +271,11 @@ export default { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
let _data = this.getSwitchStatusQuery(switchInfo); |
|
|
|
_data = DEVICE_FUN.AC_filterCloudACData(data,switchInfo); |
|
|
|
|
|
|
|
this.getStatusReq({ |
|
|
|
data: this.getSwitchStatusQuery(switchInfo), |
|
|
|
data: _data, |
|
|
|
index, |
|
|
|
}) |
|
|
|
},300,300), |
|
|
@ -347,6 +358,7 @@ export default { |
|
|
|
// 数据结构参考 src\subpackage\device\js\ouxuanac.md |
|
|
|
// 空调开关数据结构独立判断处理 hardware_type === 'Air' |
|
|
|
getSwitchQuery({ switchInfo, status = '' }){ |
|
|
|
|
|
|
|
let { |
|
|
|
hardware_connect_method, |
|
|
|
hardware_type, |
|
|
@ -354,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); |
|
|
@ -375,6 +389,7 @@ export default { |
|
|
|
postData.value['o'] = this.getRelayStatus(status); // 开关状态 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return postData; |
|
|
|
}, |
|
|
|
changeLowerCase(str){ |
|
|
@ -385,7 +400,7 @@ export default { |
|
|
|
// High = "high", // 高电位, 为关闭 |
|
|
|
// status 0 -> 关(左), 1 -> 开(右) ,2 -> 长开 ,3 -> 定时, 4 ->详情(自定义) |
|
|
|
getRelayStatus(status){ |
|
|
|
return [ 'high', 'low', '', 'high', ''][status] || '' |
|
|
|
return [ 'high', 'low', 'low', 'high', ''][status] || '' |
|
|
|
}, |
|
|
|
|
|
|
|
// 空调状态 |
|
|
@ -403,6 +418,7 @@ export default { |
|
|
|
'Gpio': 'get-rpio', // 全设备 |
|
|
|
'SerialPort485': 'zzio404d-gpio-status', |
|
|
|
'Tcp': 'zzio404d-gpio-status-tcp', |
|
|
|
'YZK':'zzio404d-gpio-status' |
|
|
|
}; |
|
|
|
|
|
|
|
return _obj[hardware_connect_method] || '' |
|
|
@ -415,6 +431,7 @@ export default { |
|
|
|
'Gpio': 'set-rpio', // 全设备 |
|
|
|
'SerialPort485': 'zzio404d-gpio', |
|
|
|
'Tcp': 'zzio404d-gpio-tcp', |
|
|
|
'YZK':'zzio404d-gpio' |
|
|
|
}; |
|
|
|
|
|
|
|
return _obj[hardware_connect_method] || '' |
|
|
|