From 270a7479cdb5cc70395c0703e46b28108e008923 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期三, 22 十月 2025 11:20:08 +0800
Subject: [PATCH] 调试2
---
components/machine.vue | 221 +++++++++++++++++++++++++------------------------------
1 files changed, 101 insertions(+), 120 deletions(-)
diff --git a/components/machine.vue b/components/machine.vue
index 747de62..45f567e 100644
--- a/components/machine.vue
+++ b/components/machine.vue
@@ -1,38 +1,12 @@
<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="setMaStartTime">璋冩満寮�濮嬶紙=鎹㈡ā瀹屾垚锛�</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" />
- </view>
- <view class="item">
- <button class="btn-disabled">璋冩満瀹屾垚锛�=妫�楠岄�氳繃锛�</button>
- <input class="txt-inp" v-model="maEndTime" placeholder="棣栨棣栨纭閫氳繃鍐欏叆" disabled="true" />
- </view>
- </view>
- -->
- <!-- 涓棿鐘舵�侀儴鍒嗭紝涓婁笅缁撴瀯 -->
+
+ <!-- 涓棿鐘舵�侀儴鍒嗭紝涓婁笅缁撴瀯锛屽寘鍚皟鏈烘祦绋嬬殑涓変釜姝ラ -->
<view class="middle-section">
<view class="item" style="height: 100px;">
<h4>璇存槑:璋冩満寮�濮嬫椂闂撮渶瑕佹墜鍔ㄧ‘璁�</h4>
@@ -41,26 +15,35 @@
<!-- 璋冩満寮�濮嬫寜閽紝maStartTime鏈夊�兼椂绂佺敤 -->
<button :class="maStartTime ? 'btn-disabled' : 'btn-blue'"
:disabled="!!maStartTime"
- @click="!maStartTime && setMaStartTime">
- 璋冩満寮�濮嬶紙=鎹㈡ā瀹屾垚锛�
+ @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="!maShoutTime && stateCheck(1)">
- 閫佹鍛煎彨锛堢偣鍑绘寜閽畖娓呴浂鏈哄彴闈㈡澘鏁帮級
+ @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">
- <!-- 璋冩満瀹屾垚鎸夐挳锛宮aEndTime鏈夊�兼椂绂佺敤 -->
- <button :class="maEndTime ? 'btn-disabled' : 'btn-blue'"
- :disabled="!!maEndTime"
- @click="!maEndTime && setMaEndTime">
- 璋冩満瀹屾垚锛�=妫�楠岄�氳繃锛�
+ <button class="btn-disabled" disabled>
+ 璋冩満瀹屾垚锛�=妫�楠岄�氳繃=寮�宸ワ級
</button>
<input class="txt-inp" v-model="maEndTime" placeholder="棣栨棣栨纭閫氳繃鍐欏叆" disabled="true" />
</view>
@@ -68,8 +51,9 @@
<!-- 搴曢儴淇濆瓨/鍙栨秷鎸夐挳 -->
<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="cancel-btn" @click="cancel">鍙栨秷</button>
</view>
@@ -80,79 +64,84 @@
<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: {
+ // 澶勭悊璋冩満寮�濮嬫寜閽偣鍑�
+ handleMaStartTime() {
+ if (!this.maStartTime) {
+ this.setMaStartTime();
+ this.flag = -1; // 璋冩満寮�濮嬫寜閽寜涓嬫椂鍥炰紶鐨刦lag=-1
+ }
+ },
+ // 澶勭悊閫佹鍛煎彨鎸夐挳鐐瑰嚮
+ 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(); // This will reload the data for the current order
+ console.log('璋冩満瀹屾垚鎸夐挳琚偣鍑�');
+ this.maEndTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
},
+ // 鍒锋柊宸ュ崟鏁版嵁
+ refresh() {
+ this.findByOrderId();
+ },
+ // 鍏ㄧ晫闈㈠埛鏂帮細娓呯┖鏈湴鐘舵�佸悗閲嶆柊鎷夊彇锛堜笉鍒犻櫎浠讳綍鍘熸湁娉ㄩ噴锛�
+ fullReload() {
+ // 娓呯┖褰撳墠鏄剧ず鏁版嵁锛岄伩鍏嶆棫鏁版嵁鐭殏闂儊
+ this.maShoutTime = '';
+ this.maStartTime = '';
+ this.maEndTime = '';
+ this.statusForm = {};
+ this.flag = -1;
+ // 涓嬩竴甯ч噸鏂拌幏鍙�
+ this.$nextTick(() => {
+ this.findByOrderId();
+ });
+ },
+ // 淇濆瓨骞剁敓鏁堬紝灏嗘椂闂寸瓑淇℃伅鎻愪氦鍒板悗绔�
save() {
if (!this.statusForm.id) {
this.$showMessage("id涓虹┖锛屼笉鍏佽鎺ㄩ��");
return;
}
-
this.$post({
url: "/MesOrderSta/ChangeMachineTime",
data: {
- maStartTime: this.maStartTime, // 鏂板璋冩満鏃堕棿
+ maStartTime: this.maStartTime,
maShoutTime: this.maShoutTime,
- maEndTime: this.maEndTime, // 鏂板璋冩満瀹屾垚鏃堕棿
+ maEndTime: this.maEndTime,
id: this.statusForm.id,
orderId: this.orderId,
machineNo: this.machineNo,
@@ -161,30 +150,32 @@
}).then(res => {
if (res.data.tbBillList) {
this.$showMessage("鍛煎彨鎴愬姛");
- this.findByOrderId();
+ // 鍛煎彨鎴愬姛鍚庡埛鏂版暣涓晫闈�
+ this.fullReload();
} else {
this.$showMessage("鍛煎彨澶辫触");
this.cancel();
}
})
},
+ // 鍙栨秷鎿嶄綔锛屾仮澶嶄负涓婃淇濆瓨鐨勬暟鎹�
cancel() {
this.maShoutTime = this.statusForm.maShoutTime;
this.maStartTime = this.statusForm.maStartTime;
this.maEndTime = this.statusForm.maEndTime;
},
- stateCheck(item) {
- switch (item) {
- case 0:
- break;
- case 1:
- this.maShoutTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
- break;
- case 2:
- break;
- }
- this.flag = item;
- },
+ // 閫佹鍛煎彨锛宨tem=1鏃惰缃�佹鍛煎彨鏃堕棿
+ stateCheck(item) {
+ switch (item) {
+ case 1:
+ this.maShoutTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
+ // 鑻ヤ笉甯屾湜瑙﹀彂鑷姩棣栨锛屼繚鎸� -1
+ this.flag = -1;
+ break;
+ }
+ // 涓嶅啀鍐� this.flag = item;
+ },
+ // 鏍规嵁宸ュ崟鍙�/ID鑾峰彇宸ュ崟鐘舵�佹暟鎹�
findByOrderId() {
this.$post({
url: "/MesOrderSta/FindByOrderNo",
@@ -204,7 +195,7 @@
</script>
<style scoped>
- /* 椤甸潰鎾戞弧绐椾綋 */
+ /* 椤甸潰鏁翠綋甯冨眬 */
.page {
padding: 2vh;
display: flex;
@@ -214,6 +205,7 @@
height: 100%;
}
+ /* 鍙充笂瑙掑埛鏂版寜閽� */
.top-right {
position: absolute;
top: 10px;
@@ -230,44 +222,38 @@
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;
margin-bottom: 4vh;
}
- .item {
- display: flex;
- flex-direction: column; /* 鍘熸潵鏄� row */
- align-items: flex-start;
- margin-bottom: 2vh;
- }
+ .item {
+ display: flex;
+ flex-direction: row;
+ align-items: flex-start;
+ margin-bottom: 2vh;
+ }
button {
width: 100%;
- /* Full-width buttons */
padding: 1.5vh;
font-size: 1.5vw;
- /* Larger font size for buttons */
border: none;
text-align: center;
}
@@ -288,10 +274,9 @@
font-size: 14px;
border: 1px solid #ccc;
width: 100%;
- /* 杈撳叆妗嗘拺婊″搴� */
}
- /* 搴曢儴淇濆瓨/鍙栨秷鎸夐挳 */
+ /* 搴曢儴淇濆瓨/鍙栨秷鎸夐挳甯冨眬 */
.bottom-section {
display: flex;
justify-content: space-between;
@@ -301,12 +286,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;
}
@@ -315,9 +298,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