From 43dcf449e718a045a0346e1b9cdbebc46ad33e3d Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期一, 20 十月 2025 14:15:19 +0800
Subject: [PATCH] 重复上下刀的报错

---
 components/WorkOrder.vue |  125 +++++++++++++++++++++++++----------------
 1 files changed, 76 insertions(+), 49 deletions(-)

diff --git a/components/WorkOrder.vue b/components/WorkOrder.vue
index 31481e8..bd2864a 100644
--- a/components/WorkOrder.vue
+++ b/components/WorkOrder.vue
@@ -1,20 +1,11 @@
 <template>
 	<view>
-
-		<view class="container" style="display: flex;
-               flex-direction: row;
-               flex-wrap: nowrap;
-               align-content: flex-start;
-               justify-content: flex-start;">
+		<view class="container" style="display: flex; flex-direction: row; flex-wrap: nowrap; align-content: flex-start; justify-content: flex-start;">
 			<!--涓荤晫闈�-->
 			<!-- 涓婇儴锛氬伐鍗曢�夋嫨鍜屾満鍙颁俊鎭� -->
-			<view class="top-order" style=" display:inline-block;">
+			<view class="top-order" style="display:inline-block;">
 				<view class="form-row4">
-					<view class="form-row" style="display: flex;
-											flex-direction: column;
-											flex-wrap: nowrap;
-											justify-content: flex-start;
-											align-items: center;">
+					<view class="form-row" style="display: flex; flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; align-items: center;">
 						<view class="form-item">
 							<label>宸ュ崟缂栧彿:</label>
 							<input class="inp" type="text" v-model="order.daa001" disabled="true" />
@@ -59,7 +50,7 @@
 						</view>
 						<view class="form-item">
 							<label>浜у搧瑙勬牸:</label>
-							<input class="inp" type="text" v-model="order.daa004" disabled="true" /><!-- 淇濈暀鍘熺粦瀹氫笌娉ㄩ噴锛屾湭鏀� -->
+							<input class="inp" type="text" v-model="order.daa004" disabled="true" />
 						</view>
 						<view class="form-item">
 							<label>鎶ュ伐鏁伴噺:</label>
@@ -69,7 +60,7 @@
 				</view>
 			</view>
 			<view class="form-row1">
-				<view class="form-item" style=" display:inline-block;">
+				<view class="form-item" style="display:inline-block;">
 					<label>宸ュ崟鐘舵��:</label>
 					<input class="inp1" type="text" v-model="order.daa018" disabled="true" />
 					<!-- 鍒锋柊鎸夐挳 -->
@@ -86,12 +77,13 @@
 		<view class="section card">
 			<view class="form-row">
 				<view class="form-item">
-					<label style="color: red;">鏃ュ仠鏈烘鏁�(鏃堕暱瓒�5鍒嗛挓):</label>
-					<input class="inp" style="width: 40%;" type="number" v-model="todayFaultNum" disabled="true" />
+					<label style="color: red;">鏃ュ仠鏈烘鏁�(鏃堕暱瓒�3鍒嗛挓):</label>
+					<input class="inp" style="width: 40%;" type="number" v-model="order.todayDowntimeCount" disabled="true" />
 				</view>
 				<view class="form-item">
 					<label>鏃ュ仠鏈烘椂闀�(mi):</label>
-					<input class="inp" type="text" v-model="todayRunTime" disabled="true" />
+					<!-- 杩欓噷鐢ㄨ绠楀睘鎬э紝涓嶈兘鐢╲-model琛ㄨ揪寮� -->
+					<input class="inp" type="text" :value="downtimeDuration" disabled="true" />
 				</view>
 				<view class="form-item">
 					<label>璁惧绋煎姩鐜�:</label>
@@ -126,8 +118,12 @@
 					<input class="inp" type="text" v-model="initialConclusion" disabled="true" />
 				</view>
 				<view class="form-item">
-					<label>宸℃娆℃暟:</label><!--棣栨娆℃暟???-->
-					<input class="inp" type="number" v-model="patrolCount" disabled="true" />
+					<label>棣栨浜哄憳:</label>
+					<input class="inp" type="text" v-model="initialInspector" disabled="true" />
+				</view>
+				<view class="form-item">
+					<label>棣栨娆℃暟:</label>
+					<input class="inp" type="number" v-model="initialCount" disabled="true" />
 				</view>
 			</view>
 			<view class="form-row">
@@ -138,6 +134,10 @@
 				<view class="form-item">
 					<label>宸℃缁撹:</label>
 					<input class="inp" type="text" v-model="patrolConclusion" disabled="true" />
+				</view>
+				<view class="form-item">
+					<label>宸℃浜哄憳:</label>
+					<input class="inp" type="text" v-model="patrolInspector" disabled="true" />
 				</view>
 				<view class="form-item">
 					<label>宸℃娆℃暟:</label>
@@ -171,14 +171,26 @@
 				productionDuration: '',
 				lastInitialCheck: '',
 				initialConclusion: '',
+				initialInspector: '',
+				initialCount: 0,
 				lastPatrolCheck: '',
 				patrolConclusion: '',
+				patrolInspector: '',
 				patrolCount: 0,
-				timer: null, // Timer reference
+				timer: null,
 
 				DAA003List: [],
 				lineList: [],
 			};
+		},
+		computed: {
+			// 鏃ュ仠鏈烘椂闀� = todayOnlineTime - todayRunTime
+			downtimeDuration() {
+				// 鍙杘rder瀵硅薄涓殑todayOnlineTime鍜宼odayRunTime锛岄兘涓哄垎閽�
+				const online = Number(this.order.todayOnlineTime) || 0;
+				const run = Number(this.order.todayRunTime) || 0;
+				return online - run;
+			}
 		},
 		created() {
 			this.fetchData(true);
@@ -186,11 +198,11 @@
 			this.init();
 		},
 		mounted() {
-			this.fetchData(false); // Initial fetch
-			this.timer = setInterval(this.fetchData, 120000); // Call fetchData every 3 minutes
+			this.fetchData(false);
+			this.timer = setInterval(this.fetchData, 120000);
 		},
 		beforeDestroy() {
-			clearInterval(this.timer); // Clear the timer on component destruction
+			clearInterval(this.timer);
 		},
 		methods: {
 			init() {
@@ -231,7 +243,6 @@
 					}
 				});
 			},
-
 			onDaa003Change(event) {
 				let orde = this.lineList[this.DAA003List.indexOf(event)];
 				this.orderId = orde.id;
@@ -362,8 +373,9 @@
 							cutterName,  //鍒�鍏峰悕绉�
 							cutterModel, //鍒�鍏疯鏍�
 							jdl: '',
-							startCjNum: 0, // 鏂板鍏滃簳瀛楁 淇濈暀鍏跺畠娉ㄩ噴
-							currentCjNum: 0 // 鏂板鍏滃簳瀛楁
+                            startCjNum: 0, // 寮�宸ユ暟閲�
+                            currentCjNum: 0, // 褰撳墠鏁伴噰
+                            todayDowntimeCount //浠婃棩鍋滄満娆℃暟
 						};
 						return;
 					}
@@ -385,8 +397,6 @@
 					//this.productionDuration = (this.order.todayOnlineTime / 3600).toFixed(2) + "h";
 					this.todayFaultNum = this.order.todayFaultNum;
 					this.utilizationRate = this.order.jdl + '%';
-					// this.startTime = this.order.workStartDate;
-					// this.endTime = this.order.workEndDate;
 					let title = this.machineNo + '鍙锋満鍙� 宸ュ崟鍙�' + this.order.daa001 + ',褰撳墠鏁伴噰' + this.order.currentCjNum; // 鏍囬涓娇鐢� currentCjNum
 					this.setTitle(title);
 				})
@@ -404,9 +414,24 @@
 						orderNo: this.orderNo
 					}
 				}).then(res => {
-					//this.order = res.data.tbBillList;
-					this.lastInitialCheck = res.data.tbBillList.fcheckDate;
-					this.initialConclusion = res.data.tbBillList.fcheckResu;
+					let sjList = res.data.tbBillList;
+					if (Array.isArray(sjList) && sjList.length > 0) {
+						let latest = sjList[0];
+						this.lastInitialCheck = latest.fcheckDate;
+						this.initialConclusion = latest.fcheckResu;
+						this.initialInspector = latest.fcheckBy; // 棣栨浜哄憳锛堝伐鍙�-濮撳悕锛�
+						this.initialCount = latest.xjCount ?? sjList.length; // 浼樺厛鐢▁jCount瀛楁
+					} else if (sjList) {
+						this.lastInitialCheck = sjList.fcheckDate;
+						this.initialConclusion = sjList.fcheckResu;
+						this.initialInspector = sjList.fcheckBy; // 棣栨浜哄憳锛堝伐鍙�-濮撳悕锛�
+						this.initialCount = sjList.xjCount ?? 1;
+					} else {
+						this.lastInitialCheck = '';
+						this.initialConclusion = '';
+						this.initialInspector = '';
+						this.initialCount = 0;
+					}
 				})
 			},
 			getXJByOrder() {
@@ -416,10 +441,24 @@
 						orderNo: this.orderNo
 					}
 				}).then(res => {
-					//this.order = res.data.tbBillList;
-					this.lastPatrolCheck = res.data.tbBillList.fcheckDate;
-					this.patrolConclusion = res.data.tbBillList.fcheckResu;
-					this.patrolCount = res.data.tbBillList.xjCount;
+					let xjList = res.data.tbBillList;
+					if (Array.isArray(xjList) && xjList.length > 0) {
+						let latest = xjList[0];
+						this.lastPatrolCheck = latest.fcheckDate;
+						this.patrolConclusion = latest.fcheckResu;
+						this.patrolInspector = latest.fcheckBy; // 宸℃浜哄憳锛堝伐鍙�-濮撳悕锛�
+						this.patrolCount = latest.xjCount ?? xjList.length;
+					} else if (xjList) {
+						this.lastPatrolCheck = xjList.fcheckDate;
+						this.patrolConclusion = xjList.fcheckResu;
+						this.patrolInspector = xjList.fcheckBy; // 宸℃浜哄憳锛堝伐鍙�-濮撳悕锛�
+						this.patrolCount = xjList.xjCount ?? 1;
+					} else {
+						this.lastPatrolCheck = '';
+						this.patrolConclusion = '';
+						this.patrolInspector = '';
+						this.patrolCount = 0;
+					}
 				})
 			}
 		}
@@ -435,7 +474,6 @@
 		position: absolute;
 		top: -11px;
 		right: 21px;
-		/* padding: 10px 20px; */
 		cursor: pointer;
 		float: right;
 		background-color: #00A2E9;
@@ -443,11 +481,10 @@
 		border: none;
 		font-size: 29px;
 		border-radius: 15px;
-		margin-top: -23px;
-		padding-left: 25px;
-		padding-right: 25px;
 		margin-top: 9px;
 		margin-bottom: 20px;
+		padding-left: 25px;
+		padding-right: 25px;
 	}
 
 		.refresh-btn:hover {
@@ -474,9 +511,7 @@
 		border-radius: 0.5vw;
 		margin-top: 0.3vh;
 		font-size: 1.3vw;
-		/* Larger font for inputs */
 	}
-
 
 	.status-block p {
 		margin: 1vh 0;
@@ -484,7 +519,6 @@
 		font-weight: bold;
 	}
 
-	/* 鍗$墖鏍峰紡 */
 	.card {
 		background-color: #fff;
 		border-radius: 0.8vw;
@@ -494,10 +528,8 @@
 		margin-top: -1vh;
 		margin-bottom: 2vh;
 		font-size: 1.5vw;
-		/* Base font size for card content */
 	}
 
-	/* 鍗$墖鏍囬鍦ㄥ乏涓婅 */
 	.card-header {
 		position: absolute;
 		top: -1vh;
@@ -507,19 +539,16 @@
 		border-radius: 0.5vw;
 		font-weight: bold;
 		font-size: 1.8vw;
-		/* Larger font for headers */
 	}
 
 	.form-item label {
 		float: left;
 		margin-top: 8px;
 		font-size: 1.5vw;
-		/* Larger font for labels */
 		display: inline-block;
 		margin-bottom: 0.5vh;
 		color: #333;
 	}
-
 
 	.status-row label,
 	.check-row label {
@@ -527,7 +556,6 @@
 		padding-right: 1vw;
 		text-align: right;
 		font-size: 1.5vw;
-		/* Increased font for labels in status sections */
 	}
 
 	.status-row input,
@@ -579,7 +607,6 @@
 		border-radius: 100%;
 		text-align: center;
 		margin-top: -42px;
-		/* 	margin-left: 37px; */
 		font-size: 96px;
 		background-color: #476ee1fc;
 		color: #ffffff;

--
Gitblit v1.9.3