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 | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 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 d401f8b..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,
@@ -434,6 +436,8 @@
},
// 閲嶇疆鎵�鏈夋暟鎹�
resetData() {
+ 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,7 +663,11 @@
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();
@@ -675,6 +689,7 @@
}, 100);
} finally {
this.loading = false;
+ this.isSubmitting = false; // 鍏抽棴鎻愪氦閿�
}
},
@@ -716,7 +731,7 @@
// 澶勭悊鎵爜鏋緭鍏�
handleKeyPress(event) {
// 濡傛灉鏄墜鍔ㄨ緭鍏ユā寮忥紝涓嶅鐞嗘壂鐮佹灙閫昏緫
- if (this.isManualInput) {
+ if (this.isManualInput || this.isSubmitting) {
return;
}
@@ -725,6 +740,7 @@
// 蹇界暐鐩存帴鎸変笅鐨勫洖杞﹂敭锛堢敱handleBarcodeSubmit澶勭悊锛�
if (key === 'Enter') {
+ event.preventDefault(); // 寮哄埗闃绘榛樿琛屼负锛岄伩鍏嶉噸澶嶈Е鍙�
if (this.scanCode.length > 0) {
// 闃绘榛樿鍥炶溅琛屼负锛岄伩鍏嶈〃鍗曟彁浜�
event.preventDefault();
--
Gitblit v1.9.3