From 03e68b2be24ea024eae645c47da1d4cb1773302a Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 13 十月 2023 19:47:13 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/console.html |  103 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 88 insertions(+), 15 deletions(-)

diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html
index d2102cf..f03c349 100644
--- a/src/main/webapp/views/console.html
+++ b/src/main/webapp/views/console.html
@@ -22,28 +22,28 @@
 						<div v-for="(col,idx) in row" :key="idx">
 							<div v-if="col.value == 0">
 								<!-- 瀛愯建閬� 璺緞涓虹┛姊溅棰勮璺緞鍒欐樉绀虹┛姊溅棰滆壊鍜岀┛姊溅鍙� -->
-								<div :style="{background: checkAdvancePath(index,idx) == null ? '':shuttleColorList[checkAdvancePath(index,idx)]}" class="item" v-if="col.data.length > 0">{{col.data}}</div>
-								<div :style="{background: checkAdvancePath(index,idx) == null ? '':shuttleColorList[checkAdvancePath(index,idx)]}" class="item" v-else>{{checkAdvancePath(index,idx) == null ? idx:checkAdvancePath(index,idx)}}</div>
+								<div :style="{background: checkAdvancePath(index,idx).length == 0 ? '':shuttleColorList[checkAdvancePath(index,idx)[0]]}" class="item" v-if="col.data.length > 0">{{col.data}}</div>
+								<div :style="{background: checkAdvancePath(index,idx).length == 0 ? '':shuttleColorList[checkAdvancePath(index,idx)[0]]}" class="item" v-else>{{checkAdvancePath(index,idx).length == 0 ? idx:checkAdvancePath(index,idx)}}</div>
 							</div>
 							<div v-else-if="col.value == 3">
 								<!-- 姣嶈建閬� 璺緞涓虹┛姊溅棰勮璺緞鍒欐樉绀虹┛姊溅棰滆壊鍜岀┛姊溅鍙� -->
-								<div :style="{background: checkAdvancePath(index,idx) == null ? '#5af':shuttleColorList[checkAdvancePath(index,idx)]}" class="item">{{checkAdvancePath(index,idx) == null ? '&#x21c5;&#x21c4;':checkAdvancePath(index,idx)}}</div>
+								<div :style="{background: checkAdvancePath(index,idx).length == 0 ? '#5af':shuttleColorList[checkAdvancePath(index,idx)[0]]}" class="item">{{checkAdvancePath(index,idx).length == 0 ? '&#x21c5;&#x21c4;':checkAdvancePath(index,idx)}}</div>
 							</div>
 							<div v-else-if="col.value == 4">
 								<!-- 绔欑偣 -->
-								<div class="site" @click="openSite(col.data)">{{col.data}}</div>
+								<div class="site" :id="'site-' + col.data" @click="openSite(col.data)">{{col.data}}</div>
 							</div>
 							<div v-else-if="col.value == 5">
 								<!-- 鍏呯數妗� -->
 								<div class="item" style="font-size: 24px">&#9889;</div>
 							</div>
-							<div v-else-if="col.value < 0">
-								<!-- 绂佹鏄剧ず鍖哄煙 -->
-								<div class="item" style="visibility: hidden">{{idx}}</div>
-							</div>
 							<div v-else-if="col.value == -999">
 								<!-- 璺緞鍗犵敤鍖哄煙 -->
 								<div class="item" style="background:#f83333;color: #fff;">{{idx}}</div>
+							</div>
+							<div v-else-if="col.value < 0">
+								<!-- 绂佹鏄剧ず鍖哄煙 -->
+								<div class="item" style="visibility: hidden">{{idx}}</div>
 							</div>
 							<div v-else>
 								<div class="item" v-if="col.data.length > 0">{{col.data}}</div>
@@ -73,10 +73,11 @@
 				<!--杈撳嚭妤煎眰-->
 				<div style="height: 100%;">
 					<div class="floorBtnBox" v-for="(lev,idx) in floorList">
-						<el-button @click="changFloor(lev)">{{lev}}F</el-button>
+						<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>
 					</div>
 				</div>
 			</div>
@@ -186,7 +187,7 @@
 							<li><span>鏉$爜鍚嶇О</span><span class="right">鎵爜鏃堕棿</span></li>
 						</div>
 						<div id="barcode1" class="table-body">
-
+							<li v-for="(item,index) in codeList1" :key="index"><span>{{item.barcode}}</span><span class="right">{{item.time}}</span></li>
 						</div>
 					</div>
 					<div class="tablebox">
@@ -194,7 +195,7 @@
 							<li><span>鏉$爜鍚嶇О</span><span class="right">鎵爜鏃堕棿</span></li>
 						</div>
 						<div id="barcode2" class="table-body">
-
+							<li v-for="(item,index) in codeList2" :key="index"><span>{{item.barcode}}</span><span class="right">{{item.time}}</span></li>
 						</div>
 					</div>
 				</div>
@@ -339,6 +340,8 @@
 					liftList: [], //鎻愬崌鏈洪泦鍚�
 					systemStatus: true,//绯荤粺杩愯鐘舵��
 					consoleInterval: null,//瀹氭椂鍣ㄥ瓨鍌ㄥ彉閲�
+					codeList1: [],//鏉$爜List
+					codeList2: [],//鏉$爜List
 				},
 				created() {
 					this.init()
@@ -354,6 +357,9 @@
 						this.consoleInterval = setInterval(() => {
 							this.getShuttleStateInfo() //鑾峰彇鍥涘悜绌挎杞︿俊鎭�
 							this.getLiftStateInfo() //鑾峰彇鎻愬崌鏈轰俊鎭�
+							this.getSiteInfo() //鑾峰彇杈撻�佺珯鐐规暟鎹�
+							this.getMap(this.currentLev) //鑾峰彇瀹炴椂鍦板浘鏁版嵁
+							this.getCodeData()//鑾峰彇鏉$爜
 						}, 1000)
 					},
 					//鑾峰彇鍦板浘鏁版嵁
@@ -370,6 +376,7 @@
 								for (let i = 1; i < data.length - 1; i++) {
 									tmp.push(data[i])
 								}
+								// console.log(tmp)
 								this.map = tmp
 							}
 						})
@@ -400,6 +407,32 @@
 
 						})
 					},
+					getSiteInfo() {
+						//鑾峰彇杈撻�佺珯鐐规暟鎹�
+						$.ajax({
+							url: baseUrl+ "/console/latest/data/site",
+							headers: {'token': localStorage.getItem('token')},
+							method: 'POST',
+							success: function (res) {
+								if (res.code === 200){
+									var sites = res.data;
+									for (var i = 0; i < sites.length; i++){
+										var siteEl = $("#site-"+sites[i].siteId);
+										siteEl.attr("class", "site " + sites[i].siteStatus);
+										if (sites[i].workNo != null && sites[i].workNo>0) {
+											siteEl.html(sites[i].siteId + "[" + sites[i].workNo + "]");
+										} else {
+											siteEl.html(sites[i].siteId);
+										}
+									}
+								} else if (res.code === 403){
+									parent.location.href = baseUrl+"/login";
+								}  else {
+									console.log(res.msg);
+								}
+							}
+						});
+					},
 					changFloor(lev) {
 						this.currentLev = lev
 						this.currentLevShuttleList = []
@@ -418,8 +451,10 @@
 								if (res.code == 200) {
 									let currentLevShuttle = []//褰撳墠妤煎眰灏忚溅闆嗗悎
 									res.data.forEach((item,idx) => {
-										if (item.point.z == that.currentLev) {
-											currentLevShuttle.push(item)
+										if (item != null && item.point != undefined && item.point != null) {
+											if (item.point.z == that.currentLev) {
+												currentLevShuttle.push(item);
+											}
 										}
 									})
 									that.currentLevShuttleList = currentLevShuttle
@@ -593,6 +628,7 @@
 								})
 							}
 						})
+						let data = []
 						let shuttleList = this.currentLevShuttleList;
 						for (var i = 0; i < shuttleList.length; i++) {
 							let shuttle = shuttleList[i]
@@ -601,12 +637,49 @@
 								for (var j = 0; j < moveAdvancePath.length; j++) {
 									let path = moveAdvancePath[j]
 									if (path.x-1 === x && path.y === y) {//璺緞绗﹀悎
-										return shuttle.shuttleNo;//杩斿洖灏忚溅鍙�
+										data.push(shuttle.shuttleNo)
+										continue;
 									}
 								}
 							}
 						}
-						return null;
+						return data;//杩斿洖灏忚溅鍙烽泦鍚�
+					},
+					resetMap() {
+						//閲嶇疆鍦板浘
+						let that = this
+						$.ajax({
+							url:baseUrl+"/console/map/resetMap/auth",
+							headers:{
+								'token': localStorage.getItem('token')
+							},
+							data:{},
+							method:'get',
+							success:function (res) {
+								that.$message({
+									message: '閲嶇疆瀹屾垚',
+									type: 'success'
+								});
+							}
+						})
+					},
+					getCodeData(){
+						let that = this
+						$.ajax({
+							url:baseUrl +'/console/barcode/output/site',
+							method:'GET',
+							success:function (res) {
+								if(res.code === 200){
+									let data = JSON.parse(res.data)
+									if(data.length<=5){
+										that.codeList1 = data
+									} else {
+										tData1 = data.slice(0,5)
+										tData2 = data.splice(5,10)
+									}
+								}
+							}
+						})
 					}
 				}
 			})

--
Gitblit v1.9.1