| | |
| | | <el-tab-pane label="堆垛机" name="crn"> |
| | | <watch-crn-card ref="watchCrnCard" :param="crnParam"></watch-crn-card> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="双工位堆垛机" name="dualCrn"> |
| | | <watch-dual-crn-card ref="watchDualCrnCard" :param="dualCrnParam"></watch-dual-crn-card> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="输送站" name="devp"> |
| | | <devp-card ref="devpCard" :param="devpParam"></devp-card> |
| | | </el-tab-pane> |
| | |
| | | </el-tabs> |
| | | </div> |
| | | |
| | | <map-canvas :lev="currentLev" :crn-param="crnParam" :rgv-param="rgvParam" :devp-param="devpParam" @crn-click="openCrn" @station-click="openSite" style="width: 80%; height: 100vh;"></map-canvas> |
| | | <map-canvas :lev="currentLev" :crn-param="crnParam" :rgv-param="rgvParam" :devp-param="devpParam" @crn-click="openCrn" @dual-crn-click="openDualCrn" @station-click="openSite" style="width: 80%; height: 100vh;"></map-canvas> |
| | | |
| | | <div style="position: absolute;top: 15px;left: 50%;display: flex;"> |
| | | <div v-if="levList.length > 1" v-for="(lev,index) in levList" :key="index" style="margin-right: 10px;"> |
| | |
| | | </div> |
| | | |
| | | <script src="../../components/WatchCrnCard.js"></script> |
| | | <script src="../../components/WatchDualCrnCard.js"></script> |
| | | <script src="../../components/DevpCard.js"></script> |
| | | <script src="../../components/MapSettingCard.js"></script> |
| | | <script src="../../components/WatchRgvCard.js"></script> |
| | |
| | | crnParam: { |
| | | crnNo: 0 |
| | | }, |
| | | dualCrnParam: { |
| | | crnNo: 0 |
| | | }, |
| | | mapSettingParam: { |
| | | zoom: 70 |
| | | }, |
| | |
| | | rgvParam: { |
| | | rgvNo: 0 |
| | | }, |
| | | locMastData: []//库位数据 |
| | | locMastData: [],//库位数据 |
| | | wsReconnectTimer: null, |
| | | wsReconnectAttempts: 0, |
| | | wsReconnectBaseDelay: 1000, |
| | | wsReconnectMaxDelay: 15000 |
| | | }, |
| | | created() { |
| | | this.init() |
| | | }, |
| | | mounted() { |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.wsReconnectTimer) { clearTimeout(this.wsReconnectTimer); this.wsReconnectTimer = null; } |
| | | if (ws && (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING)) { try { ws.close(); } catch (e) {} } |
| | | }, |
| | | watch: { |
| | | |
| | |
| | | }, |
| | | webSocketOnOpen() { |
| | | console.log("WebSocket连接成功"); |
| | | if (this.wsReconnectTimer) { clearTimeout(this.wsReconnectTimer); this.wsReconnectTimer = null; } |
| | | this.wsReconnectAttempts = 0; |
| | | this.getMap(); |
| | | }, |
| | | webSocketOnError() { |
| | | console.log("WebSocket连接发生错误"); |
| | | this.scheduleWsReconnect(); |
| | | }, |
| | | webSocketClose() { |
| | | console.log("WebSocket连接关闭"); |
| | | this.scheduleWsReconnect(); |
| | | }, |
| | | webSocketOnMessage(e) { |
| | | const result = JSON.parse(e.data); |
| | | if (result.url == "/crn/table/crn/state") { |
| | | if(this.$refs.watchCrnCard) { |
| | | this.$refs.watchCrnCard.setCrnList(JSON.parse(result.data)); |
| | | } |
| | | } else if (result.url == "/dualcrn/table/crn/state") { |
| | | if(this.$refs.watchDualCrnCard) { |
| | | this.$refs.watchDualCrnCard.setDualCrnList(JSON.parse(result.data)); |
| | | } |
| | | } else if (result.url == "/console/latest/data/station") { |
| | | if(this.$refs.devpCard) { |
| | |
| | | })) |
| | | }, |
| | | init() { |
| | | this.connectWs(); |
| | | |
| | | this.getSystemRunningStatus() //获取系统运行状态 |
| | | this.getLevList() //获取地图层级列表 |
| | | this.getLocMastData() //获取库位数据 |
| | | }, |
| | | connectWs() { |
| | | if (ws && (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING)) { return; } |
| | | ws = new WebSocket("ws://" + window.location.host + baseUrl + "/console/websocket"); |
| | | ws.onopen = this.webSocketOnOpen; |
| | | ws.onerror = this.webSocketOnError; |
| | | ws.onmessage = this.webSocketOnMessage; |
| | | ws.onclose = this.webSocketClose; |
| | | |
| | | this.getSystemRunningStatus() //获取系统运行状态 |
| | | this.getLevList() //获取地图层级列表 |
| | | this.getLocMastData() //获取库位数据 |
| | | }, |
| | | scheduleWsReconnect() { |
| | | if (this.wsReconnectTimer) { return; } |
| | | const attempt = this.wsReconnectAttempts + 1; |
| | | const jitter = Math.floor(Math.random() * 300); |
| | | const delay = Math.min(this.wsReconnectMaxDelay, this.wsReconnectBaseDelay * Math.pow(2, this.wsReconnectAttempts)) + jitter; |
| | | this.wsReconnectTimer = setTimeout(() => { |
| | | this.wsReconnectTimer = null; |
| | | this.wsReconnectAttempts = attempt; |
| | | this.connectWs(); |
| | | }, delay); |
| | | }, |
| | | getLevList() { |
| | | let that = this; |
| | |
| | | openCrn(id) { |
| | | this.crnParam.crnNo = id; |
| | | this.activateCard = 'crn'; |
| | | console.log(id); |
| | | }, |
| | | openDualCrn(id) { |
| | | this.dualCrnParam.crnNo = id; |
| | | this.activateCard = 'dualCrn'; |
| | | console.log(id); |
| | | |
| | | }, |
| | | openRgv(id) { |
| | | this.rgvParam.rgvNo = id; |