From 52bbf8ee3d126998c5c625a3aab234b1fdcb2362 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 16 十月 2025 14:12:19 +0800
Subject: [PATCH] 修改:规范历史时间到秒

---
 components/WorkOrderPrint.vue |  103 ++++++++++++++++++++++++++++-----------------------
 1 files changed, 57 insertions(+), 46 deletions(-)

diff --git a/components/WorkOrderPrint.vue b/components/WorkOrderPrint.vue
index 27bc69a..46fd9ab 100644
--- a/components/WorkOrderPrint.vue
+++ b/components/WorkOrderPrint.vue
@@ -215,29 +215,30 @@
 				reportingHistory: []
 			}
 		},
-		computed: {
-			calculatedCurrentCount() { return (this.productionCount || 0) - (this.initialValue || 0); },
-			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; },
-			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() {
-			this.initializeData();
-			this.fetchData(true);
-			this.init();
-			this.getXS0101();
-			this.updateNowTime();
-			this.nowTimeTimer = setInterval(this.updateNowTime, 60000);
+        computed: {
+            calculatedCurrentCount() { return (this.productionCount || 0) - (this.initialValue || 0); },
+            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; },
+            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() {
+            this.initializeData();
+            this.fetchData(true);
+            this.init();
+            this.getXS0101();
+            this.updateNowTime();
+            // 绉掔骇鍒锋柊锛涘涓嶉渶鍔ㄦ�佽烦绉掑彲鏀逛负 60000
+            this.nowTimeTimer = setInterval(this.updateNowTime, 1000);
 		},
 		beforeDestroy() { if (this.nowTimeTimer) clearInterval(this.nowTimeTimer); },
 		methods: {
@@ -247,27 +248,28 @@
 				return segs.length > 1 ? `${segs[0]} ${segs[1]}` : u;
 			},
 			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())}`;
-			},
-			initializeData() {
-				this.productionCount = this.printedCount = this.defectiveCount = 0;
-				this.icount = 1; this.bqty = 0; this.sQuantity = 0; this.kgQty = 0;
-				this.initialValue = 0; this.qqty = 0;
-				this.isGeneratingBarcode = false; this.lastGenerateTime = 0; this.generateRequestId = null;
-			},
-			resetGenerateState() {
-				this.isGeneratingBarcode = false; this.generateRequestId = null; this.lastGenerateTime = 0;
-				this.$showMessage("宸查噸缃潯鐮佺敓鎴愮姸鎬�");
-			},
-			refresh() {
-				this.$sendPostRequest({
-					url: "http://192.168.0.94:9095/Numerical/RefreshDev",
-					data: { machineNo: this.order.machineNo },
-					contentType: "application/json"
-				}).then(r => { r.code == 200 ? this.fetchData(true) : this.$showMessage("鍚屾澶辫触"); });
-			},
+            /* 淇敼锛氬鍔犵 */
+            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())}:${p(d.getSeconds())}`;
+            },
+            initializeData() {
+                this.productionCount = this.printedCount = this.defectiveCount = 0;
+                this.icount = 1; this.bqty = 0; this.sQuantity = 0; this.kgQty = 0;
+                this.initialValue = 0; this.qqty = 0;
+                this.isGeneratingBarcode = false; this.lastGenerateTime = 0; this.generateRequestId = null;
+            },
+            resetGenerateState() {
+                this.isGeneratingBarcode = false; this.generateRequestId = null; this.lastGenerateTime = 0;
+                this.$showMessage("宸查噸缃潯鐮佺敓鎴愮姸鎬�");
+            },
+            refresh() {
+                this.$sendPostRequest({
+                    url: "http://192.168.0.94:9095/Numerical/RefreshDev",
+                    data: { machineNo: this.order.machineNo },
+                    contentType: "application/json"
+                }).then(r => { r.code == 200 ? this.fetchData(true) : this.$showMessage("鍚屾澶辫触"); });
+            },
 			onDaa003Change(v) {
 				let o = this.lineList[this.DAA003List.indexOf(v)];
 				this.orderId = o.id; this.orderNo = o.daa001;
@@ -290,8 +292,17 @@
 				}
 			},
 			/* 鏂板锛氳幏鍙栧巻鍙叉姤宸ヨ褰� */
-			getReportingHistory() {
-				if (!this.orderNo) { this.reportingHistory = []; return; }
+            /* 淇敼锛氳鑼冨巻鍙叉椂闂村埌绉� */
+            getReportingHistory() {
+                if (!this.orderNo) { this.reportingHistory = []; return; }
+                const fmtSec = v => {
+                    if (!v) return '';
+                    // 鍏煎鍚庣鍙兘杩斿洖鐨勪笉鍚屾牸寮�
+                    const d = new Date(typeof v === 'string' ? v.replace(/-/g, '/') : v);
+                    if (isNaN(d.getTime())) return v; // 鏃犳硶瑙f瀽鍒欏師鏍疯繑鍥�
+                    const p = n => n.toString().padStart(2, '0');
+                    return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
+                };
                 this.$post({
                     url: "/Womdaa/GetByBillNoBG",
                     data: { billNo: this.orderNo, machineNo: this.machineNo || null }

--
Gitblit v1.9.3