From 3b44cd2e2d2527b224472124651031e3f25dea2c Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 16 十月 2025 11:01:34 +0800
Subject: [PATCH] 表格修改

---
 components/WorkOrderPrint.vue |  175 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 159 insertions(+), 16 deletions(-)

diff --git a/components/WorkOrderPrint.vue b/components/WorkOrderPrint.vue
index 7583179..3f8d854 100644
--- a/components/WorkOrderPrint.vue
+++ b/components/WorkOrderPrint.vue
@@ -21,7 +21,8 @@
 							</tr>
 						</thead>
 						<tbody>
-							<tr>
+							<!-- 褰撳墠瀹炴椂缁熻(淇濇寔鍘熸潵鍗曡) -->
+							<tr class="summary-row">
 								<td>{{ nowTime }}</td>
 								<td>{{ staffDisplay || '-' }}</td>
 								<td>{{ orderNo || '-' }}</td>
@@ -34,11 +35,29 @@
 								<td>{{ calculatedDefectiveCount }}</td>
 								<td>{{ sQuantity }}</td>
 							</tr>
+							<!-- 鍘嗗彶鎶ュ伐璁板綍琛� -->
+							<tr v-for="(r, idx) in reportingHistory" :key="idx">
+								<td>{{ r.time }}</td>
+								<td>{{ r.staff || '-' }}</td>
+								<td>{{ r.orderNo || '-' }}</td>
+								<td>{{ r.productName || '-' }}</td>
+								<td>{{ r.planQty }}</td>
+								<td>{{ r.machineNo || '-' }}</td>
+								<td>{{ r.initialValue }}</td>
+								<td>{{ r.productionCount }}</td>
+								<td>{{ r.totalProduction }}</td>
+								<td>{{ r.defective }}</td>
+								<td>{{ r.good }}</td>
+							</tr>
+							<tr v-if="!reportingHistory.length">
+								<td colspan="11" class="no-data">鏆傛棤鍘嗗彶鎶ュ伐璁板綍</td>
+							</tr>
 						</tbody>
 					</table>
 				</div>
 			</view>
 
+			<!-- 涓嬮潰鍘熸湁鍐呭淇濇寔涓嶅彉 -->
 			<view class="status-row">
 				<view class="status-box">
 					<text>鏈哄彴闈㈡澘鏁帮細</text>
@@ -88,17 +107,35 @@
 				</view>
 			</view>
 
+			<!-- 閫変汉寮圭獥 -->
 			<view v-if="isShowUserSelect" class="overlay">
 				<view class="popup user-select-popup">
+					<!-- 鎼滅储鏍� -->
+					<view class="user-search-bar">
+						<input v-model.trim="userSearch"
+							   type="text"
+							   class="user-search-input"
+							   placeholder="杈撳叆宸ュ彿鎴栧鍚嶆悳绱�"
+							   @keydown.enter.prevent />
+						<button v-if="userSearch" class="user-search-clear" @click="userSearch=''">娓呯┖</button>
+						<view class="user-search-info">
+							鍖归厤锛歿{ filteredUsers.length }} / {{ users.length }}
+						</view>
+					</view>
 					<view class="user-list-scroll">
-						<view class="user-list-grid">
-							<button v-for="(u, index) in users"
-									:key="index"
-									:class="['user-list-btn', {'selected': u===staffNo}]"
-									@click="selectUser(u)">
-								<span class="user-code">{{ u.split(':')[0] }}</span>
-								<span class="user-name">{{ u.split(':')[1] }}</span>
-							</button>
+						<template v-if="filteredUsers.length">
+							<view class="user-list-grid">
+								<button v-for="(u, index) in filteredUsers"
+										:key="index"
+										:class="['user-list-btn', {'selected': u===staffNo}]"
+										@click="selectUser(u)">
+									<span class="user-code">{{ u.split(':')[0] }}</span>
+									<span class="user-name">{{ u.split(':')[1] }}</span>
+								</button>
+							</view>
+						</template>
+						<view v-else class="no-user-result">
+							鏈壘鍒板尮閰嶄汉鍛�
 						</view>
 					</view>
 					<view class="user-popup-footer">
@@ -112,6 +149,7 @@
 				<button class="cancel-btn" @click="cancel">鍙栨秷</button>
 			</view>
 
+			<!-- 淇濈暀鏃у脊绐� -->
 			<view v-if="isShow" class="overlay">
 				<view class="popup">
 					<view class="bottom-section1">
@@ -171,18 +209,26 @@
 				staffNo: '', printStr: '', printMac: '', bluetoothSocket: {}, device: '', uuid: '',
 				printNum: 1, reportingList: [], printLoading: false, customAmount: '',
 				isGeneratingBarcode: false, lastGenerateTime: 0, generateRequestId: null,
-				nowTimeTimer: null, nowTime: ''
+				nowTimeTimer: null, nowTime: '',
+				userSearch: '',
+				/* 鏂板锛氬巻鍙叉姤宸ヨ褰曟暟缁� */
+				reportingHistory: []
 			}
 		},
 		computed: {
 			calculatedCurrentCount() { return (this.productionCount || 0) - (this.initialValue || 0); },
-			calculatedTotalProduction() { return (this.kgQty || 0) + this.calculatedCurrentCount; },
+			calculatedTotalProduction() { return (this.kgQty || 0); }, // 鑻ラ渶瑕佹仮澶嶄箣鍓嶉�昏緫鍙敼涓� (this.kgQty||0)+this.calculatedCurrentCount
 			calculatedDefectiveCount() { return this.calculatedTotalProduction - (this.sQuantity || 0); },
-			planQtyDisplay() { return this.order.planQty || this.order.planQuantity || this.order.daa007 || this.order.daa010 || 0; },
+			planQtyDisplay() { return this.order.planQty || this.order.planQuantity || this.order.daa008 || 0; },
 			staffDisplay() {
 				if (!this.staffNo) return '';
 				const segs = this.staffNo.split(':');
 				return segs.length > 1 ? `${segs[0]} ${segs[1]}` : this.staffNo;
+			},
+			filteredUsers() {
+				if (!this.userSearch) return this.users;
+				const kw = this.userSearch.trim().toLowerCase();
+				return this.users.filter(u => u.toLowerCase().includes(kw));
 			}
 		},
 		created() {
@@ -200,7 +246,7 @@
 				const segs = u.split(':');
 				return segs.length > 1 ? `${segs[0]} ${segs[1]}` : u;
 			},
-			selectUser(u) { this.staffNo = u; this.isShowUserSelect = false; },
+			selectUser(u) { this.staffNo = u; this.isShowUserSelect = false; this.userSearch = ''; },
 			updateNowTime() {
 				const d = new Date(), p = n => n.toString().padStart(2, '0');
 				this.nowTime = `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
@@ -234,6 +280,7 @@
 				if (!this.orderId && !this.orderNo) return;
 				this.getOrderById();
 				this.getWomdaaPrintById();
+				this.getReportingHistory(); // 鏂板锛氭瘡娆″埛鏂板悓姝ュ巻鍙�
 				if (flag) {
 					this.$post({ url: "/Womdaa/GetWomdaasByShow", data: { machineNo: this.machineNo } })
 						.then(res => {
@@ -242,6 +289,32 @@
 						});
 				}
 			},
+			/* 鏂板锛氳幏鍙栧巻鍙叉姤宸ヨ褰� */
+			getReportingHistory() {
+				if (!this.orderNo) { this.reportingHistory = []; return; }
+                this.$post({
+                    url: "/Womdaa/GetByBillNoBG",
+                    data: { billNo: this.orderNo, machineNo: this.machineNo || null }
+				}).then(res => {
+					const list = res?.data?.tbBillList || res?.data || [];
+					this.reportingHistory = list.map(r => {
+						// 渚濇嵁浣犳暟鎹簱瀛楁鍋氭槧灏勶紙涓嬮潰瀛楁鍚嶆寜甯歌鍛藉悕涓句緥锛岄渶瑕佹寜瀹為檯鏀癸級
+						return {
+							time: r.bgDate || r.startTime || r.createTime || '',        // 寮�濮嬫椂闂�
+							staff: (r.staffNo ? (r.staffNo + ' ' + (r.staffName || '')) : (r.staffName || '')),
+							orderNo: r.billNo || this.orderNo,
+							productName: r.daa003 || this.order?.daa003,
+							planQty: this.planQtyDisplay,
+							machineNo: r.machineNo || this.machineNo,
+							initialValue: r.initialValue ?? 0,
+							productionCount: r.productionCount ?? r.todayOutput ?? 0,
+							totalProduction: r.kgQty ?? r.totalProduction ?? 0,
+							good: r.sQuantity ?? r.okQty ?? 0,
+                            defective: r.ngQty
+						}
+					});
+				}).catch(() => { this.reportingHistory = []; });
+			},
 			toggleUser(u) {
 				if (!u) return;
 				this.user = this.user === u ? null : u;
@@ -249,20 +322,28 @@
 			},
 			confirmCustomAmount() {
 				if (!this.customAmount || isNaN(Number(this.customAmount))) { this.$showMessage('璇疯緭鍏ユ湁鏁堢殑鏁伴噺'); return; }
+				if (!this.staffNo) { this.$showMessage('璇烽�夋嫨鎶ュ伐浜�'); return; }
+				const staffNo = this.staffNo.split(':')[0];
 				const amount = Number(this.customAmount);
 				this.$post({
 					url: "/MesInvItemBarcodes/AddBFToBarcodes",
-					data: { orderNo: this.orderNo, orderId: this.orderId, bf: amount }
+					data: {
+						orderNo: this.orderNo,
+						orderId: this.orderId,
+						bf: amount,
+						staffNo: staffNo
+					}
 				}).then(res => {
 					if (res.status == 1) { this.$showMessage(res.message); return; }
 					this.$showMessage('鎶ュ簾鏁伴噺濉啓鎴愬姛');
-					this.fetchData(true);
+					this.fetchData(true); // 鑷姩鍒锋柊鍘嗗彶
 					this.customAmount = '';
 				}).catch(() => this.$showMessage('鎶ュ簾鏁伴噺濉啓澶辫触锛岃閲嶈瘯'));
 			},
 			save() {
 				if (!this.staffNo) { this.$showMessage('璇烽�夋嫨鎶ュ伐浜�'); return; }
 				uni.showToast({ title: '淇濆瓨鎴愬姛', icon: 'success' });
+				this.getReportingHistory(); // 淇濆瓨鍚庝篃鍙埛鏂�
 			},
 			cancel() { uni.showToast({ title: '鍙栨秷鎿嶄綔', icon: 'none' }); },
 			getOrderById() {
@@ -355,6 +436,19 @@
 </script>
 
 <style scoped>
+	/* 鍘熸牱寮忎繚鎸侊紝鏂板鍑犺杈呭姪鏍峰紡 */
+	.report-table .summary-row {
+		background: #f0f8ff;
+		font-weight: 600;
+	}
+
+	.report-table .no-data {
+		text-align: center;
+		color: #777;
+		font-size: 14px;
+	}
+	/* 鍏朵綑鏍峰紡淇濇寔涓嶅彉 */
+
 	.page {
 		padding: 1.2vh 2vw;
 		display: flex;
@@ -622,11 +716,53 @@
 		display: flex;
 		flex-direction: column;
 	}
+	/* 鎼滅储鏉℃牱寮� */
+	.user-search-bar {
+		display: flex;
+		align-items: center;
+		gap: 12px;
+		padding: 18px 32px 0 32px;
+		background: #fff;
+		flex-wrap: wrap;
+	}
+
+	.user-search-input {
+		flex: 1 1 260px;
+		padding: 10px 14px;
+		font-size: 16px;
+		border: 1px solid #bbb;
+		border-radius: 8px;
+		outline: none;
+	}
+
+		.user-search-input:focus {
+			border-color: #007aff;
+			box-shadow: 0 0 0 2px rgba(0,122,255,.15);
+		}
+
+	.user-search-clear {
+		padding: 10px 18px;
+		background: #ff9f43;
+		color: #fff;
+		border: none;
+		border-radius: 8px;
+		font-size: 14px;
+		cursor: pointer;
+	}
+
+		.user-search-clear:hover {
+			background: #ff8920;
+		}
+
+	.user-search-info {
+		font-size: 14px;
+		color: #555;
+	}
 
 	.user-list-scroll {
 		flex: 1 1 auto;
 		overflow-y: auto;
-		padding: 34px 32px 0 32px;
+		padding: 24px 32px 0 32px;
 	}
 
 	.user-list-grid {
@@ -671,6 +807,13 @@
 			background: #008ed0;
 		}
 
+	.no-user-result {
+		padding: 40px 0;
+		text-align: center;
+		font-size: 18px;
+		color: #666;
+	}
+
 	.user-popup-footer {
 		flex-shrink: 0;
 		padding: 22px 32px 32px 32px;

--
Gitblit v1.9.3