From 4d29fcfc27c10a09a3ac5aaf52b6cd3407d11ade Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 19 一月 2026 13:55:40 +0800
Subject: [PATCH] 组盘前端添加防抖,首页的优化

---
 项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
index ee375f5..e7a1b57 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
@@ -203,6 +203,8 @@
       scanTimer: null,
       manualInputTimer: null,
       scanTarget: 'tray', // 褰撳墠鎵爜鐩爣: tray 鎴� material
+      isSubmitting: false, // 鏂板锛氭彁浜ら攣瀹氾紝闃叉閲嶅璇锋眰
+      groupedBarcodes: [],
 
       // 搴撳瓨缁熻鐩稿叧鍙橀噺
       totalStockSum: 0,
@@ -299,6 +301,7 @@
   methods: {
     open() {
       this.show = true;
+      this.orderNo = "";
       this.resetData();
       this.initLocationTypes();
       this.initwarehouseTypes();
@@ -317,7 +320,7 @@
     // 鏍规嵁鏉$爜鍒楄〃鑾峰彇璇︾粏鏁版嵁
     async fetchUnpalletMaterialDetails() {
       try {
-        const response = await http.post('/api/InboundOrder/UnPalletGroupBarcode?orderNo=' + this.docNo, {});
+        const response = await http.post('/api/InboundOrder/UnPalletGroupBarcode?orderNo=' + this.orderNo, {});
         if (response.status && Array.isArray(response.data)) {
           this.unpalletMaterials = response.data;
           this.unpalletBarcodes = response.data.map(item => item.barcode || '');
@@ -433,7 +436,8 @@
     },
     // 閲嶇疆鎵�鏈夋暟鎹�
     resetData() {
-      console.log('閲嶇疆寮规鏁版嵁');
+      this.groupedBarcodes = []; // 娓呯┖宸茬粍鐩樻潯鐮�
+      this.isSubmitting = false; // 閲嶇疆鎻愪氦閿�
       this.trayBarcode = '';
       this.barcode = '';
       this.materials = [];
@@ -619,6 +623,10 @@
 
     // 澶勭悊鐗╂枡鏉$爜鎻愪氦
     async handleBarcodeSubmit() {
+      if (this.isSubmitting) {
+    this.$message.warning('姝e湪澶勭悊涓紝璇风◢鍊�');
+    return;
+  }
       if (!await this.validateForm()) return;
       const currentBarcode = this.barcode.trim();
 
@@ -636,6 +644,7 @@
       this.focusBarcodeInput();
       this.error = '';
       this.loading = true;
+      this.isSubmitting = true; // 寮�鍚彁浜ら攣
 
       try {
         // 璋冪敤API鏌ヨ鐗╂枡淇℃伅
@@ -645,6 +654,7 @@
         }
 
         this.materials = [];
+        const newBarcodes = []; // 涓存椂瀛樺偍鏈鏂板鐨勬潯鐮�
         materialData.forEach(item => {
           this.materials.push({
             ...item,
@@ -653,9 +663,14 @@
             locationDesc: this.currentLocationDesc,
             scanTime: this.formatTime(new Date())
           });
+          newBarcodes.push(item.barcode); // 鏀堕泦鏈缁勭洏鐨勬潯鐮�
         });
+         // 灏嗘湰娆$粍鐩樼殑鏉$爜鍔犲叆宸茬粍鐩樺垪琛�
+        this.groupedBarcodes = [...new Set([...this.groupedBarcodes, ...newBarcodes])];
+
         this.orderNo = materialData[0].orderNo;
         await this.fetchStockStatistics(materialData[0].orderNo);
+        await this.fetchUnpalletMaterialDetails();
         // 娓呯┖鐗╂枡杈撳叆妗嗗苟淇濇寔鑱氱劍
         this.barcode = '';
         this.scanCode = ''; // 娓呯┖鎵爜缂撳瓨
@@ -674,6 +689,7 @@
         }, 100);
       } finally {
         this.loading = false;
+        this.isSubmitting = false; // 鍏抽棴鎻愪氦閿�
       }
     },
 
@@ -715,7 +731,7 @@
     // 澶勭悊鎵爜鏋緭鍏�
     handleKeyPress(event) {
       // 濡傛灉鏄墜鍔ㄨ緭鍏ユā寮忥紝涓嶅鐞嗘壂鐮佹灙閫昏緫
-      if (this.isManualInput) {
+      if (this.isManualInput || this.isSubmitting) {
         return;
       }
 
@@ -724,6 +740,7 @@
 
       // 蹇界暐鐩存帴鎸変笅鐨勫洖杞﹂敭锛堢敱handleBarcodeSubmit澶勭悊锛�
       if (key === 'Enter') {
+        event.preventDefault(); // 寮哄埗闃绘榛樿琛屼负锛岄伩鍏嶉噸澶嶈Е鍙�
         if (this.scanCode.length > 0) {
           // 闃绘榛樿鍥炶溅琛屼负锛岄伩鍏嶈〃鍗曟彁浜�
           event.preventDefault();

--
Gitblit v1.9.3