From 8e37b959738eaa0e2a92b1b51a4eaf0429aa0e2b Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期五, 24 十月 2025 16:23:33 +0800
Subject: [PATCH] 工单自动带出刀具时也填充寿命比预警值

---
 components/WorkOrder.vue |  389 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 222 insertions(+), 167 deletions(-)

diff --git a/components/WorkOrder.vue b/components/WorkOrder.vue
index 76a5d92..842fc1e 100644
--- a/components/WorkOrder.vue
+++ b/components/WorkOrder.vue
@@ -75,21 +75,21 @@
 
 		<!-- 涓儴锛氳繍琛岀姸鎬� -->
 		<view class="section card">
-			<view class="form-row">
+			<view class="status-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" 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" />
+					<input class="inp" type="text" :value="downtimeDuration" disabled="true" />
 				</view>
 				<view class="form-item">
 					<label>璁惧绋煎姩鐜�:</label>
 					<input class="inp" type="text" v-model="utilizationRate" disabled="true" />
 				</view>
 			</view>
-			<view class="form-row">
+			<view class="status-row">
 				<view class="form-item">
 					<label>鐢熶骇寮�濮嬫椂闂�:</label>
 					<input class="inp" type="text" v-model="startTime" disabled="true" />
@@ -107,7 +107,7 @@
 
 		<!-- 涓嬮儴锛氬搧璐ㄦ楠� -->
 		<view class="section card">
-			<view class="form-row">
+			<view class="quality-row">
 				<view class="form-item">
 					<label>鏈�杩戦妫�鏃堕棿:</label>
 					<input class="inp" type="text" v-model="lastInitialCheck" disabled="true" />
@@ -125,7 +125,7 @@
 					<input class="inp" type="number" v-model="initialCount" disabled="true" />
 				</view>
 			</view>
-			<view class="form-row">
+			<view class="quality-row">
 				<view class="form-item">
 					<label>鏈�杩戝贰妫�鏃堕棿:</label>
 					<input class="inp" type="text" v-model="lastPatrolCheck" disabled="true" />
@@ -182,6 +182,15 @@
 				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);
 			this.sumbit();
@@ -219,7 +228,7 @@
 			// 娣诲姞鍒锋柊鎸夐挳鐨勫鐞嗘柟娉�
 			handleRefresh() {
 				this.$sendPostRequest({
-					url: "http://192.168.0.94:9095/Numerical/RefreshDev",
+                    url: "http://192.168.0.94:9095/Numerical/RefreshDevBycl",
 					data: {
 						machineNo: this.order.machineNo
 					},
@@ -363,8 +372,9 @@
 							cutterName,  //鍒�鍏峰悕绉�
 							cutterModel, //鍒�鍏疯鏍�
 							jdl: '',
-							startCjNum: 0, // 鏂板鍏滃簳瀛楁 淇濈暀鍏跺畠娉ㄩ噴
-							currentCjNum: 0 // 鏂板鍏滃簳瀛楁
+                            startCjNum: 0, // 寮�宸ユ暟閲�
+                            currentCjNum: 0, // 褰撳墠鏁伴噰
+                            todayDowntimeCount //浠婃棩鍋滄満娆℃暟
 						};
 						return;
 					}
@@ -396,33 +406,33 @@
 					title: title
 				});
 			},
-            getSJByOrder() {
-                this.$post({
-                    url: "/MesQaItemsDetect02/FindSJByOrderNo",
-                    data: {
-                        orderNo: this.orderNo
-                    }
-                }).then(res => {
-                    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;
-                    }
-                })
-            },
+			getSJByOrder() {
+				this.$post({
+					url: "/MesQaItemsDetect02/FindSJByOrderNo",
+					data: {
+						orderNo: this.orderNo
+					}
+				}).then(res => {
+					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() {
 				this.$post({
 					url: "/MesQaItemsDetect02/FindXJByOrderNo",
@@ -455,150 +465,195 @@
 </script>
 
 <style>
-	.top-order {
-		margin-bottom: 1vh;
-	}
+    .top-order {
+        margin-bottom: 1vh;
+    }
 
-	.refresh-btn {
-		position: absolute;
-		top: -11px;
-		right: 21px;
-		cursor: pointer;
-		float: right;
-		background-color: #00A2E9;
-		color: white;
-		border: none;
-		font-size: 29px;
-		border-radius: 15px;
-		margin-top: 9px;
-		margin-bottom: 20px;
-		padding-left: 25px;
-		padding-right: 25px;
-	}
+    .refresh-btn {
+        position: absolute;
+        top: -11px;
+        right: 21px;
+        cursor: pointer;
+        float: right;
+        background-color: #00A2E9;
+        color: white;
+        border: none;
+        font-size: 29px;
+        border-radius: 15px;
+        margin-top: 9px;
+        margin-bottom: 20px;
+        padding-left: 25px;
+        padding-right: 25px;
+    }
 
-		.refresh-btn:hover {
-			background-color: #00A2E9;
-		}
+        .refresh-btn:hover {
+            background-color: #00A2E9;
+        }
 
-	.form-row {
-		display: flex;
-		justify-content: space-between;
-		margin-bottom: 1.5vh;
-	}
+    .form-row {
+        display: flex;
+        justify-content: space-between;
+        margin-bottom: 1.5vh;
+    }
 
-	.form-item {
-		width: 100%;
-		padding: 4px;
-		margin: 10px 10px;
-	}
+    .form-item {
+        width: 100%;
+        padding: 4px;
+        margin: 10px 10px;
+    }
 
-	.inp {
-		float: left;
-		width: 63%;
-		padding: 0.5vh;
-		border: 1px solid #ccc;
-		border-radius: 0.5vw;
-		margin-top: 0.3vh;
-		font-size: 1.3vw;
-	}
+    .inp {
+        float: left;
+        width: 63%;
+        padding: 0.5vh;
+        border: 1px solid #ccc;
+        border-radius: 0.5vw;
+        margin-top: 0.3vh;
+        font-size: 1.3vw;
+    }
 
-	.status-block p {
-		margin: 1vh 0;
-		font-size: 1.5vw;
-		font-weight: bold;
-	}
+    .status-block p {
+        margin: 1vh 0;
+        font-size: 1.5vw;
+        font-weight: bold;
+    }
 
-	.card {
-		background-color: #fff;
-		border-radius: 0.8vw;
-		box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
-		padding: 1.5vh;
-		border: 1px solid black;
-		margin-top: -1vh;
-		margin-bottom: 2vh;
-		font-size: 1.5vw;
-	}
+    .card {
+        background-color: #fff;
+        border-radius: 0.8vw;
+        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
+        padding: 1.5vh;
+        border: 1px solid black;
+        margin-top: -1vh;
+        margin-bottom: 2vh;
+        font-size: 1.5vw;
+    }
 
-	.card-header {
-		position: absolute;
-		top: -1vh;
-		left: 2vw;
-		background-color: #ffffff;
-		padding: 0.5vh 1vw;
-		border-radius: 0.5vw;
-		font-weight: bold;
-		font-size: 1.8vw;
-	}
+    .card-header {
+        position: absolute;
+        top: -1vh;
+        left: 2vw;
+        background-color: #ffffff;
+        padding: 0.5vh 1vw;
+        border-radius: 0.5vw;
+        font-weight: bold;
+        font-size: 1.8vw;
+    }
 
-	.form-item label {
-		float: left;
-		margin-top: 8px;
-		font-size: 1.5vw;
-		display: inline-block;
-		margin-bottom: 0.5vh;
-		color: #333;
-	}
+    .form-item label {
+        float: left;
+        margin-top: 8px;
+        font-size: 1.5vw;
+        display: inline-block;
+        margin-bottom: 0.5vh;
+        color: #333;
+    }
 
-	.status-row label,
-	.check-row label {
-		width: 30%;
-		padding-right: 1vw;
-		text-align: right;
-		font-size: 1.5vw;
-	}
+    .status-row label,
+    .check-row label {
+        width: 30%;
+        padding-right: 1vw;
+        text-align: right;
+        font-size: 1.5vw;
+    }
 
-	.status-row input,
-	.check-row input {
-		width: 65%;
-		font-size: 1.5vw;
-	}
+    .status-row input,
+    .check-row input {
+        width: 65%;
+        font-size: 1.5vw;
+    }
 
-	.form-row2 {
-		display: flex;
-		float: left;
-		margin-left: -65px;
-		flex-direction: column;
-		margin-top: -13px;
-		line-height: 48px;
-		align-content: flex-start;
-	}
+    .form-row2 {
+        display: flex;
+        float: left;
+        margin-left: -65px;
+        flex-direction: column;
+        margin-top: -13px;
+        line-height: 48px;
+        align-content: flex-start;
+    }
 
-	.form-row3 {
-		display: flex;
-		flex-direction: column;
-		flex-wrap: nowrap;
-		align-content: flex-start;
-		justify-content: flex-start;
-		align-items: flex-start;
-		margin-bottom: 2.5vh
-	}
+    .form-row3 {
+        display: flex;
+        flex-direction: column;
+        flex-wrap: nowrap;
+        align-content: flex-start;
+        justify-content: flex-start;
+        align-items: flex-start;
+        margin-bottom: 2.5vh
+    }
 
-	.form-row4 {
-		display: flex;
-		flex-direction: row;
-		flex-wrap: nowrap;
-	}
+    .form-row4 {
+        display: flex;
+        flex-direction: row;
+        flex-wrap: nowrap;
+    }
 
-	.inp1 {
-		width: 42%;
-		height: 3.5em;
-		font-weight: bolder;
-		margin-top: -41px;
-		font-size: 39px;
-		text-align: center;
-		color: red;
-	}
+    .inp1 {
+        width: 42%;
+        height: 3.5em;
+        font-weight: bolder;
+        margin-top: -41px;
+        font-size: 39px;
+        text-align: center;
+        color: red;
+    }
 
-	.inp2 {
-		float: right;
-		width: 220px;
-		height: 220px;
-		border-radius: 100%;
-		text-align: center;
-		margin-top: -42px;
-		font-size: 96px;
-		background-color: #476ee1fc;
-		color: #ffffff;
-		margin-right: 172px;
-	}
+    .inp2 {
+        float: right;
+        width: 220px;
+        height: 220px;
+        border-radius: 100%;
+        text-align: center;
+        margin-top: -42px;
+        font-size: 96px;
+        background-color: #476ee1fc;
+        color: #ffffff;
+        margin-right: 172px;
+    }
+
+    .quality-row {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        margin-bottom: 1.5vh;
+    }
+
+    .quality-row .form-item {
+        flex: 1;
+        margin: 0 10px;
+    }
+
+        .quality-row .form-item label {
+            width: auto;
+            min-width: 110px;
+            margin-right: 8px;
+        }
+
+    .quality-row .inp {
+        width: 70%;
+        min-width: 120px;
+    }
+
+    .status-row {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        margin-bottom: 1.5vh;
+    }
+
+        .status-row .form-item {
+            flex: 1;
+            margin: 0 10px;
+        }
+
+            .status-row .form-item label {
+                min-width: 220px; /* 鍙牴鎹疄闄呮儏鍐佃皟鏁村搴� */
+                white-space: nowrap;
+            }
+
+        .status-row .inp {
+            width: 70%;
+            min-width: 120px;
+        }
 </style>
\ No newline at end of file

--
Gitblit v1.9.3