|
|
|
@ -9,6 +9,7 @@
|
|
|
|
|
<script>
|
|
|
|
|
import ThemePicker from "@/components/ThemePicker";
|
|
|
|
|
import AlmModal from "@/components/AlmModal";
|
|
|
|
|
import {ElMessage} from 'element-ui'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "App",
|
|
|
|
@ -23,6 +24,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
isOnline: {},
|
|
|
|
|
// WebSocket相关
|
|
|
|
|
websocket: null,
|
|
|
|
|
websocketUrl: 'ws://10.42.0.1:7181/ws',
|
|
|
|
@ -109,6 +111,9 @@ export default {
|
|
|
|
|
if (data.deviceParam) {
|
|
|
|
|
// 通过事件总线转发设备数据到需要的组件
|
|
|
|
|
this.$bus.$emit('websocket-device-data', data)
|
|
|
|
|
|
|
|
|
|
this.isOnline[data.deviceParam.monitorId] = new Date().getTime()
|
|
|
|
|
this.selectOffLineDevice()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.isFlag === 1 && data.alarmRules && data.alarmContents) {
|
|
|
|
@ -355,6 +360,18 @@ export default {
|
|
|
|
|
this.alarmQueue = []
|
|
|
|
|
this.isWebSocketConnected = false
|
|
|
|
|
this.isProcessingAlarm = false
|
|
|
|
|
},
|
|
|
|
|
selectOffLineDevice() {
|
|
|
|
|
Object.keys(this.isOnline).forEach(key => {
|
|
|
|
|
if (this.isOnline[key] - new Date().getTime() > 1000 * 60 * 30) {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: `error`,
|
|
|
|
|
message: `设备${key}已离线`
|
|
|
|
|
});
|
|
|
|
|
this.isOnline[key] = new Date().getTime()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|