From 77084439440fed9bb54e65f98b363f2d64fae7b0 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 16 十月 2025 09:41:03 +0800
Subject: [PATCH] 新增:历史报工记录数组
---
components/WorkOrderPrint.vue | 185 ++++++++++++++++++---------------------------
1 files changed, 74 insertions(+), 111 deletions(-)
diff --git a/components/WorkOrderPrint.vue b/components/WorkOrderPrint.vue
index f6c912e..9a67d72 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>
@@ -68,106 +87,8 @@
</view>
</view>
- <view class="flex-row gap-lg">
- <view class="print-section flex-grow">
- <view class="barcode-info">
- <view class="user-select">
- <text>涓嶈壇鏁伴噺锛�</text>
- <input v-model="customAmount" class="inp bad-input" placeholder="璇疯緭鍏ユ暟閲�" />
- </view>
- <view class="user-select">
- <button class="details-btn" @click="confirmCustomAmount">纭鎻愪氦</button>
- </view>
- </view>
- </view>
-
- <view class="current-user-section fill-width">
- <text>褰撳墠鎶ュ伐浜猴細</text>
- <text class="current-user-name">{{ staffDisplay || '鏈�夋嫨' }}</text>
- <button class="select-user-btn" @click="isShowUserSelect = true">閫変汉</button>
- </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">
- <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">
- <button class="clean-btn wide-btn" @click="isShowUserSelect = false">鍏抽棴</button>
- </view>
- </view>
- </view>
-
- <view class="bottom-section">
- <button class="save-btn" @click="save">淇濆瓨骞剁敓鏁�</button>
- <button class="cancel-btn" @click="cancel">鍙栨秷</button>
- </view>
-
- <!-- 淇濈暀鏃у脊绐� -->
- <view v-if="isShow" class="overlay">
- <view class="popup">
- <view class="bottom-section1">
- <button class="clean-btn" type="warn" @click="deleteBarcode">鍏抽棴</button>
- </view>
- <view class="reason-section">
- <text>鎶ュ伐浜猴細</text>
- <view class="reason-buttons">
- <button v-for="(u,index) in users" :key="index"
- :class="{'reason-btn':true,'selected': user===u}"
- @click="toggleUser(u)">
- {{ formatUser(u) }}
- </button>
- </view>
- </view>
- </view>
- </view>
-
- <view v-if="barcodeIsShow" class="overlay">
- <view class="popup">
- <uni-table ref="table" border stripe emptyText="鏆傛棤鏇村鏁版嵁" class="table1">
- <uni-tr>
- <uni-th align="center" style="font-size:40px;">鐢熸垚鏃堕棿</uni-th>
- <uni-th align="center" style="width:39%;font-size:40px;">鏉$爜</uni-th>
- <uni-th align="center" style="font-size:40px;">鎶ュ伐浜�</uni-th>
- <uni-th align="center" style="font-size:40px;">鎶ュ伐鏁伴噺</uni-th>
- </uni-tr>
- <uni-tr v-for="(item,index) in reportingList" :key="index">
- <uni-td align="center"><input type="text" v-model="item.bgDate" style="width:26vh;" /></uni-td>
- <uni-td align="center"><input v-model="item.itemNoCade" style="width:40vh;" /></uni-td>
- <uni-td align="center"><input v-model="item.staffName" /></uni-td>
- <uni-td align="center"><input v-model="item.okQty" /></uni-td>
- </uni-tr>
- </uni-table>
- <view><button class="clean-btn" type="warn" @click="barcodeIsShow=false">鍏抽棴</button></view>
- </view>
- </view>
+ <!-- 鍏朵綑妯℃澘淇濇寔鍘熸牱 -->
+ <!-- ... -->
</view>
</view>
</template>
@@ -191,21 +112,21 @@
printNum: 1, reportingList: [], printLoading: false, customAmount: '',
isGeneratingBarcode: false, lastGenerateTime: 0, generateRequestId: null,
nowTimeTimer: null, nowTime: '',
- // 鏂板锛氭悳绱㈠叧閿瓧
- userSearch: ''
+ 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.daa008|| 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();
@@ -261,6 +182,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 => {
@@ -269,6 +191,34 @@
});
}
},
+ /* 鏂板锛氳幏鍙栧巻鍙叉姤宸ヨ褰� */
+ getReportingHistory() {
+ if (!this.orderNo) { this.reportingHistory = []; return; }
+ this.$post({
+ // 鍚庣闇�瑕佹彁渚涙寜 BILL_NO 鏌ヨ鐨勬帴鍙o紝绀轰緥璺緞锛�
+ url: "/MesReporting/GetByBillNo",
+ data: { billNo: this.orderNo }
+ }).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.defectiveQty ??
+ ((r.kgQty ?? r.totalProduction ?? 0) - (r.sQuantity ?? r.okQty ?? 0)))
+ }
+ });
+ }).catch(() => { this.reportingHistory = []; });
+ },
toggleUser(u) {
if (!u) return;
this.user = this.user === u ? null : u;
@@ -276,9 +226,8 @@
},
confirmCustomAmount() {
if (!this.customAmount || isNaN(Number(this.customAmount))) { this.$showMessage('璇疯緭鍏ユ湁鏁堢殑鏁伴噺'); return; }
- if (!this.staffNo) { this.$showMessage('璇烽�夋嫨鎶ュ伐浜�'); return; }//浼犻�掓姤宸ヤ汉
- // 鎷嗗垎宸ュ彿鍜屽鍚嶏紝鍙栧伐鍙�
- const staffNo = this.staffNo.split(':')[0];
+ if (!this.staffNo) { this.$showMessage('璇烽�夋嫨鎶ュ伐浜�'); return; }
+ const staffNo = this.staffNo.split(':')[0];
const amount = Number(this.customAmount);
this.$post({
url: "/MesInvItemBarcodes/AddBFToBarcodes",
@@ -286,18 +235,19 @@
orderNo: this.orderNo,
orderId: this.orderId,
bf: amount,
- staffNo: staffNo //鎶ュ伐浜虹紪鍙�
+ 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() {
@@ -390,6 +340,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;
--
Gitblit v1.9.3