From 900e4776223c2a42d8859fc8cd635c13ffcfb3b5 Mon Sep 17 00:00:00 2001
From: 如洲 陈 <1278080563@qq.com>
Date: 星期二, 30 九月 2025 11:12:13 +0800
Subject: [PATCH] 出库检优化

---
 pages/QC/THJ/Add.vue |  100 ++++++++++++++++++--------------------------------
 1 files changed, 36 insertions(+), 64 deletions(-)

diff --git a/pages/QC/THJ/Add.vue b/pages/QC/THJ/Add.vue
index 3a94f2b..01b1d66 100644
--- a/pages/QC/THJ/Add.vue
+++ b/pages/QC/THJ/Add.vue
@@ -15,8 +15,8 @@
 					<input class="form-input" disabled="true" type="text" v-model="formData.createDate" />
 				</view>
 				<view class="form-group">
-				  <label class="form-label">瀹㈡埛缂栧彿:</label>
-				  <input class="form-input" disabled="true" type="text" v-model="formData.customerNo"/>
+					<label class="form-label">瀹㈡埛鍚嶇О:</label>
+					<input class="form-input" disabled="true" type="text" v-model="formData.customerName"/>
 				</view>
 				<view class="form-group">
 					<label class="form-label">閫�璐у崟鍙�:</label>
@@ -209,7 +209,8 @@
 					returnNo: "", // 閫�璐х紪鍙凤紙鐢ㄤ簬鍙傛暟浼犻�掞級
 					createBy: "",
 					createDate: "",
-					customerNo: "", // 瀹㈡埛缂栧彿
+					customerNo: "", // 瀹㈡埛缂栧彿锛堝吋瀹逛繚鐣欙級
+					customerName: "", // 瀹㈡埛鍚嶇О
 					returnOrderNo: "", // 閫�璐у崟鍙�
 					returnQty: "", // 閫�璐ф暟閲�
 					returnReason: "", // 閫�璐у師鍥�
@@ -299,7 +300,6 @@
 
 
 			init() {
-				console.log("init鏂规硶寮�濮嬫墽琛岋紝formData.id:", this.formData.id);
 				return this.$post({
 					url: "/THJ/getPage",
 					data: {
@@ -308,7 +308,6 @@
 						limit: 1,
 					}
 				}).then(res => {
-					console.log("getPage API璋冪敤鎴愬姛");
 					let data = res.data.tbBillList[0];
 					if (data) {
 
@@ -410,22 +409,20 @@
 			},
 
 			editRemarks() {
-				if (this.remarks) {
-					//saveRemarksGid
-					this.$post({
-						url: "/THJ/saveRemarksGid",
-						data: {
-							gid: this.formData.id,
-							remarks: this.remarks
-						}
-					}).then(res => {
-						if (res.data.tbBillList > 0) {
-							this.formData.remarks = this.remarks;
-							this.remarksPopup = !this.remarksPopup;
-							this.$showMessage("淇濆瓨鎴愬姛");
-						}
-					})
-				}
+				// 鍏佽娓呯┖涓嶅悎鏍兼弿杩帮細鍚庣鎺ユ敹绌哄瓧绗︿覆
+				this.$post({
+					url: "/THJ/saveRemarksGid",
+					data: {
+						gid: this.formData.id,
+						remarks: this.remarks || ""
+					}
+				}).then(res => {
+					if (res.data.tbBillList > 0) {
+						this.formData.remarks = this.remarks || "";
+						this.remarksPopup = !this.remarksPopup;
+						this.$showMessage("淇濆瓨鎴愬姛");
+					}
+				})
 			},
 			toImage() {
 				uni.navigateTo({
@@ -433,7 +430,6 @@
 				});
 			},
 			getTable() {
-				console.log("寮�濮嬮噸鏂拌幏鍙栨楠岄」鐩�");
 				this.$post({
 					url: "/THJ/setInspectItem",
 					data: {
@@ -441,22 +437,16 @@
 						updateBy: this.$loginInfo.account
 					}
 				}).then(res => {
-					console.log("setInspectItem API璋冪敤鎴愬姛");
-					// 瀛樺偍杩囩▼鎵ц鎴愬姛锛屽埛鏂伴〉闈㈡暟鎹�
 					this.init().then(() => {
-						console.log("init鏂规硶鎵ц鎴愬姛");
 						this.$showMessage("妫�楠岄」鐩凡鏇存柊");
 					}).catch(error => {
-						console.log("init鏂规硶鎵ц寮傚父:", error);
 						this.$showMessage("妫�楠岄」鐩凡鏇存柊锛屼絾鍒锋柊鏁版嵁澶辫触");
 					}).finally(() => {
 						// 纭繚鐘舵�佹纭噸缃�
 						this.isSubmitting = false;
 						this.$forceUpdate();
-						console.log("getTable瀹屾垚锛屽己鍒堕噸缃甶sSubmitting涓篺alse");
 					});
 				}).catch(error => {
-					console.log("setInspectItem API璋冪敤澶辫触:", error);
 					// 瀛樺偍杩囩▼鎵ц澶辫触锛屾樉绀洪敊璇俊鎭�
 					this.$showMessage(error.message || "鑾峰彇妫�楠岄」鐩け璐�");
 					// 涓嶆敼鍙� isShowTable 鐘舵�侊紝淇濇寔鎸夐挳鍙
@@ -464,7 +454,6 @@
 					// 纭繚鐘舵�佹纭噸缃�
 					this.isSubmitting = false;
 					this.$forceUpdate();
-					console.log("getTable澶辫触锛屽己鍒堕噸缃甶sSubmitting涓篺alse");
 				});
 			},
 
@@ -542,9 +531,9 @@
 				}).then(res => {
 					let data = res.data.tbBillList[0];
 
-					if (!data) {
+							if (!data) {
 
-						this.formData.customerNo = "";
+								this.formData.customerName = "";
 						// 淇濇寔閫�璐ф槑缁嗕腑鐨勪俊鎭紝涓嶄粠鍚庣瑕嗙洊
 						// this.formData.returnOrderNo = "";
 						// this.formData.returnQty = "";
@@ -553,8 +542,8 @@
 						this.tableData = [];
 						return;
 					}
-					//涓嶄负绌烘椂璧嬪��
-					this.formData.customerNo = data.customerNo;
+							//涓嶄负绌烘椂璧嬪��
+							this.formData.customerName = data.customerName || this.formData.customerName;
 					// 濡傛灉鍚庣杩斿洖浜嗘洿瀹屾暣鐨勪俊鎭紝鍒欎娇鐢ㄥ悗绔殑
 					if (data.returnOrderNo) this.formData.returnOrderNo = data.returnOrderNo;
 					if (data.returnQty) this.formData.returnQty = data.returnQty;
@@ -614,16 +603,15 @@
 			// 鎵ц鎻愪氦
 			performSubmit() {
 				this.isSubmitting = true;
-				console.log("寮�濮嬫彁浜わ紝isSubmitting璁剧疆涓簍rue");
-				console.log("鎻愪氦鍙傛暟:", {
-					releaseNo: this.formData.releaseNo,
-					userNo: this.$loginInfo?.account || this.formData.createBy || "绯荤粺鐢ㄦ埛"
-				});
 				
 				// 鑾峰彇褰撳墠鐢ㄦ埛锛屽鏋滆幏鍙栦笉鍒板垯浣跨敤榛樿鍊�
 				const currentUser = this.$loginInfo?.account || this.formData.createBy || "绯荤粺鐢ㄦ埛";
 				
 				// 鐩存帴浣跨敤API璋冪敤锛屼笉浣跨敤Promise.race
+				const resetTimer = setTimeout(() => {
+					this.isSubmitting = false;
+					this.$forceUpdate();
+				}, 1000);
 				this.$post({
 					url: "/THJ/submitTHJResultByProcedure",
 					data: {
@@ -631,11 +619,6 @@
 						userNo: currentUser
 					}
 				}).then(res => {
-					console.log("=== 杩涘叆.then()鍧� ===");
-					console.log("API鍝嶅簲:", res);
-					console.log("鍝嶅簲鐘舵��:", res.status);
-					console.log("鍝嶅簲娑堟伅:", res.message);
-					console.log("鍝嶅簲鏁版嵁:", res.data);
 					
 					// 妫�鏌ュ绉嶅彲鑳界殑鍝嶅簲鏍煎紡
 					let status = res.status;
@@ -647,23 +630,19 @@
 						message = res.data.message || res.message;
 					}
 					
-					console.log("鏈�缁堢姸鎬�:", status);
-					console.log("鏈�缁堟秷鎭�:", message);
 					
 					if (status === 0) {
 						this.$showMessage("鎻愪氦鎴愬姛");
+						// 鎴愬姛绔嬪嵆澶嶄綅
+						this.isSubmitting = false;
+						this.$forceUpdate();
 					} else {
 						this.$showMessage("鎻愪氦澶辫触锛�" + (message || "鏈煡閿欒"));
+						// 澶辫触鍗虫椂澶嶄綅鎻愪氦鐘舵�侊紝閬垮厤鎸夐挳涓�鐩存樉绀烘彁浜や腑
+						this.isSubmitting = false;
+						this.$forceUpdate();
 					}
-					// 鏃犺鎴愬姛杩樻槸澶辫触閮藉埛鏂伴〉闈㈡暟鎹�
-					this.init().catch(error => {
-						console.log("init鏂规硶鎵ц寮傚父:", error);
-					});
 				}).catch(error => {
-					console.log("=== 杩涘叆.catch()鍧� ===");
-					console.log("API璋冪敤寮傚父:", error);
-					console.log("閿欒绫诲瀷:", typeof error);
-					console.log("閿欒璇︽儏:", error);
 					
 					let errorMessage = "鏈煡閿欒";
 					if (error.message) {
@@ -675,24 +654,18 @@
 					}
 					
 					this.$showMessage("鎻愪氦澶辫触锛�" + errorMessage);
+					// 寮傚父鏃朵篃绔嬪嵆澶嶄綅
+					this.isSubmitting = false;
+					this.$forceUpdate();
 					// 鍗充娇鍑虹幇寮傚父涔熷埛鏂伴〉闈㈡暟鎹�
 					this.init().catch(error => {
-						console.log("init鏂规硶鎵ц寮傚父:", error);
 					});
 				}).finally(() => {
-					console.log("=== 杩涘叆.finally()鍧� ===");
+					clearTimeout(resetTimer);
 					this.isSubmitting = false;
-					console.log("鎻愪氦瀹屾垚锛宨sSubmitting璁剧疆涓篺alse");
 					// 寮哄埗鏇存柊瑙嗗浘
 					this.$forceUpdate();
 					
-					// 澶囩敤鍒锋柊鏈哄埗锛氬欢杩熷埛鏂伴〉闈㈡暟鎹�
-					setTimeout(() => {
-						console.log("鎵ц澶囩敤鍒锋柊鏈哄埗");
-						this.init().catch(error => {
-							console.log("澶囩敤鍒锋柊澶辫触:", error);
-						});
-					}, 1000);
 				});
 			},
 		},
@@ -700,7 +673,6 @@
 			//姣忔杩涘叆椤甸潰閮戒細鎵ц鐨勬柟娉�
 			// 閲嶇疆鎻愪氦鐘舵�侊紝闃叉鐘舵�佸崱浣�
 			this.isSubmitting = false;
-			console.log("onShow: 閲嶇疆isSubmitting涓篺alse");
 			
 			// 濡傛灉formData.id涓虹┖锛屽皾璇曚粠URL鍙傛暟涓幏鍙�
 			if (!this.formData.id) {

--
Gitblit v1.9.3