提交:修复 设备详情(网关以及子设备在线状态更新问题)!
This commit is contained in:
parent
6d2ba906c6
commit
ecfbc83d3d
|
@ -52,7 +52,6 @@ export default {
|
|||
* @param {*} evt
|
||||
*/
|
||||
socket_message(evt) {
|
||||
console.log("wsljcg:=", evt);
|
||||
const data = JSON.parse(evt.data);
|
||||
this.$emit('message_http', evt);
|
||||
this.$emit('message', data)
|
||||
|
|
|
@ -141,7 +141,11 @@
|
|||
<div class="layout-device-list">
|
||||
<el-card
|
||||
@click.native="viewDeviceChange(deviceInfo.deviceId)"
|
||||
:body-style="{ padding: '0px', width: '220px' , 'boxShadow': '0 1px 5px 0 #2530341a' }"
|
||||
:body-style="{
|
||||
padding: '0px',
|
||||
width: '220px',
|
||||
boxShadow: '0 1px 5px 0 #2530341a',
|
||||
}"
|
||||
:style="
|
||||
deviceInfo.deviceId === checkobxDeviceId
|
||||
? 'border: 1px solid #1890ff; margin: 5px; width: 220px; flex-shrink: 0;'
|
||||
|
@ -272,19 +276,19 @@
|
|||
<div class="dev-info">
|
||||
<div
|
||||
:class="
|
||||
deviceInfo['deviceState'] == 'ONLINE'
|
||||
item['deviceState'] === 'ONLINE'
|
||||
? 'dev-info-state'
|
||||
: 'dev-info-state off-line'
|
||||
"
|
||||
style="width: 60px"
|
||||
>
|
||||
<icon
|
||||
v-if="deviceInfo['deviceState'] == 'ONLINE'"
|
||||
v-if="item['deviceState'] === 'ONLINE'"
|
||||
class="iconfont iconSYS_STA_1"
|
||||
/>
|
||||
<icon v-else class="iconfont iconlixian" />
|
||||
<span style="margin-left: 1px; margin-top: 1px">{{
|
||||
deviceInfo["deviceState"] == "ONLINE" ? "在线" : "离线"
|
||||
getDeviceState(item["deviceState"])
|
||||
}}</span>
|
||||
</div>
|
||||
<div
|
||||
|
@ -326,7 +330,6 @@
|
|||
<script>
|
||||
import { listChildrenDevice, setSwitchControl } from "@/api/iot/device";
|
||||
import {
|
||||
iotWebSocketBaseUrl,
|
||||
devLiveWebSocketBaseUrl,
|
||||
webSocketProjectGatewayUrl,
|
||||
} from "@/config/env";
|
||||
|
@ -407,15 +410,27 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
getDeviceState(e) {
|
||||
switch (e) {
|
||||
case "ONLINE":
|
||||
return "在线";
|
||||
case "OUTLINE":
|
||||
return "脱线";
|
||||
default:
|
||||
return "离线";
|
||||
}
|
||||
},
|
||||
// 开启 设备状态ws
|
||||
handleOpenDevStatusService(str) {
|
||||
console.log("handleOpenDevStatusService", str);
|
||||
this.wsStatusService = `${webSocketProjectGatewayUrl}/${this.getGuid()}/${
|
||||
this.deviceInfo.deviceKey
|
||||
},${str}`;
|
||||
},
|
||||
wsMessage(e) {
|
||||
if (e["deviceState"] || (e["switch"] !== null && e["switch"] !== undefined)) {
|
||||
if (
|
||||
e["deviceState"] ||
|
||||
(e["switch"] !== null && e["switch"] !== undefined)
|
||||
) {
|
||||
this.handleDeviceInfo(e);
|
||||
}
|
||||
},
|
||||
|
@ -432,6 +447,7 @@ export default {
|
|||
return v;
|
||||
}
|
||||
});
|
||||
this.$forceUpdate();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -503,7 +519,6 @@ export default {
|
|||
// }
|
||||
},
|
||||
selectDevClose(e) {
|
||||
console.log(e);
|
||||
this.tSelectList.splice(this.tSelectLabelList.indexOf(e), 1);
|
||||
this.tSelectLabelList.splice(this.tSelectLabelList.indexOf(e), 1);
|
||||
},
|
||||
|
@ -576,7 +591,6 @@ export default {
|
|||
this.handlerWsMsgData(JSON.parse(evt.data));
|
||||
},
|
||||
handlerWsMsgData(evt) {
|
||||
// console.log("msg:", evt);
|
||||
this.$emit("wsRealTImeMsg", JSON.stringify(evt));
|
||||
if (this.deviceInfo.deviceId !== this.wsDeviceInfo.deviceId) {
|
||||
for (let i = 0; i < this.childDeviceList.length; i++) {
|
||||
|
|
Loading…
Reference in New Issue