| | |
| | | }, |
| | | methods: { |
| | | init() { |
| | | this.ws = new WebSocket("ws://" + window.location.host + baseUrl + "/console/websocket"); |
| | | this.ws.onopen = this.webSocketOnOpen |
| | | this.ws.onerror = this.webSocketOnError |
| | | this.ws.onmessage = this.webSocketOnMessage |
| | | this.ws.onclose = this.webSocketClose |
| | | |
| | | this.getMap(this.currentLev) |
| | | this.getSystemRunningStatus() //获取系统运行状态 |
| | | this.initLev()//初始化楼层信息 |
| | | |
| | | this.consoleInterval = setInterval(() => { |
| | | this.websocketConnect() |
| | | |
| | | this.getShuttleStateInfo() //获取四向穿梭车信息 |
| | | this.getLiftStateInfo() //获取提升机信息 |
| | | this.getSiteInfo() //获取输送站点数据 |
| | |
| | | } |
| | | } |
| | | }, |
| | | websocketConnect() { |
| | | if (this.ws == null) { |
| | | this.ws = new WebSocket("ws://" + window.location.host + baseUrl + "/console/websocket"); |
| | | this.ws.onopen = this.webSocketOnOpen |
| | | this.ws.onerror = this.webSocketOnError |
| | | this.ws.onmessage = this.webSocketOnMessage |
| | | this.ws.onclose = this.webSocketClose |
| | | } |
| | | }, |
| | | webSocketOnOpen(e) { |
| | | console.log("open"); |
| | | }, |
| | | webSocketOnError(e) { |
| | | this.ws = null; |
| | | console.log(e); |
| | | }, |
| | | webSocketOnMessage(e) { |
| | |
| | | } |
| | | }, |
| | | webSocketClose(e) { |
| | | this.ws = null; |
| | | console.log("close"); |
| | | }, |
| | | sendWs(message) { |
| | | if (this.ws == null) { |
| | | return; |
| | | } |
| | | |
| | | if (this.ws.readyState == WebSocket.OPEN) { |
| | | this.ws.send(message) |
| | | this.ws.send(message); |
| | | } |
| | | } |
| | | } |