From c3b60d865c3457c35054446e81b352e93e00a696 Mon Sep 17 00:00:00 2001
From: xiaojiao <xiaojiao@kaokeziliao.com>
Date: 星期一, 12 一月 2026 18:31:11 +0800
Subject: [PATCH] 更改了大部分功能和逻辑
---
项目代码/PDA/pages/Inbound/InboundEmpty.vue | 98 +++++++++++++++++++++++++++++++++++-------------
1 files changed, 71 insertions(+), 27 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/PDA/pages/Inbound/InboundEmpty.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/PDA/pages/Inbound/InboundEmpty.vue"
index 513fbe3..c268526 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/PDA/pages/Inbound/InboundEmpty.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/PDA/pages/Inbound/InboundEmpty.vue"
@@ -23,14 +23,22 @@
:focus="value_rfidfocus" />
</u-td>
</u-tr>
-
</u-table>
</view>
<view style="padding: 0rpx 0rpx;">
<u-table>
<u-tr>
<u-td>
- <u-button style="width:100px" type="primary" @click="SaveInfomation">纭</u-button>
+ <!-- 鍏抽敭1锛氭牴鎹彁浜ょ姸鎬佺鐢ㄦ寜閽紝鎻愮ず鐢ㄦ埛姝e湪澶勭悊 -->
+ <u-button
+ style="width:100px"
+ type="primary"
+ @click="SaveInfomation"
+ :disabled="isSubmitting"
+ :loading="isSubmitting"
+ >
+ {{ isSubmitting ? '澶勭悊涓�...' : '纭' }}
+ </u-button>
</u-td>
</u-tr>
</u-table>
@@ -39,8 +47,7 @@
</template>
<script>
- var _this;
- var _user;
+ // 绉婚櫎鍏ㄥ眬_this锛屾敼鐢ㄧ澶村嚱鏁伴伩鍏峵his鎸囧悜闂
export default {
data() {
return {
@@ -48,7 +55,11 @@
CurrentUser: '', //褰撳墠鐢ㄦ埛
value_rfid: '',
value_qrcode: '',
- value_rfidfocus: false
+ value_rfidfocus: false,
+ timer: null, // 瀹氭椂鍣ㄥ彉閲忥紙琛ュ厖瀹氫箟锛岄伩鍏島ndefined锛�
+ isSubmitting: false, // 鍏抽敭2锛氭彁浜ょ姸鎬侀攣锛屾爣璁版槸鍚︽鍦ㄥ鐞嗚姹�
+ lastSubmitTime: 0, // 鍏抽敭3锛氳褰曟渶鍚庝竴娆℃彁浜ゆ椂闂达紝闃查槻鎶�
+ submitInterval: 3000 // 闃叉姈闂撮殧锛�3绉掑唴涓嶅厑璁搁噸澶嶆彁浜わ紙鍙皟鏁达級
}
},
methods: {
@@ -61,17 +72,38 @@
this.date = this.$DateTool.getDate();
}, 1000)
}
-
},
SaveInfomation() {
- if (_this.value_rfid.length == 0) {
+ // 闃叉姈鏍¢獙锛�3绉掑唴閲嶅鐐瑰嚮鐩存帴鎷︽埅
+ const now = Date.now();
+ if (now - this.lastSubmitTime < this.submitInterval) {
+ uni.showToast({
+ title: "璇峰嬁閲嶅鎻愪氦锛�",
+ duration: 2000,
+ icon: 'none'
+ });
+ return;
+ }
+
+ // 鎻愪氦鐘舵�侀攣锛氭鍦ㄥ鐞嗕腑鍒欐嫤鎴�
+ if (this.isSubmitting) {
+ uni.showToast({
+ title: "璇风◢鍊欙紝姝e湪澶勭悊涓�...",
+ duration: 2000,
+ icon: 'none'
+ });
+ return;
+ }
+
+ // 鍘熸湁瀛楁鏍¢獙
+ if (this.value_rfid.length == 0) {
uni.showToast({
title: "鎵樼洏鐮佷笉鑳戒负绌�",
duration: 2000
});
return;
}
- if (_this.value_rfid.length > 6) {
+ if (this.value_rfid.length > 6) {
uni.showToast({
title: "鎵樼洏闀垮害涓嶈兘澶т簬6浣嶆暟銆�",
duration: 2000,
@@ -79,45 +111,62 @@
});
return;
}
+
+ // 鏍囪涓烘彁浜や腑锛岀鐢ㄦ寜閽�
+ this.isSubmitting = true;
+ // 璁板綍鎻愪氦鏃堕棿锛岀敤浜庨槻鎶�
+ this.lastSubmitTime = now;
+
uni.showModal({
title: '鎻愮ず',
content: '璇锋牳瀵规墭鐩樼爜鏄惁姝g‘?',
- success: function(res) {
+ // 鍏抽敭4锛氭敼鐢ㄧ澶村嚱鏁帮紝閬垮厤this鎸囧悜涓㈠け
+ success: (res) => {
if (res.confirm) {
let data = {
MainData: {
- barcode: _this.value_rfid
+ barcode: this.value_rfid
},
};
- _this.$AjaxRequest.Params('post', 'Dt_boxing_head/CreateEmptyPalletTask',
- data, _user.token);
- _this.$AjaxRequest.Request().then(function(result) {
+ this.$AjaxRequest.Params('post', 'Dt_boxing_head/CreateEmptyPalletTask',
+ data, this.$UserTool.UserInfo.token);
+ this.$AjaxRequest.Request().then((result) => {
+ // 璇锋眰瀹屾垚锛岄噸缃彁浜ょ姸鎬�
+ this.isSubmitting = false;
if (result.data.status) {
uni.showToast({
title: "鍒涘缓绌烘墭鍏ュ簱鎴愬姛!",
duration: 2000
});
- _this.value_rfid = "";
- _this.value_qrcode = "";
- _this.value_rfidfocus = true;
+ this.value_rfid = "";
+ this.value_qrcode = "";
+ this.value_rfidfocus = true;
} else {
- //console.log(result.data.message);
uni.showToast({
icon: 'none',
title: "璇锋眰閿欒:" + result.data.message,
duration: 2000
});
}
- }).catch(function(err) {
+ }).catch((err) => {
+ // 寮傚父鎯呭喌锛屼篃瑕侀噸缃彁浜ょ姸鎬�
+ this.isSubmitting = false;
uni.showToast({
icon: 'none',
- title: "璇锋眰鍚庡彴寮傚父,閿欒淇℃伅." + err.errMsg,
+ title: "璇锋眰鍚庡彴寮傚父,閿欒淇℃伅:" + err.errMsg,
duration: 2000
});
});
} else if (res.cancel) {
+ // 鍙栨秷纭锛岄噸缃彁浜ょ姸鎬�
+ this.isSubmitting = false;
this.value_rfidfocus = true;
}
+ },
+ // 鍏抽敭5锛氬脊绐楀叧闂紙濡傜偣鍑荤┖鐧藉锛夛紝蹇呴』閲嶇疆鎻愪氦鐘舵��
+ complete: () => {
+ if (!this.isSubmitting) return; // 宸插鐞嗗畬鎴愬垯璺宠繃
+ this.isSubmitting = false;
}
});
},
@@ -127,8 +176,7 @@
clearInterval(this.timer)
this.timer = null;
this.setTimer();
- _user = this.$UserTool.UserInfo;
- this.CurrentUser = _user.userName;
+ this.CurrentUser = this.$UserTool.UserInfo.userName;
this.UserArray = [this.$UserTool.AllUserInfo];
this.value_rfidfocus = true;
},
@@ -138,11 +186,8 @@
this.timer = null;
},
mounted() {
- _this = this;
- //_this.queryOrder();
- },
-
-
+ // 绉婚櫎鍏ㄥ眬_this璧嬪�硷紝褰诲簳閬垮厤this鎸囧悜闂
+ }
}
</script>
@@ -160,7 +205,6 @@
.loopItem {
margin-top: 5px;
margin-left: 15px;
-
}
.deleteBtn {
--
Gitblit v1.9.3