diff --git a/src/views/profile/DeviceDetailsView/deviceSelectNav.vue b/src/views/profile/DeviceDetailsView/deviceSelectNav.vue index 96a5eaf2..8fa677f2 100644 --- a/src/views/profile/DeviceDetailsView/deviceSelectNav.vue +++ b/src/views/profile/DeviceDetailsView/deviceSelectNav.vue @@ -410,10 +410,13 @@ export default { this.childDeviceList[i]["deviceId"] === this.wsDeviceInfo["deviceId"] ) { - this.childDeviceList[i]["switch"] = - this.wsDeviceInfo?.switch !== null - ? this.wsDeviceInfo?.switch.toString() - : this.wsDeviceInfo?.switch; + if(this.wsDeviceInfo?.switch !== null){ + this.wsDeviceInfo.switch = this.wsDeviceInfo.switch.toString(); + } + // this.childDeviceList[i]["switch"] = + // this.wsDeviceInfo?.switch !== null + // ? this.wsDeviceInfo?.switch.toString() + // : this.wsDeviceInfo?.switch // this.wsDeviceInfo?.switch; this.$forceUpdate(); break; @@ -454,6 +457,7 @@ export default { },${str}`; }, wsMessage(e) { + // debugger if ( e["deviceState"] || (e["switch"] !== null && e["switch"] !== undefined) diff --git a/src/views/profile/DeviceRunStarts/index.vue b/src/views/profile/DeviceRunStarts/index.vue index 46c5fc98..9baaafa8 100644 --- a/src/views/profile/DeviceRunStarts/index.vue +++ b/src/views/profile/DeviceRunStarts/index.vue @@ -71,9 +71,9 @@ import { iotWebSocketBaseUrl } from "@/config/env"; import RunStateTable from "./table"; export default { name: "RunStartsWrap", - props: ["prodId", "sourceId", "deviceInfo", 'wsUrl', 'realTimeData'], + props: ["prodId", "sourceId", "deviceInfo", "wsUrl", "realTimeData"], components: { - RunStateTable, + RunStateTable }, data() { return { @@ -84,7 +84,7 @@ export default { socket_flag: true, dialogData: {}, dialogShow: false, - firstWsMassage: true, + firstWsMassage: true }; }, created() { @@ -116,7 +116,7 @@ export default { let headers = { clientid: this.deviceInfo.wsClientId, username: this.deviceInfo.wsUsername, - sign: this.deviceInfo.wsSign, + sign: this.deviceInfo.wsSign }; this.stompClient = new WebSocket( `${this.wsUrl}${headers.clientid}/${headers.username}/${headers.sign}` @@ -151,21 +151,18 @@ export default { // } // // } // } else { - if (result["cmd"] && list[i]["cmdKey"] === result["cmd"]) { - for (var v = 0; v < list[i].children.length; v++) { - if ( - result.params[list[i].children[v]["funKey"]] !== null && - result.params[list[i].children[v]["funKey"]] !== undefined - ) { - (list[i].children[v]["lastValue"] = - result.params[list[i].children[v]["funKey"]]), - (list[i].children[v]["lastTime"] = result.params["timestamp"] - ? result.params["timestamp"] - : ""); - } + if (result["cmd"] && list[i]["cmdKey"] === result["cmd"]) { + for (var v = 0; v < list[i].children.length; v++) { + if ( + result.params[list[i].children[v]["funKey"]] !== null && + result.params[list[i].children[v]["funKey"]] !== undefined + ) { + list[i].children[v]["lastValue"] = result.params[list[i].children[v]["funKey"]]; + list[i].children[v]["lastTime"] = result.params["timestamp"] ? result.params["timestamp"] : ""; } - break; } + break; + } // } } }, @@ -174,7 +171,7 @@ export default { if (this.socket_flag) { this.socket_flag = false; let self = this; - setTimeout(function () { + setTimeout(function() { self.socket_flag = true; self.connection(); }, 10000); @@ -185,9 +182,9 @@ export default { cmdId: row.cmdId, deviceId: this.deviceInfo.deviceId, cmdKey: row.cmdKey, - deviceKey: this.deviceInfo.deviceKey, + deviceKey: this.deviceInfo.deviceKey }; - getDeviceFunList(param).then((res) => { + getDeviceFunList(param).then(res => { row["children"] = res.data || []; this.$forceUpdate(); }); @@ -204,9 +201,10 @@ export default { getCmdList() { const params = { deviceId: this.deviceInfo.deviceId, - cmdType: "1", + cmdType: "1" }; - getDeviceCmdList(params).then((response) => { + getDeviceCmdList(params).then(response => { + // debugger this.cmdList = response.data; }); }, @@ -217,7 +215,7 @@ export default { this.socket_flag = false; this.stompClient = null; clearTimeout(this.setTimeOut_flag); - }, + } }, destroyed() { this.closeWebscoket(); @@ -233,12 +231,12 @@ export default { } }, realTimeData: { - handler: function () { - this.setListData(this.realTimeData) + handler: function() { + this.setListData(this.realTimeData); }, - deep: true, + deep: true } - }, + } };