From 1db2fb1739982ce77e16c04fccb200f04467bb22 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 20 十一月 2024 14:59:23 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/console.js |   82 +++++++++++++++++++++++++++++-----------
 1 files changed, 59 insertions(+), 23 deletions(-)

diff --git a/src/main/webapp/static/js/console.js b/src/main/webapp/static/js/console.js
index 707d1fa..570c792 100644
--- a/src/main/webapp/static/js/console.js
+++ b/src/main/webapp/static/js/console.js
@@ -10,6 +10,8 @@
     tracks = '',
     stn = '',
     stns = '',
+    barcode = '',
+    barcodeArr = [],
     stnArr = [],
     floorBtn = '',
     floorBtns = '',
@@ -25,36 +27,59 @@
     for (let i = 0;i < rackss.length;i++) {
         let bay ='' // 鍗曚釜搴撲綅
         let bays = '' // 搴撲綅闆嗗悎
-        let bayWidth = rackss[i].width / (rackss[i].maxBayNo / rackss[i].minBayNo)
         let maxBayNo = rackss[i].maxBayNo // 鏈�澶у簱浣嶅彿
         let minBayNo = rackss[i].minBayNo // 鏈�灏忓簱浣嶅彿
-        let bLen = maxBayNo / minBayNo // 搴撲綅涓暟
+        let bLen
+        let interval // 闂撮殧鏁�
+
+        if (maxBayNo<35) {
+            interval = 1
+            bLen = maxBayNo / interval // 搴撲綅涓暟
+        } else {
+            interval = 2
+            bLen = maxBayNo / interval // 搴撲綅涓暟
+        }
+        let bayWidth // 鍗曚釜搴撲綅瀹藉害
         let bNum // 搴撲綅鍙风爜
-        // hpPosition 0 琛ㄧず璐ф灦搴忓彿 宸�->鍙� 1 琛ㄧず璐ф灦搴忓彿 鍙�->宸�
+
+        if (minBayNo % 2 == 0) { // 浠�2寮�濮�
+            if(interval == 1) {
+                bLen = bLen - 1
+            } else if (interval == 2) {
+                if (maxBayNo % 2 == 0) { // 鍋舵暟
+                    bLen = bLen
+                } else { // 濂囨暟
+                    maxBayNo = maxBayNo + 1
+                    bLen = maxBayNo / interval // 搴撲綅涓暟
+                }
+            }
+        } else { // 浠�1寮�濮�
+            if(interval == 1) {
+                bLen = bLen
+            } else if (interval == 2) {
+                if (maxBayNo % 2 == 0) { // 鍋舵暟
+                    bLen = bLen
+                } else { // 濂囨暟
+                    bLen = bLen + 1
+                }
+            }
+        }
+        bayWidth = rackss[i].width / bLen
+        // hpPosition 0 琛ㄧず璐ф灦搴忓彿 宸�->鍙� 1 琛ㄧず璐ф灦搴忓彿 宸�<-鍙�
         if (mapInfo.hpPosition == 1) {
             bNum = maxBayNo
             for (let j = bLen; j > 0; j--) {
                 bay = "<button class='item' style='width: "+ bayWidth +"px'>" + bNum + "</button>"
                 bays = bays + bay
-                bNum = bNum - minBayNo;
+                bNum = bNum - interval;
             }
         }else {
-            if (minBayNo % 2 == 0) {
-                bNum = minBayNo
-                for (let j = 0; j < bLen; j++) {
-                    bay = "<button class='item' style='width: "+ bayWidth +"px'>" + bNum + "</button>"
-                    bays = bays + bay
-                    bNum = bNum + minBayNo;
-                }
-            } else {
-                bNum = minBayNo + 1
-                for (let j = 0; j < bLen; j++) {
-                    bay = "<button class='item' style='width: "+ bayWidth +"px'>" + bNum + "</button>"
-                    bays = bays + bay
-                    bNum = bNum + minBayNo;
-                }
+            bNum = minBayNo
+            for (let j = 0; j < bLen; j++) {
+                bay = "<button class='item' style='width: "+ bayWidth +"px'>" + bNum + "</button>"
+                bays = bays + bay
+                bNum = bNum + interval;
             }
-
         }
 
         rack = "<div class='rack' id='" + rackss[i].id +
@@ -102,10 +127,11 @@
 
         let stnss = areas[i].stns
         let floor = areas[i].text
+        let barcodes = areas[i].barcode
         floorId = areas[i].id
-        var position = (i+1)*100
+        var position = (i+1)*100 +400
         floorBtn =
-            "<button class='floorBtn btn-16' onclick='changFloor("+i+")' style='top: "+position+"px;'>" + floor +"</button>"
+            "<button class='floorBtn btn-16' onclick='changFloor("+i+")' style='top: "+10+"px;left: "+position+"px;'>" + floor +"</button>"
         if (mapInfo.areas[0].floors.length == 1) {
             floorBtnss = ''
         } else {
@@ -116,6 +142,7 @@
         var n = 1
         stnArr[index] = ''
         total[index] = ''
+        barcodeArr[index] = ''
         for (let j = 0; j < stnss.length; j++) {
             if (stnss[j].type == "stn") {
                 stn = "<div class='site' id='" + stnss[j].id +
@@ -139,9 +166,18 @@
             }
 
         }
+        for (let k = 0; k < barcodes.length; k++) {
+            barcode = "<div class='barcode' id='" + barcodes[k].id +
+                "'style='width:" + barcodes[k].width +
+                "px;height: " + barcodes[k].height +
+                "px;line-height: " + barcodes[k].height +
+                "px;top: "+ barcodes[k].top +
+                "px;left: "+ barcodes[k].left + "px'>" + "</div>"
+            barcodeArr[i] = barcodeArr[i] + barcode
+        }
 
     }
-    floorInfo = racks + rackDescs + tracks + crns + stnArr[0] + floorBtnss
+    floorInfo = racks + rackDescs + tracks + crns + stnArr[0] + floorBtnss+ barcodeArr[0]
 
     $(".main-part").append(floorInfo)
     $("#line-total").html(total[0])
@@ -150,7 +186,7 @@
 }
 function changFloor(e) {
     $(".main-part").empty()  // 娓呯┖鑺傜偣
-    floorInfo = racks  + stnArr[e] +rackDescs + crns + tracks + floorBtnss
+    floorInfo = racks  + stnArr[e] +rackDescs + crns + tracks + floorBtnss+ barcodeArr[0]
     $(".main-part").append(floorInfo)
     $("#line-total").empty()
     $("#line-total").html(total[e])

--
Gitblit v1.9.1