From a40b871aa511865d1a7363c88ffb733f6b084d35 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 02 三月 2026 17:14:15 +0800
Subject: [PATCH] #

---
 src/main/webapp/components/DevpCard.js |   79 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 2 deletions(-)

diff --git a/src/main/webapp/components/DevpCard.js b/src/main/webapp/components/DevpCard.js
index 20de078..361ba72 100644
--- a/src/main/webapp/components/DevpCard.js
+++ b/src/main/webapp/components/DevpCard.js
@@ -53,9 +53,9 @@
                       />
                       <div style="margin-top: 4px; font-size: 12px; word-break: break-all;">{{ item.barcode }}</div>
                     </div>
-                    <span slot="reference" style="cursor: pointer; color: #409EFF;">{{ item.barcode }}</span>
+                    <span slot="reference" @click.stop="handleBarcodeClick(item)" style="cursor: pointer; color: #409EFF;">{{ item.barcode }}</span>
                   </el-popover>
-                  <span v-else>-</span>
+                  <span v-else @click.stop="handleBarcodeClick(item)" style="cursor: pointer; color: #409EFF;">-</span>
                 </el-descriptions-item>
                 <el-descriptions-item label="閲嶉噺">{{ item.weight }}</el-descriptions-item>
                 <el-descriptions-item label="鏁呴殰浠g爜">{{ item.error }}</el-descriptions-item>
@@ -303,6 +303,81 @@
         }
       }
     },
+    handleBarcodeClick(item) {
+      if (this.readOnly || !item || item.stationId == null) {
+        return;
+      }
+
+      let that = this;
+      $.ajax({
+        url: baseUrl + "/openapi/getFakeSystemRunStatus",
+        headers: {
+          token: localStorage.getItem("token"),
+        },
+        method: "get",
+        success: (res) => {
+          if (res.code !== 200 || !res.data || !res.data.isFake || !res.data.running) {
+            that.$message({
+              message: "浠呬豢鐪熸ā寮忚繍琛屼腑鍙慨鏀规潯鐮�",
+              type: "warning",
+            });
+            return;
+          }
+
+          that.$prompt("璇疯緭鍏ユ柊鐨勬潯鐮佸�硷紙鍙暀绌烘竻绌猴級", "淇敼鏉$爜", {
+            confirmButtonText: "纭畾",
+            cancelButtonText: "鍙栨秷",
+            inputValue: item.barcode || "",
+            inputPlaceholder: "璇疯緭鍏ユ潯鐮�",
+          }).then(({ value }) => {
+            that.updateStationBarcode(item.stationId, value == null ? "" : String(value).trim());
+          }).catch(() => {});
+        },
+      });
+    },
+    updateStationBarcode(stationId, barcode) {
+      let that = this;
+      $.ajax({
+        url: baseUrl + "/station/command/barcode",
+        headers: {
+          token: localStorage.getItem("token"),
+        },
+        contentType: "application/json",
+        method: "post",
+        data: JSON.stringify({
+          stationId: stationId,
+          barcode: barcode,
+        }),
+        success: (res) => {
+          if (res.code == 200) {
+            that.syncLocalBarcode(stationId, barcode);
+            that.$message({
+              message: "鏉$爜淇敼鎴愬姛",
+              type: "success",
+            });
+          } else {
+            that.$message({
+              message: res.msg || "鏉$爜淇敼澶辫触",
+              type: "warning",
+            });
+          }
+        },
+      });
+    },
+    syncLocalBarcode(stationId, barcode) {
+      let updateFn = (list) => {
+        if (!list || list.length === 0) {
+          return;
+        }
+        list.forEach((row) => {
+          if (row.stationId == stationId) {
+            row.barcode = barcode;
+          }
+        });
+      };
+      updateFn(this.stationList);
+      updateFn(this.fullStationList);
+    },
     openControl() {
       this.showControl = !this.showControl;
     },

--
Gitblit v1.9.1