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