From 0d3eadb50310ca60b8871e967e64da01aa25a9ad Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期五, 27 六月 2025 16:55:51 +0800
Subject: [PATCH] 破坏实验按钮添加

---
 pages/QC/LLJ/Add.vue |  255 ++++++++++++++++++++++++++++----------------------
 1 files changed, 143 insertions(+), 112 deletions(-)

diff --git a/pages/QC/LLJ/Add.vue b/pages/QC/LLJ/Add.vue
index 3d0778d..f0497dc 100644
--- a/pages/QC/LLJ/Add.vue
+++ b/pages/QC/LLJ/Add.vue
@@ -89,11 +89,15 @@
 
 			</select>
 		</view>
-		<view class="info-block" style="margin-top: 10px;">   
+					<view class="info-block" style="margin-top: 10px;">   
 		    <view class="info-label">澶囨敞锛�</view>
 		    <input type="text" id="lotNo1" v-model="formData.lotNo1" 
 		                       placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�" 
 		                       style="color: red; font-weight: bold;"/> 
+		</view>
+		<view class="info-block" style="margin-top: 10px;">   
+		    <view class="info-label">鐮村潖瀹為獙鏁伴噺锛�</view>
+		    <view class="info-value highlight">{{formData.phsy}}</view>
 		</view>
 		
 
@@ -145,6 +149,7 @@
 
 		<!-- 鎿嶄綔鎸夐挳鍖� -->
 		<view class="action-buttons">
+			<button class="secondary-btn" @click="addDestruction" v-if="this.current">鐮村潖瀹為獙</button>
 			<button class="secondary-btn" @click="uploadImages">涓婁紶/鏌ョ湅鍥剧墖</button>
 			<button class="secondary-btn" @click="fetchDrawingNumber">璋冨彇PLM鍥剧焊</button>
 			<button class="secondary-btn" @click="addDefectDescription" v-if="this.current">娣诲姞涓嶈壇鎻忚堪</button>
@@ -165,6 +170,21 @@
 			</view>
 		</view>
 		
+		<view v-if="destructionPopup" class="overlay">
+			<view class="popup">
+				<h3>鐮村潖瀹為獙鏁伴噺</h3>
+				<form>
+					<view class="form-group">
+						<label class="form-label">鐮村潖瀹為獙鏁伴噺:</label>
+						<input class="form-input" type="text" v-model="PHSY" placeholder="鐣欑┖琛ㄧず娓呴櫎鏁伴噺" />
+					</view>
+				</form>
+				<div v-if="!isInteger" class="error-message">璇疯緭鍏ユ暣鏁板�兼垨鐣欑┖</div>
+				<button class="updateBut" @click="editDestruction">淇敼</button>
+				<button @click="clearDestruction">娓呴櫎</button>
+				<button @click="destructionPopup = !destructionPopup">鍙栨秷</button>
+			</view>
+		</view>
 		
 		<view class="barcode">
 			<u-modal :show="drawingShow" title="鍥剧焊鏄庣粏" @confirm="drawingConfirm" @cancel="drawingCancel"
@@ -225,6 +245,7 @@
 					permissionAccount: '',
 					hasEmergencyPermission: false,
 					showPopup: false,
+					PHSY:'',
 					
 				},
 				tableData: [],
@@ -242,6 +263,9 @@
 				fileName:'',
 				originalRemarks: '',
 				hasEmergencyPermission: false,
+				destructionPopup: false,
+				PHSY: '',
+				isInteger: true,
 				
 			}
 		},
@@ -306,7 +330,8 @@
 					data: {
 						itemNo: this.formData.itemId,
 						quantity: this.formData.fcovertQty,
-						releaseNo: this.formData.releaseNo
+						releaseNo: this.formData.releaseNo,
+						PHSY: this.formData.PHSY
 					}
 				}).then(res => {
 					if (res.status == 0) {
@@ -540,6 +565,9 @@
 							...data,
 							emergencyStatus: data.emergency
 						};
+						
+						// 纭繚PHSY瀛楁琚纭缃�
+						this.formData.PHSY = data.PHSY;
 
 						this.$post({
 							url: "/LLJ/getJYItem",
@@ -593,58 +621,25 @@
 				});
 			},
 			editRemarks() {
-				if (this.remarks) {
-					//saveRemarksGid
-					this.$post({
-						url: "/LLJ/saveRemarksGid",
-						data: {
-							gid: this.formData.id,
-							remarks: this.remarks,
-							releaseNo: this.formData.releaseNo,
-						}
-					}).then(res => {
-						if (res.data.tbBillList > 0) {
-							this.formData.remarks = this.remarks;
-							this.remarksPopup = !this.remarksPopup;
-							this.$showMessage("淇濆瓨鎴愬姛");
-							setTimeout(() => {
-								let pages = getCurrentPages();
-								let beforePage = pages[pages.length - 2];
-								uni.navigateBack({
-									delta: 1, //杩斿洖鐨勯〉闈㈡暟锛屽鏋滀负1琛ㄧず杩斿洖涓婁竴椤�
-									success: (event) => {
-										beforePage.$vm.reload()
-									}
-								});
-							}, 2000);
-						}
-					})
-				} else {
-					this.$post({
-						url: "/LLJ/saveRemarksGid",
-						data: {
-							gid: this.formData.id,
-							remarks: '',
-							releaseNo: this.formData.releaseNo,
-						}
-					}).then(res => {
-						if (res.data.tbBillList > 0) {
-							this.formData.remarks = this.remarks;
-							this.remarksPopup = !this.remarksPopup;
-							this.$showMessage("淇濆瓨鎴愬姛");
-							setTimeout(() => {
-								let pages = getCurrentPages();
-								let beforePage = pages[pages.length - 2];
-								uni.navigateBack({
-									delta: 1, //杩斿洖鐨勯〉闈㈡暟锛屽鏋滀负1琛ㄧず杩斿洖涓婁竴椤�
-									success: (event) => {
-										beforePage.$vm.reload()
-									}
-								});
-							}, 2000);
-						}
-					})
-				}
+				// 淇濆瓨涓嶈壇鎻忚堪
+				this.$post({
+					url: "/LLJ/saveRemarksGid",
+					data: {
+						gid: this.formData.id,
+						remarks: this.remarks || '',
+						releaseNo: this.formData.releaseNo
+						// 涓嶅啀鍖呭惈PHSY瀛楁
+					}
+				}).then(res => {
+					if (res.data.tbBillList > 0) {
+						this.formData.remarks = this.remarks;
+						this.remarksPopup = !this.remarksPopup;
+						this.$showMessage("淇濆瓨鎴愬姛");
+						setTimeout(() => {
+							this.init();
+						}, 2000);
+					}
+				})
 			},
 
 			drawingConfirm() {
@@ -1122,64 +1117,93 @@
 			            });
 			        },
 					editRemarks() {
-					            if (this.remarks) {
-					                // 鍙繚瀛樹慨鏀圭殑閮ㄥ垎
-					                const modifiedRemarks = this.remarks !== this.originalRemarks ? this.remarks : '';
-					
-					                this.$post({
-					                    url: "/LLJ/saveRemarksGid",
-					                    data: {
-					                        gid: this.formData.id,
-					                        remarks: modifiedRemarks,
-					                        releaseNo: this.formData.releaseNo,
-					                    }
-					                }).then(res => {
-					                    if (res.data.tbBillList > 0) {
-					                        this.formData.remarks = this.remarks;
-					                        this.originalRemarks = this.remarks; // 鏇存柊鍘熷澶囨敞鍊�
-					                        this.remarksPopup = !this.remarksPopup;
-					                        this.$showMessage("淇濆瓨鎴愬姛");
-					                        setTimeout(() => {
-					                            let pages = getCurrentPages();
-					                            let beforePage = pages[pages.length - 2];
-					                            uni.navigateBack({
-					                                delta: 1, //杩斿洖鐨勯〉闈㈡暟锛屽鏋滀负1琛ㄧず杩斿洖涓婁竴椤�
-					                                success: (event) => {
-					                                    beforePage.$vm.reload()
-					                                }
-					                            });
-					                        }, 2000);
-					                    }
-					                })
-					            } else {
-					                this.$post({
-					                    url: "/LLJ/saveRemarksGid",
-					                    data: {
-					                        gid: this.formData.id,
-					                        remarks: '',
-					                        releaseNo: this.formData.releaseNo,
-					                    }
-					                }).then(res => {
-					                    if (res.data.tbBillList > 0) {
-					                        this.formData.remarks = this.remarks;
-					                        this.originalRemarks = this.remarks; // 鏇存柊鍘熷澶囨敞鍊�
-					                        this.remarksPopup = !this.remarksPopup;
-					                        this.$showMessage("淇濆瓨鎴愬姛");
-					                        setTimeout(() => {
-					                            let pages = getCurrentPages();
-					                            let beforePage = pages[pages.length - 2];
-					                            uni.navigateBack({
-					                                delta: 1, //杩斿洖鐨勯〉闈㈡暟锛屽鏋滀负1琛ㄧず杩斿洖涓婁竴椤�
-					                                success: (event) => {
-					                                    beforePage.$vm.reload()
-					                                }
-					                            });
-					                        }, 2000);
-					                    }
-					                })
-					            }
-					        },
-							
+						// 淇濆瓨涓嶈壇鎻忚堪
+						this.$post({
+							url: "/LLJ/saveRemarksGid",
+							data: {
+								gid: this.formData.id,
+								remarks: this.remarks || '',
+								releaseNo: this.formData.releaseNo
+								// 涓嶅啀鍖呭惈PHSY瀛楁
+							}
+						}).then(res => {
+							if (res.data.tbBillList > 0) {
+								this.formData.remarks = this.remarks;
+								this.remarksPopup = !this.remarksPopup;
+								this.$showMessage("淇濆瓨鎴愬姛");
+								setTimeout(() => {
+									this.init();
+								}, 2000);
+							}
+						})
+					},
+			addDestruction() {
+				// 娣诲姞鐮村潖瀹為獙鐨勯�昏緫
+				this.destructionPopup = !this.destructionPopup;
+				this.PHSY = this.formData.PHSY || '';
+				this.isInteger = true;
+			},
+			editDestruction() {
+				// 楠岃瘉杈撳叆鏄惁涓烘暣鏁�
+				if(this.PHSY === '') {
+					this.isInteger = true;
+					// 濡傛灉涓虹┖锛屼紶閫掔┖瀛楃涓诧紝鍚庣浼氬鐞嗕负null
+				} else {
+					const isInteger = /^-?\d+$/.test(this.PHSY);
+					this.isInteger = isInteger;
+					if (!isInteger) {
+						return;
+					}
+				}
+				
+				// 淇濆瓨鐮村潖瀹為獙鏁伴噺
+				this.$post({
+					url: "/LLJ/saveRemarksGid",
+					data: {
+						gid: this.formData.id,
+						releaseNo: this.formData.releaseNo,
+						PHSY: this.PHSY // 鍙互鏄┖瀛楃涓叉垨鏈夋晥鏁存暟
+						// 涓嶅啀鍖呭惈remarks瀛楁
+					}
+				}).then(res => {
+					if (res.data.tbBillList > 0) {
+						// 濡傛灉杈撳叆涓虹┖锛岃缃负null浠ヤ究涓嶆樉绀�
+						this.formData.PHSY = this.PHSY === '' ? null : this.PHSY;
+						this.destructionPopup = false;
+						this.$showMessage("淇濆瓨鎴愬姛");
+						setTimeout(() => {
+							// 璺宠浆鍒板垪琛ㄩ〉闈�
+							uni.navigateTo({
+								url: 'List'
+							});
+						}, 2000);
+					}
+				})
+			},
+			clearDestruction() {
+				// 娓呴櫎鐮村潖瀹為獙鏁伴噺
+				this.PHSY = '';
+				this.$post({
+					url: "/LLJ/saveRemarksGid",
+					data: {
+						gid: this.formData.id,
+						releaseNo: this.formData.releaseNo,
+						PHSY: '' // 绌哄瓧绗︿覆锛屽悗绔細澶勭悊涓簄ull
+					}
+				}).then(res => {
+					if (res.data.tbBillList > 0) {
+						this.formData.PHSY = null; // 纭繚鍓嶇涔熶负null锛屼笉鏄剧ず
+						this.destructionPopup = false;
+						this.$showMessage("娓呴櫎鎴愬姛");
+						setTimeout(() => {
+							// 璺宠浆鍒板垪琛ㄩ〉闈�
+							uni.navigateTo({
+								url: 'List'
+							});
+						}, 2000);
+					}
+				})
+			},
 		}
 	}
 </script>
@@ -1477,4 +1501,11 @@
 		}
 
 	}
+	
+	.error-message {
+		color: #e74c3c;
+		font-size: 14px;
+		margin-top: 5px;
+		margin-bottom: 10px;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3