From 6bb355dfd1e7de545c7fba1ad045285717b0d427 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期六, 18 十月 2025 09:18:31 +0800
Subject: [PATCH] 界面优化

---
 components/machine.vue |  172 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 91 insertions(+), 81 deletions(-)

diff --git a/components/machine.vue b/components/machine.vue
index 2820f9f..5c9556a 100644
--- a/components/machine.vue
+++ b/components/machine.vue
@@ -1,41 +1,60 @@
 <template>
 	<view class="page">
 
+		<!-- 鍙充笂瑙掑埛鏂版寜閽� -->
 		<view class="top-right">
 			<button class="refresh-btn" @click="refresh">鍒锋柊</button>
 		</view>
-		<!-- 涓棿鐘舵�侀儴鍒嗭紝涓婁笅缁撴瀯 -->
+
+		<!-- 涓棿鐘舵�侀儴鍒嗭紝涓婁笅缁撴瀯锛屽寘鍚皟鏈烘祦绋嬬殑涓変釜姝ラ -->
 		<view class="middle-section">
 			<view class="item" style="height: 100px;">
-				<h4>璇存槑:澶氬伐鍗曟ā寮忔椂璋冩満閫佹鏄粺涓�鐨�</h4>
-			</view>
-			<view class="item" v-if="!maStartTime">
-				<button class="btn-blue" @click="setStartTime">璋冩満寮�濮嬶紙=鎹㈡ā瀹屾垚锛�</button>
-				<input class="txt-inp" v-model="maStartTime" placeholder="鐐瑰嚮鎸夐挳甯﹀嚭鏃堕棿" disabled="true" />
-			</view>
-			<view class="item" v-else>
-				<button class="btn-disabled">璋冩満寮�濮嬶紙=鎹㈡ā瀹屾垚锛�</button>
-				<input class="txt-inp" v-model="maStartTime" placeholder="鐐瑰嚮鎸夐挳甯﹀嚭鏃堕棿" disabled="true" />
-			</view>
-			<view class="item" v-if="!maShoutTime">
-				<button @click="stateCheck(1)" class="btn-blue">閫佹鍛煎彨锛堢偣鍑绘寜閽畖娓呴浂鏈哄彴闈㈡澘鏁帮級</button>
-				<input class="txt-inp" v-model="maShoutTime" placeholder="鐐瑰嚮鎸夐挳甯﹀嚭鏃堕棿" disabled="true" />
-			</view>
-			<view class="item" v-else>
-				<button class="btn-disabled">閫佹鍛煎彨锛堢偣鍑绘寜閽畖娓呴浂鏈哄彴闈㈡澘鏁帮級</button>
-				<input class="txt-inp" v-model="maShoutTime" placeholder="鐐瑰嚮鎸夐挳甯﹀嚭鏃堕棿" disabled="true" />
+				<h4>璇存槑:璋冩満寮�濮嬫椂闂撮渶瑕佹墜鍔ㄧ‘璁�</h4>
 			</view>
 			<view class="item">
-				<button class="btn-disabled">璋冩満瀹屾垚锛�=妫�楠岄�氳繃锛�</button>
+				<!-- 璋冩満寮�濮嬫寜閽紝maStartTime鏈夊�兼椂绂佺敤 -->
+				<button :class="maStartTime ? 'btn-disabled' : 'btn-blue'"
+						:disabled="!!maStartTime"
+						@click="handleMaStartTime">
+					璋冩満寮�濮嬶紙=鎹㈡ā瀹屾垚锛�
+				</button>
+				<!-- 鏄剧ず璋冩満寮�濮嬫椂闂� -->
+				<input class="txt-inp" v-model="maStartTime" placeholder="鐐瑰嚮鎸夐挳甯﹀嚭鏃堕棿" disabled="true" />
+			</view>
+			<view class="item">
+				<!-- 閫佹鍛煎彨鎸夐挳锛宮aShoutTime鏈夊�兼椂绂佺敤 -->
+				<button :class="maShoutTime ? 'btn-disabled' : 'btn-blue'"
+						:disabled="!!maShoutTime"
+						@click="handleMaShoutTime">
+					閫佹鍛煎彨锛堢偣鍑绘寜閽畖娓呴浂鏈哄彴闈㈡澘鏁帮級
+				</button>
+				<!-- 鏄剧ず閫佹鍛煎彨鏃堕棿 -->
+				<input class="txt-inp" v-model="maShoutTime" placeholder="鐐瑰嚮鎸夐挳甯﹀嚭鏃堕棿" disabled="true" />
+			</view>
+			<!--<view class="item">-->
+				<!-- 璋冩満瀹屾垚鎸夐挳锛宮aEndTime鏈夊�兼椂绂佺敤 -->
+				<!--<button :class="maEndTime ? 'btn-disabled' : 'btn-blue'"
+						:disabled="!!maEndTime"
+						@click="handleMaEndTime">
+					璋冩満瀹屾垚锛�=妫�楠岄�氳繃锛�
+				</button>-->
+				<!-- 鏄剧ず璋冩満瀹屾垚鏃堕棿 -->
+				<!--<input class="txt-inp" v-model="maEndTime" placeholder="棣栨棣栨纭閫氳繃鍐欏叆" disabled="true" />
+			</view>-->
+			<view class="item">
+				<button class="btn-disabled" disabled>
+					璋冩満瀹屾垚锛�=妫�楠岄�氳繃锛�
+				</button>
 				<input class="txt-inp" v-model="maEndTime" placeholder="棣栨棣栨纭閫氳繃鍐欏叆" disabled="true" />
 			</view>
 		</view>
 
 		<!-- 搴曢儴淇濆瓨/鍙栨秷鎸夐挳 -->
 		<view class="bottom-section">
+			<!-- 鍙湁璋冩満瀹屾垚鏈~鍐欐椂鎵嶅彲淇濆瓨 -->
 			<button class="save-btn" v-if="!maEndTime" @click="save">淇濆瓨骞剁敓鏁�</button>
-			<!-- <button class="save-btn" @click="save">淇濆瓨骞剁敓鏁�</button> -->
-			<button class="btn-disabled" v-else  >淇濆瓨骞剁敓鏁�</button>
+			<!-- 宸插畬鎴愭椂淇濆瓨鎸夐挳绂佺敤 -->
+			<button class="btn-disabled" v-else>淇濆瓨骞剁敓鏁�</button>
 			<button class="cancel-btn" @click="cancel">鍙栨秷</button>
 		</view>
 
@@ -45,74 +64,70 @@
 <script>
 	export default {
 		props: {
-			orderNo: String,
-			orderId: Number,
-			machineNo: String
+			orderNo: String,    // 宸ュ崟鍙�
+			orderId: Number,    // 宸ュ崟ID
+			machineNo: String   // 鏈哄彴鍙�
 		},
 		data() {
 			return {
-				maShoutTime: '',
-				maStartTime: '',
-				maEndTime: '',
-				statusForm: {},
-				flag: -1,
+				maShoutTime: '',   // 閫佹鍛煎彨鏃堕棿
+				maStartTime: '',   // 璋冩満寮�濮嬫椂闂�
+				maEndTime: '',     // 璋冩満瀹屾垚鏃堕棿
+				statusForm: {},    // 宸ュ崟鐘舵�佽〃鍗曟暟鎹�
+				flag: -1,          // 鎿嶄綔鏍囪
 			}
 		},
 		created() {
-
-			// let machine = uni.getStorageSync('machine');
-			// let orderId = uni.getStorageSync('orderId');
-			// let orderNo = uni.getStorageSync('orderNo');
-
-			// if (orderId) {
-			// 	this.orderId = orderId;
-			// } else {
-			// 	if (!this.orderId) {
-			// 		this.orderId = uni.getStorageSync('id');
-			// 	}
-
-			// }
-
-			// if (orderNo) {
-			// 	this.orderNo = orderNo;
-			// } else {
-			// 	if (!this.orderNo) {
-			// 		this.orderNo = uni.getStorageSync('daa001');
-			// 	}
-			// }
-
-			// if (machine) {
-			// 	this.machineNo = machine;
-			// } else {
-			// 	if (!this.machineNo) {
-			// 		this.machineNo = uni.getStorageSync('machineNo');
-			// 	}
-			// }
-
-
+			// 缁勪欢鍒涘缓鏃惰嚜鍔ㄥ姞杞藉伐鍗曟暟鎹�
 			if (!this.orderId && !this.orderNo) {
 				return;
 			}
-
 			this.findByOrderId();
 		},
 		methods: {
-            setStartTime() {
-                this.maStartTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
-            },
-			refresh() {
-				this.findByOrderId(); // This will reload the data for the current order
+			// 澶勭悊璋冩満寮�濮嬫寜閽偣鍑�
+			handleMaStartTime() {
+				if (!this.maStartTime) {
+					this.setMaStartTime();
+				}
 			},
+			// 澶勭悊閫佹鍛煎彨鎸夐挳鐐瑰嚮
+			handleMaShoutTime() {
+				if (!this.maShoutTime) {
+					this.stateCheck(1);
+				}
+			},
+			// 澶勭悊璋冩満瀹屾垚鎸夐挳鐐瑰嚮
+			handleMaEndTime() {
+				if (!this.maEndTime) {
+					this.setMaEndTime();
+				}
+			},
+			// 璁剧疆璋冩満寮�濮嬫椂闂翠负褰撳墠鏃堕棿
+			setMaStartTime() {
+				this.maStartTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
+			},
+			// 璁剧疆璋冩満瀹屾垚鏃堕棿涓哄綋鍓嶆椂闂�
+			setMaEndTime() {
+				console.log('璋冩満瀹屾垚鎸夐挳琚偣鍑�');
+				this.maEndTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
+			},
+			// 鍒锋柊宸ュ崟鏁版嵁
+			refresh() {
+				this.findByOrderId();
+			},
+			// 淇濆瓨骞剁敓鏁堬紝灏嗘椂闂寸瓑淇℃伅鎻愪氦鍒板悗绔�
 			save() {
 				if (!this.statusForm.id) {
 					this.$showMessage("id涓虹┖锛屼笉鍏佽鎺ㄩ��");
 					return;
 				}
-
 				this.$post({
 					url: "/MesOrderSta/ChangeMachineTime",
 					data: {
+						maStartTime: this.maStartTime,
 						maShoutTime: this.maShoutTime,
+						maEndTime: this.maEndTime,
 						id: this.statusForm.id,
 						orderId: this.orderId,
 						machineNo: this.machineNo,
@@ -128,9 +143,13 @@
 					}
 				})
 			},
+			// 鍙栨秷鎿嶄綔锛屾仮澶嶄负涓婃淇濆瓨鐨勬暟鎹�
 			cancel() {
 				this.maShoutTime = this.statusForm.maShoutTime;
+				this.maStartTime = this.statusForm.maStartTime;
+				this.maEndTime = this.statusForm.maEndTime;
 			},
+			// 閫佹鍛煎彨锛宨tem=1鏃惰缃�佹鍛煎彨鏃堕棿
 			stateCheck(item) {
 				switch (item) {
 					case 0:
@@ -143,6 +162,7 @@
 				}
 				this.flag = item;
 			},
+			// 鏍规嵁宸ュ崟鍙�/ID鑾峰彇宸ュ崟鐘舵�佹暟鎹�
 			findByOrderId() {
 				this.$post({
 					url: "/MesOrderSta/FindByOrderNo",
@@ -162,7 +182,7 @@
 </script>
 
 <style scoped>
-	/* 椤甸潰鎾戞弧绐椾綋 */
+	/* 椤甸潰鏁翠綋甯冨眬 */
 	.page {
 		padding: 2vh;
 		display: flex;
@@ -172,6 +192,7 @@
 		height: 100%;
 	}
 
+	/* 鍙充笂瑙掑埛鏂版寜閽� */
 	.top-right {
 		position: absolute;
 		top: 10px;
@@ -188,25 +209,21 @@
 		border-radius: 5px;
 	}
 
-
 	label {
 		margin-right: 1vw;
 		font-size: 1.6vw;
-		/* Larger font for labels */
 	}
 
 	input {
 		padding: 1vh;
 		font-size: 1.5vw;
-		/* Larger font size for inputs */
 		border: 1px solid #ccc;
 		width: 100%;
-		/* Full width for inputs */
 		margin-top: 1vh;
 		box-sizing: border-box;
 	}
 
-	/* 涓棿鐘舵�侀儴鍒嗭紝涓婁笅甯冨眬 */
+	/* 涓棿鐘舵�侀儴鍒嗗竷灞� */
 	.middle-section {
 		display: flex;
 		flex-direction: column;
@@ -222,10 +239,8 @@
 
 	button {
 		width: 100%;
-		/* Full-width buttons */
 		padding: 1.5vh;
 		font-size: 1.5vw;
-		/* Larger font size for buttons */
 		border: none;
 		text-align: center;
 	}
@@ -246,10 +261,9 @@
 		font-size: 14px;
 		border: 1px solid #ccc;
 		width: 100%;
-		/* 杈撳叆妗嗘拺婊″搴� */
 	}
 
-	/* 搴曢儴淇濆瓨/鍙栨秷鎸夐挳 */
+	/* 搴曢儴淇濆瓨/鍙栨秷鎸夐挳甯冨眬 */
 	.bottom-section {
 		display: flex;
 		justify-content: space-between;
@@ -259,12 +273,10 @@
 	.save-btn,
 	.cancel-btn {
 		width: 48%;
-		/* Half-width buttons */
 		padding: 1.5vh;
 		background-color: #00A2E9;
 		color: white;
 		font-size: 1.6vw;
-		/* Larger font size for save/cancel buttons */
 		border: none;
 		text-align: center;
 	}
@@ -273,9 +285,7 @@
 		height: 8vh;
 		padding: 1vh;
 		font-size: 1.5vw;
-		/* Increased font size for input fields in middle section */
 		width: 100%;
-		/* Full width for middle section inputs */
 		box-sizing: border-box;
 	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3