fix(设备管理): 调整设备列表切换时switch为null,不覆盖
This commit is contained in:
parent
a9395ad80b
commit
10f93ef6ff
|
@ -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)
|
||||
|
|
|
@ -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}`
|
||||
|
@ -157,11 +157,8 @@ export default {
|
|||
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"]
|
||||
: "");
|
||||
list[i].children[v]["lastValue"] = result.params[list[i].children[v]["funKey"]];
|
||||
list[i].children[v]["lastTime"] = result.params["timestamp"] ? result.params["timestamp"] : "";
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
@ -348,7 +346,7 @@ export default {
|
|||
border: 1px solid #b7b4b4;
|
||||
margin-left: -1px;
|
||||
margin-top: -1px;
|
||||
border-color:#e0e0e0;
|
||||
border-color: #e0e0e0;
|
||||
.title-top {
|
||||
height: 30px;
|
||||
display: flex;
|
||||
|
|
Loading…
Reference in New Issue