From c2b0be1a368a88e4adb6dda12d0aa5d3bb0df838 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 27 六月 2023 16:50:50 +0800
Subject: [PATCH] 搜索最近穿梭车,提升机完成方法

---
 src/main/webapp/views/console.html |   69 ++++++++++++++++++++++++----------
 1 files changed, 49 insertions(+), 20 deletions(-)

diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html
index 5e0b60a..8f36d8b 100644
--- a/src/main/webapp/views/console.html
+++ b/src/main/webapp/views/console.html
@@ -24,7 +24,8 @@
                 <button class="floorBtn  btn-16" onclick="changFloor(this,3)" style="margin-top: 250px">3F</button>
                 <button class="floorBtn  btn-16" onclick="changFloor(this,4)" style="margin-top: 300px">4F</button>
             </div>
-            <button class="floorBtn  btn-16" onclick="testMove()" style="margin-top: 350px">娴嬭瘯绉诲姩杞�</button>
+            <button class="floorBtn  btn-16" onclick="testMove()" style="margin-top: 350px;font-size: 14px;">娴嬭瘯绉诲姩杞�</button>
+            <button class="floorBtn  btn-16" onclick="resetMap()" style="margin-top: 400px;font-size: 14px;">閲嶇疆鍦板浘</button>
 
         <!-- 璐ф灦 + 鍫嗗灈鏈� + 鍏ュ簱绔欑偣 -->
         <div class="main-part">
@@ -485,7 +486,7 @@
                             shuttleStatusClass = "shuttle-offline";
                             break
                         default:
-                            shuttleStatusClass = "shuttle-idle"
+                            shuttleStatusClass = "shuttle-offline"
                     }
                     let shuttleStatus = '<div class="state">' +
                         '<span>鍥涘悜绌挎杞� ' + item.shuttleNo + '</span>' +
@@ -522,13 +523,35 @@
 
     //鍒濆鍖栧湴鍥�
     function initMap(lev) {
+        getMap(lev)
+
+        $.ajax({
+            url: baseUrl+ "/shuttle/table/shuttle/state",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                res.data.forEach((item,index) => {
+                    if(lev == item.locNoLev){
+                        let carBox = '<div class="sxcar" id="sxcar-' + item.shuttleNo + '"></div>'
+                        $("#mapDataId").append(carBox)
+                    }
+                })
+            }
+        });
+    }
+
+    //鑾峰彇鍦板浘鏁版嵁
+    function getMap(lev) {
         //姣嶈建閬撶涓�娆$储寮曪紝鐢ㄤ簬瀹氫綅灏忚溅
         let firstMotherIndex = [0,0];
         $("#mapDataId").empty()
         $.ajax({
             type:"get",
-            url: baseUrl + "/static/js/map_" + lev + ".json",
-            success: (data) => {
+            // url: baseUrl + "/static/js/map_" + lev + ".json",
+            url: baseUrl + "/console/map/" + lev + "/auth",
+            headers: {'token': localStorage.getItem('token')},
+            success: (res) => {
+                let data = res.data
                 mapData = data
                 let content = ""
                 data.forEach((rowData,index) => {
@@ -540,6 +563,9 @@
                             if(!(idx == 0 || rowData.length - 1 == idx)){
                                 let col;
                                 switch (colData.value){
+                                    case -999:
+                                        col = '<button class="item" style="background:#f83333;color: #fff;">' + idx + '</button>';
+                                        break;
                                     case -1:
                                         col = '<button class="item" style="visibility: hidden">' + idx + '</button>';
                                         break;
@@ -579,20 +605,6 @@
                 $("#mapDataId").append(content)
             }
         })
-
-        $.ajax({
-            url: baseUrl+ "/shuttle/table/shuttle/state",
-            headers: {'token': localStorage.getItem('token')},
-            method: 'POST',
-            success: function (res) {
-                res.data.forEach((item,index) => {
-                    if(lev == item.locNoLev){
-                        let carBox = '<div class="sxcar" id="sxcar-' + item.shuttleNo + '"></div>'
-                        $("#mapDataId").append(carBox)
-                    }
-                })
-            }
-        });
     }
 
     //灏嗗湴鍥炬暟鎹浆鎹㈡垚int浜岀淮鏁扮粍(鍚庣画鐢ㄤ簬璇锋眰璁$畻璺緞鏃舵惡甯﹀湴鍥炬暟鎹弬鏁颁娇鐢�)
@@ -705,6 +717,23 @@
             moveCar(1, item.x, item.y);
         })
 
+    }
+
+    /**
+     * 閲嶇疆鍦板浘
+     */
+    function resetMap() {
+        $.ajax({
+            url:baseUrl+"/console/map/resetMap/auth",
+            headers:{
+                'token': localStorage.getItem('token')
+            },
+            data:{},
+            method:'get',
+            success:function (res) {
+                layer.msg('閲嶇疆瀹屾垚');
+            }
+        })
     }
 
     // 灏忚溅鍋忕Щ鍔ㄧ敾
@@ -918,11 +947,11 @@
             success: function (res) {
                 if (res.code === 200){
                     if (res.data.status) {
-                        $('#system-icon').attr("class", "system-icon-open");
+                        $('#system-toggle-checked').attr("checked", true);
                         $('#system-run-desc').html("绯荤粺杩愯涓�...");
                         parent.systemRunning = true;
                     } else {
-                        $('#system-icon').attr("class", "system-icon-close");
+                        $('#system-toggle-checked').attr("checked", false);
                         $('#system-run-desc').html("绯荤粺宸插仠姝�!");
                         parent.systemRunning = false;
                     }

--
Gitblit v1.9.1