From c4b6b51afdd3374735ed5f358457987eaa6e476f Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 05 九月 2025 16:55:20 +0800
Subject: [PATCH] #
---
src/main/webapp/views/console.html | 98 +++++++++++++++++++++++++++++++++++++------------
1 files changed, 74 insertions(+), 24 deletions(-)
diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html
index 0199eea..538a39d 100644
--- a/src/main/webapp/views/console.html
+++ b/src/main/webapp/views/console.html
@@ -13,6 +13,9 @@
<script type="text/javascript" src="../static/js/common.js"></script>
<script type="text/javascript" src="../static/vue/js/vue.min.js"></script>
<script type="text/javascript" src="../static/vue/element/element.js"></script>
+ <style>
+
+ </style>
</head>
<body>
<div id="app">
@@ -57,15 +60,17 @@
</div>
</div>
- <!--杈撳嚭灏忚溅-->
- <div v-for="(car,idx) in currentLevShuttleList"
- :style="{
- left: getCarPosition(car.wcsPoint.x,car.wcsPoint.y)[1]
- ,top: getCarPosition(car.wcsPoint.x,car.wcsPoint.y)[0]
- ,color: shuttleColorList[car.shuttleNo]
- }"
- class="sxcar" :id="'sxcar-' + car.shuttleNo">
- {{car.shuttleNo}}
+ <div
+ v-for="(car, idx) in currentLevShuttleList"
+ :style="{
+ '--x-pos': getCarPosition(car.point.x, car.point.y)[1],
+ '--y-pos': getCarPosition(car.point.x, car.point.y)[0],
+ color: shuttleColorList[car.shuttleNo]
+ }"
+ class="sxcar"
+ :id="'sxcar-' + car.shuttleNo"
+ >
+ {{ car.shuttleNo }}
</div>
</div>
@@ -76,8 +81,9 @@
<el-button :style="{background:currentLev === lev ? '#7DCDFF':''}" @click="changFloor(lev)">{{lev}}F</el-button>
</div>
<div>
- <el-button @click="testMove()">娴嬭瘯绉诲姩杞�</el-button>
- <el-button @click="resetMap()">閲嶇疆鍦板浘</el-button>
+<!-- <el-button @click="testMove()">娴嬭瘯绉诲姩杞�</el-button>-->
+<!-- <el-button @click="resetMap()">閲嶇疆鍦板浘</el-button>-->
+<!-- <el-button @click="initLoc()">鍒濆鍖栧簱浣�</el-button>-->
</div>
</div>
</div>
@@ -333,7 +339,7 @@
map: [],//鍦板浘鏁版嵁
currentLev: 1,//鍦板浘褰撳墠妤煎眰
siteWindow: false, //绔欑偣寮圭獥鏄剧ず榛樿涓嶆樉绀�
- floorList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], //褰撳墠椤圭洰妤煎眰
+ floorList: [], //褰撳墠椤圭洰妤煎眰
shuttleList: [], //鍥涘悜绌挎杞﹂泦鍚�
currentLevShuttleList: [],//褰撳墠妤煎眰鍥涘悜绌挎杞﹂泦鍚�
shuttleColorList: [],//鍥涘悜绌挎杞﹂鑹查泦鍚�
@@ -352,16 +358,13 @@
},
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() //鑾峰彇杈撻�佺珯鐐规暟鎹�
@@ -414,7 +417,10 @@
},
getSiteInfo() {
//鑾峰彇杈撻�佺珯鐐规暟鎹�
- this.sendWs("{\"url\":\"/console/latest/data/site\",\"data\":{}}")
+ this.sendWs(JSON.stringify({
+ "url": "/console/latest/data/site",
+ "data": {}
+ }))
},
setSiteInfo(res) {
//鑾峰彇杈撻�佺珯鐐规暟鎹�
@@ -441,7 +447,10 @@
this.getMap(lev)
},
getShuttleStateInfo() {
- this.sendWs("{\"url\":\"/shuttle/table/shuttle/state\",\"data\":{}}")
+ this.sendWs(JSON.stringify({
+ "url": "/shuttle/table/shuttle/state",
+ "data": {}
+ }))
},
setShuttleStateInfo(res) {
// 鍥涘悜绌挎杞︿俊鎭〃鑾峰彇
@@ -469,7 +478,10 @@
},
getLiftStateInfo() {
// 鎻愬崌鏈轰俊鎭〃鑾峰彇
- this.sendWs("{\"url\":\"/lift/table/lift/state\",\"data\":{}}")
+ this.sendWs(JSON.stringify({
+ "url": "/lift/table/lift/state",
+ "data": {}
+ }))
},
setLiftStateInfo(res) {
// 鎻愬崌鏈轰俊鎭〃鑾峰彇
@@ -589,8 +601,8 @@
let tmp = null
tmp = setInterval(() => {
if (index < res.length) {
- that.currentLevShuttleList[0].wcsPoint.y = res[index].y
- that.currentLevShuttleList[0].wcsPoint.x = res[index].x
+ that.currentLevShuttleList[0].point.y = res[index].y
+ that.currentLevShuttleList[0].point.x = res[index].x
index++
}else {
clearInterval(tmp)
@@ -653,6 +665,29 @@
}
})
},
+ initLev(){
+ let that = this
+ $.ajax({
+ url: baseUrl + "/console/map/lev/list",
+ headers: {
+ 'token': localStorage.getItem('token')
+ },
+ data: {},
+ method: 'get',
+ success: function(res) {
+ if (res.code === 200) {
+ that.floorList = res.data;
+ } else if (res.code === 403) {
+ parent.location.href = baseUrl + "/login";
+ } else {
+ that.$message({
+ message: res.msg,
+ type: 'error'
+ });
+ }
+ }
+ });
+ },
getCodeData(){
this.sendWs(JSON.stringify({
"url": "/console/barcode/output/site",
@@ -670,10 +705,20 @@
}
}
},
+ 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) {
@@ -691,11 +736,16 @@
}
},
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);
}
}
}
--
Gitblit v1.9.1