From 47131ae9d143f80c9751ed78bfb3b056e9453b40 Mon Sep 17 00:00:00 2001
From: 1 <1>
Date: 星期二, 30 十二月 2025 14:08:49 +0800
Subject: [PATCH] #手动下发页面优化

---
 src/main/webapp/views/orderCargoGrouping/orderCargoGroupingOperate.html |  168 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 146 insertions(+), 22 deletions(-)

diff --git a/src/main/webapp/views/orderCargoGrouping/orderCargoGroupingOperate.html b/src/main/webapp/views/orderCargoGrouping/orderCargoGroupingOperate.html
index e1162dc..bf74c2a 100644
--- a/src/main/webapp/views/orderCargoGrouping/orderCargoGroupingOperate.html
+++ b/src/main/webapp/views/orderCargoGrouping/orderCargoGroupingOperate.html
@@ -225,9 +225,41 @@
 			</el-descriptions>
 
 			<h3 style="margin-top: 20px;">璁㈠崟鏄庣粏</h3>
+			<!-- 鏄庣粏琛ㄦ牸鎼滅储鏍� -->
+			<div class="search-container" style="margin: 20px 0; padding: 15px; background: #f5f7fa; border-radius: 4px;">
+				<el-form :inline="true" class="search-form">
+					<div class="search-item">
+						<span class="search-label">瀹㈡埛SKU:</span>
+						<el-input
+								v-model="detailSearch.standby3"
+								placeholder="璇疯緭鍏ュ鎴稴KU"
+								clearable
+								style="width: 180px;"
+								@input="handleDetailSearch"
+								@keyup.enter.native="handleDetailSearch"
+						></el-input>
+					</div>
+					<div class="search-item">
+						<span class="search-label">閲囪喘鍗曞彿:</span>
+						<el-input
+								v-model="detailSearch.boxType3"
+								placeholder="璇疯緭鍏ラ噰璐崟鍙�"
+								clearable
+								style="width: 180px;"
+								@input="handleDetailSearch"
+								@keyup.enter.native="handleDetailSearch"
+						></el-input>
+					</div>
+<!--					<div class="search-actions" style="margin-left: auto;">-->
+<!--						<el-button type="primary" icon="el-icon-search" @click="handleDetailSearch">鎼滅储</el-button>-->
+<!--						<el-button icon="el-icon-refresh" @click="handleDetailReset">閲嶇疆</el-button>-->
+<!--					</div>-->
+				</el-form>
+			</div>
 			<el-table
 					border
-					:data="tableDataB"
+					ref="detailTable"
+					:data="filteredTableDataB"
 					style="width: 100%"
 					v-loading="detailLoading">
 				<el-table-column prop="id" label="id" min-width="50" align="center"></el-table-column>
@@ -240,7 +272,7 @@
 				<el-table-column prop="anfme" label="鏁伴噺" min-width="80" align="center">
 					<template slot-scope="scope">
 						<el-input-number
-								v-model="scope.row.anfme"
+								v-model="scope.row.anfmeRow"
 								:min="0"
 								:precision="0"
 								controls-position="right"
@@ -324,6 +356,12 @@
 				cstmrName: '',
 				settle: ''
 			},
+			detailSearch: {
+				standby3: '',
+				boxType3: ''
+			},
+			// 鏂板锛氱敤浜庣紦瀛樺師濮嬫槑缁嗘暟鎹紙鍒嗛〉鍔犺浇鍚庣殑瀹屾暣褰撳墠椤垫暟鎹級
+			originalTableDataB: [],
 			// 鎺掑簭鐩稿叧
 			orderByField: '',
 			orderByType: 'asc',
@@ -354,6 +392,34 @@
 		},
 		created() {
 			this.init();
+		},
+		computed: {
+			// 鏄庣粏琛ㄦ牸杩囨护鍚庣殑鏁版嵁
+			filteredTableDataB() {
+				if (!this.originalTableDataB || this.originalTableDataB.length === 0) {
+					return [];
+				}
+
+				let data = this.originalTableDataB;
+
+				// 瀹㈡埛SKU 妯$硦鎼滅储锛堜笉鍖哄垎澶у皬鍐欙級
+				if (this.detailSearch.standby3 && this.detailSearch.standby3.trim()) {
+					const keyword = this.detailSearch.standby3.trim().toLowerCase();
+					data = data.filter(item =>
+							item.standby3 && item.standby3.toLowerCase().includes(keyword)
+					);
+				}
+
+				// 閲囪喘鍗曞彿 妯$硦鎼滅储
+				if (this.detailSearch.boxType3 && this.detailSearch.boxType3.trim()) {
+					const keyword = this.detailSearch.boxType3.trim().toLowerCase();
+					data = data.filter(item =>
+							item.boxType3 && item.boxType3.toLowerCase().includes(keyword)
+					);
+				}
+
+				return data;
+			}
 		},
 		methods: {
 			init() {
@@ -420,18 +486,15 @@
 					}
 				});
 			},
-
-			// 鑾峰彇瀛愯〃B鏁版嵁
+// 鑾峰彇瀛愯〃B鏁版嵁
 			getTableDataB(orderNo) {
 				let that = this;
 				that.detailLoading = true;
-
 				let params = {
 					order_no: orderNo,
 					curr: that.detailCurrentPage,
 					limit: that.detailPageSize
 				};
-
 				$.ajax({
 					url: baseUrl + "/order/pakin/orderDetl/list/auth",
 					headers: {
@@ -445,13 +508,26 @@
 						if (res.code === 200 || res.success) {
 							that.tableDataB = res.data.records || [];
 							that.detailTotal = res.data.total || 0;
-
-							// 鍒濆鍖栨暟閲忕紦瀛�
-							that.modifiedQuantities = {};
+							that.originalTableDataB = [...res.data.records || []];  // 鏂板锛氫繚瀛樺師濮嬫暟鎹敤浜庤繃婊�
+							// ============ 鏂板锛氳缃暟閲忛粯璁ゅ�间负 ERP涓嬪彂鏁伴噺 - 寰呬笅鍙戞暟閲� ============
 							that.tableDataB.forEach(item => {
+								// 鍋囪鍚庣杩斿洖鐨勫瓧娈靛悕鏄� erpAnfme锛圗RP涓嬪彂鏁伴噺锛夊拰 sortingAnfme锛堝緟涓嬪彂鏁伴噺锛�
+								// 濡傛灉瀛楁鍚嶄笉鍚岋紝璇锋浛鎹㈡垚瀹為檯鐨�
+								const erpQty = parseInt(item.anfme) || 0;        // ERP涓嬪彂鏁伴噺
+								const pendingQty = parseInt(item.sortingAnfme) || 0; // 寰呬笅鍙戞暟閲�
+
+								// 璁$畻榛樿鏁伴噺锛欵RP鎬婚噺 - 宸插緟涓嬪彂 = 杩樺彲淇敼/涓嬪彂鐨勬暟閲�
+								const defaultQty = erpQty - pendingQty;
+
+								// 璁剧疆杈撳叆妗嗛粯璁ゅ�硷紙纭繚 >= 0锛�
+								that.$set(item, 'anfmeRow', Math.max(0, defaultQty));
+
+								// 鍚屾椂鍒濆鍖� modifiedQuantities 缂撳瓨
 								const itemKey = that.getItemKey(item);
-								that.$set(that.modifiedQuantities, itemKey, item.anfme);
+								that.$set(that.modifiedQuantities, itemKey, Math.max(0, defaultQty));
 							});
+							// ==========================================================================
+
 						} else {
 							that.$message.error(res.msg || '鑾峰彇鏁版嵁澶辫触');
 							that.tableDataB = [];
@@ -461,11 +537,57 @@
 					},
 					error: function() {
 						that.detailLoading = false;
-						// 妯℃嫙鏁版嵁
+						// 妯℃嫙鏁版嵁涔熷姞涓婇粯璁ゅ�奸�昏緫锛堝彲閫夛級
 						that.mockTableBData();
+						// 濡傛灉浣犳湁 mock 鏁版嵁锛屼篃寤鸿鍦ㄨ繖閲屽姞涓婂悓鏍风殑璁$畻閫昏緫
 					}
 				});
 			},
+			// // 鑾峰彇瀛愯〃B鏁版嵁
+			// getTableDataB(orderNo) {
+			// 	let that = this;
+			// 	that.detailLoading = true;
+			//
+			// 	let params = {
+			// 		order_no: orderNo,
+			// 		curr: that.detailCurrentPage,
+			// 		limit: that.detailPageSize
+			// 	};
+			//
+			// 	$.ajax({
+			// 		url: baseUrl + "/order/pakin/orderDetl/list/auth",
+			// 		headers: {
+			// 			'token': localStorage.getItem('token')
+			// 		},
+			// 		data: params,
+			// 		dataType: 'json',
+			// 		contentType: 'application/json;charset=UTF-8',
+			// 		method: 'get',
+			// 		success: function (res) {
+			// 			if (res.code === 200 || res.success) {
+			// 				that.tableDataB = res.data.records || [];
+			// 				that.detailTotal = res.data.total || 0;
+			//
+			// 				// 鍒濆鍖栨暟閲忕紦瀛�
+			// 				that.modifiedQuantities = {};
+			// 				that.tableDataB.forEach(item => {
+			// 					const itemKey = that.getItemKey(item);
+			// 					that.$set(that.modifiedQuantities, itemKey, item.anfme);
+			// 				});
+			// 			} else {
+			// 				that.$message.error(res.msg || '鑾峰彇鏁版嵁澶辫触');
+			// 				that.tableDataB = [];
+			// 				that.detailTotal = 0;
+			// 			}
+			// 			that.detailLoading = false;
+			// 		},
+			// 		error: function() {
+			// 			that.detailLoading = false;
+			// 			// 妯℃嫙鏁版嵁
+			// 			that.mockTableBData();
+			// 		}
+			// 	});
+			// },
 
 			// 鑾峰彇鍟嗗搧鍞竴鏍囪瘑
 			getItemKey(item) {
@@ -620,8 +742,7 @@
 			},
 
 			// 鎻愪氦淇敼鍒板悗鍙�
-			submitModify(orderNo, id, anfme,inspect) {
-				// 鏄剧ず鍔犺浇鐘舵��
+			submitModify(orderNo, id, anfme, inspect) {
 				const loadingInstance = this.$loading({
 					lock: true,
 					text: '鎻愪氦淇敼涓�...',
@@ -631,25 +752,24 @@
 
 				$.ajax({
 					url: baseUrl + "/order/pakin/orderDetl/batch/report/auth",
-					headers: {'token': localStorage.getItem('token')},
+					headers: { 'token': localStorage.getItem('token') },
 					data: top.reObject({
-						orderNo: orderNo, // 缁勮揣鍗曞彿
-						id: id, // id
-						anfme: anfme, // 绠卞彿
-						inspect: inspect // 绠卞彿
+						orderNo: orderNo,
+						id: id,
+						anfme: anfme,
+						inspect: inspect,  // 0 鎴� 1
 					}),
 					method: 'POST',
 					success: (res) => {
 						loadingInstance.close();
-
 						if (res.code === 200 || res.success) {
 							this.$message({
 								message: `淇敼鎴愬姛锛佽鍗曞彿: ${orderNo}, id: ${id}`,
 								type: 'success',
 								duration: 3000
 							});
-
-							this.getTableDataB(groupOrderNo);
+							this.getTableDataB(orderNo);//
+							// 涓嶉渶瑕侀噸鏂板姞杞芥暣椤垫暟鎹紙閬垮厤涓㈠け鐢ㄦ埛淇敼鐨勬暟閲忥級
 						} else {
 							this.$message.error(res.msg || '淇敼澶辫触');
 						}
@@ -842,9 +962,13 @@
 				this.detailDialogVisible = true;
 				this.detailCurrentPage = 1;
 				this.settleA = row.settle;
-				// 娓呯┖缂撳瓨
 				this.modifiedQuantities = {};
 				this.deletedRecords = [];
+
+				// 鏂板锛氭竻绌烘槑缁嗘悳绱�
+				this.detailSearch.standby3 = '';
+				this.detailSearch.boxType3 = '';
+
 				this.getTableDataB(row.orderNo);
 			},
 

--
Gitblit v1.9.1