From 53aad5698fb113201e79b5cca981bdfb13d23d97 Mon Sep 17 00:00:00 2001
From: jinglun-cloud <jinglun2019@foxmail.com>
Date: 星期二, 05 五月 2026 14:45:44 +0800
Subject: [PATCH] 简化设备长宽计算的实现

---
 src/main/webapp/static/js/basMap/editor.js |   62 ++++++++++++------------------
 1 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/src/main/webapp/static/js/basMap/editor.js b/src/main/webapp/static/js/basMap/editor.js
index f164257..0d65549 100644
--- a/src/main/webapp/static/js/basMap/editor.js
+++ b/src/main/webapp/static/js/basMap/editor.js
@@ -2108,13 +2108,13 @@
           barCodeStart: 0,
           barCodeEnd: 100000,
           deviceList: [
-            {
-              valueKey: '',
-              deviceNo: '',
-              progress: 0,
-              deviceLength: '',
-              deviceWidth: ''
-            }
+            // {
+            //   valueKey: '',
+            //   deviceNo: '',
+            //   progress: 0,
+            //   deviceLength: '',
+            //   deviceWidth: ''
+            // }
           ]
         };
       },
@@ -2176,11 +2176,11 @@
       },
       getDeviceLengthPlaceholder: function () {
         var box = this.getAutoTrackDeviceBox();
-        return box && box.along ? '榛樿: ' + box.along : '';
+        return box && box.along ? '鍙傝��: ' + box.along : '';
       },
       getDeviceWidthPlaceholder: function () {
         var box = this.getAutoTrackDeviceBox();
-        return box && box.across ? '榛樿: ' + box.across : '';
+        return box && box.across ? '鍙傝��: ' + box.across : '';
       },
       loadDeviceForm: function (type, value) {
         this.resetDeviceForm();
@@ -2193,13 +2193,13 @@
           barCodeStart: 0,
           barCodeEnd: 100000,
           deviceList: [
-            {
-              valueKey: '',
-              deviceNo: '',
-              progress: 0,
-              deviceLength: '',
-              deviceWidth: ''
-            }
+            // {
+            //   valueKey: '',
+            //   deviceNo: '',
+            //   progress: 0,
+            //   deviceLength: '',
+            //   deviceWidth: ''
+            // }
           ],
           ...json
         };
@@ -2326,12 +2326,13 @@
         });
       },
       addDeviceForm: function () {
+        const defaultDeviceBox = this.getAutoTrackDeviceBox();
         this.deviceForm.deviceList.push({
           valueKey: '',
           deviceNo: '',
           progress: 0,
-          deviceLength: '',
-          deviceWidth: ''
+          deviceLength: "",
+          deviceWidth: ""
         });
       },
       applyDeviceForm: function () {
@@ -2348,7 +2349,7 @@
         if (
           !this.deviceForm.deviceList ||
           this.deviceForm.deviceList.length === 0 ||
-          this.deviceForm.deviceList.some((item) => item.deviceNo === '')
+          this.deviceForm.deviceList.some((item) => item.deviceNo === '' || item.deviceLength === '' || item.deviceWidth === '')
         ) {
           this.showMessage('warning', '璁惧鍒楄〃涓嶈兘涓虹┖');
           return;
@@ -2361,19 +2362,6 @@
           delete payload.rgvNo;
           self.deviceForm.deviceList.forEach((item) => {
             item.valueKey = valueKey;
-            // 鍏佽閫氳繃灞炴�ч潰鏉胯鐩栭粯璁よ澶囧儚绱犲昂瀵革紙娌胯建閬�/鍨傜洿杞ㄩ亾锛�
-            var deviceLength = toInt(item.deviceLength, 0);
-            var deviceWidth = toInt(item.deviceWidth, 0);
-            if (deviceLength > 0) {
-              item.deviceLength = String(deviceLength);
-            } else {
-              delete item.deviceLength;
-            }
-            if (deviceWidth > 0) {
-              item.deviceWidth = String(deviceWidth);
-            } else {
-              delete item.deviceWidth;
-            }
           });
           self.deviceForm.trackId = String(trackId);
           self.deviceForm.barCodeStart = toInt(self.deviceForm.barCodeStart, 0);
@@ -4595,11 +4583,11 @@
               newElement.value = JSON.stringify({
                 trackId: this.getNextDeviceTrackId(null),
                 deviceList: [
-                  {
-                    valueKey: '',
-                    deviceNo: '',
-                    progress: 0
-                  }
+                  // {
+                  //   valueKey: '',
+                  //   deviceNo: '',
+                  //   progress: 0
+                  // }
                 ]
               });
             }

--
Gitblit v1.9.1