From 96e5686d9f80fbd0742058f3781486cb2d05a612 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期五, 31 十月 2025 14:51:20 +0800
Subject: [PATCH] 调试
---
components/machine.vue | 495 ++++++++++++++++++++++++++++--------------------------
1 files changed, 253 insertions(+), 242 deletions(-)
diff --git a/components/machine.vue b/components/machine.vue
index 19a7243..2658bff 100644
--- a/components/machine.vue
+++ b/components/machine.vue
@@ -1,337 +1,348 @@
<template>
- <div class="page">
- <!-- 鍙充笂瑙掑埛鏂� -->
- <div class="top-right">
- <button class="refresh-btn" @click="refresh" :disabled="loading">鍒锋柊</button>
- </div>
+ <view class="page">
+ <!--璋冩満閫佹-->
+ <!-- 鍙充笂瑙掑埛鏂版寜閽� -->
+ <view class="top-right">
+ <button class="refresh-btn" @click="refresh">鍒锋柊</button>
+ </view>
- <!-- 鐘舵�佸尯 -->
- <div class="middle-section">
- <div class="item notice">
- <h4>璇存槑锛氬厛鐐瑰嚮璋冩満寮�濮嬶紝鍐嶇偣鍑婚�佹鍛煎彨锛涙垚鍔熷悗涓や釜鎸夐挳闅愯棌銆傞娆¢妫�鍚堟牸鍚庣郴缁熻嚜鍔ㄥ啓鍏ュ紑宸�/璋冩満瀹屾垚鏃堕棿銆�</h4>
- </div>
-
- <!-- 璋冩満寮�濮� -->
- <div class="item" v-if="showStartBtn">
- <button class="btn-blue"
- @click="onStartClick"
- :disabled="loading">
- 鐐瑰嚮璋冩満寮�濮�
+ <!-- 涓棿鐘舵�侀儴鍒嗭紝涓婁笅缁撴瀯锛屽寘鍚皟鏈烘祦绋嬬殑涓変釜姝ラ -->
+ <view class="middle-section">
+ <view class="item" style="height: 100px;">
+ <h4>
+ <!--璇存槑:
+ 1.鐐瑰嚮'璋冩満寮�濮�'銆�'閫佹鍛煎彨'鍚庡啀鐐瑰嚮'淇濆瓨鐢熸晥'<br />
+ 2.涓荤晫闈㈤妫�鍚堟牸鍚庡啀鐐瑰嚮'淇濆瓨鐢熸晥'<br />
+ 3.棣栨涓嶅悎鏍煎啀鐐瑰嚮'淇濆瓨鐢熸晥'浼氭竻绌洪�佹鏃堕棿<br />
+ 4.娓呯┖閫佹鏃堕棿鍚庣偣鍑烩�樻楠屼笉鍚堟牸閲嶆柊閫佹鍛煎彨鈥欏啀淇濆瓨-->
+ </h4>
+ </view>
+ <view class="item">
+ <!-- 璋冩満寮�濮嬫寜閽紝maStartTime鏈夊�兼椂绂佺敤 -->
+ <button :class="maStartTime ? 'btn-disabled' : 'btn-blue'"
+ :disabled="!!maStartTime"
+ @click="handleMaStartTime">
+ 璋冩満寮�濮�
</button>
- <input class="txt-inp"
- v-model="maStartTime"
- placeholder="鐐瑰嚮鍚庤褰曡皟鏈烘椂闂�"
- disabled />
- <div class="hint">璇存槑锛氱偣鍑昏皟鏈哄紑濮嬪悗锛岃鎸夐挳涓庨�佹鎸夐挳灏嗘牴鎹悗缁搷浣滈殣钘忋��</div>
- </div>
-
- <!-- 宸插紑濮嬩絾鎸夐挳闅愯棌鏃朵粛鏄剧ず鏃堕棿 -->
- <div class="item" v-else>
- <button class="btn-hidden" disabled>璋冩満寮�濮�(宸茶褰�)</button>
- <input class="txt-inp" v-model="maStartTime" disabled />
- </div>
-
- <!-- 閫佹鍛煎彨 -->
- <div class="item" v-if="showShoutBtn">
- <button class="btn-blue"
- @click="onShoutClick"
- :disabled="loading || !maStartTime">
- 鐐瑰嚮閫佹鍛煎彨
+ <!-- 鏄剧ず璋冩満寮�濮嬫椂闂� -->
+ <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>
+
+ <!--鍚敤璇ュ姛鑳�-->
+ <!--鏂板锛氭楠屼笉鍚堟牸閫佹鍛煎彨 鎸夐挳锛堝姛鑳戒笌閫佹鍛煎彨涓�鏍凤紝浠呭湪鐗瑰畾 remark 涓嬪彲浠ョ偣鍑伙級-->
+ <view class="item">
+ <!--妫�楠屼笉鍚堟牸閫佹鍛煎彨鎸夐挳锛屼粎鍦� remark 涓烘寚瀹氭枃鏈� 涓� 褰撳墠鏃犻�佹鏃堕棿 鏃跺彲鐐瑰嚮-->
+ <button :class="canFailResend ? 'btn-blue' : 'btn-disabled'"
+ :disabled="!canFailResend"
+ @click="ReHandleMaShoutTime">
+ 妫�楠屼笉鍚堟牸閲嶆柊閫佹鍛煎彨
+ </button>
+ <!--浠嶅鐢ㄥ悓涓�閫佹鏃堕棿瀛楁锛岄伩鍏嶉噸澶嶇姸鎬�-->
<input class="txt-inp"
v-model="maShoutTime"
- placeholder="鐐瑰嚮鎸夐挳甯﹀嚭鏃堕棿"
- disabled />
- <div class="hint">璇存槑锛氶渶鍏堣皟鏈哄紑濮嬪悗鎵嶈兘閫佹銆�</div>
- </div>
+ placeholder="棣栨涓嶅悎鏍奸噸鏂板懠鍙椂鐐瑰嚮鎸夐挳甯﹀嚭閫佹鏃堕棿"
+ disabled="true" />
+ </view>
- <!-- 宸查�佹 -->
- <div class="item" v-else>
- <button class="btn-hidden" disabled>閫佹鍛煎彨(宸茶褰�)</button>
- <input class="txt-inp" v-model="maShoutTime" disabled />
- </div>
+ </view>
- <!-- 璋冩満瀹屾垚(棣栨OK鑷姩鍐欏叆) -->
- <div class="item">
- <button class="btn-disabled" disabled>
- 棣栨OK=璋冩満瀹屾垚=寮�宸�
- </button>
- <input class="txt-inp"
- v-model="maEndTime"
- placeholder="棣栨棣栨纭OK鍚庣郴缁熷啓鍏�"
- disabled />
- <div class="hint">
- 鑻ラ妫�閫氳繃锛屽悗绔皟鐢� QualifiedInspection 鑷姩鍐欏叆 MaEndTime 涓� StartTime銆�
- </div>
- </div>
- </div>
+ <!-- 搴曢儴淇濆瓨/鍙栨秷鎸夐挳 -->
+ <view class="bottom-section">
+ <!-- 鍙湁璋冩満瀹屾垚鏈~鍐欐椂鎵嶅彲淇濆瓨 -->
+ <button class="save-btn" v-if="!maEndTime" @click="save">淇濆瓨骞剁敓鏁�</button>
+ <!-- 宸插畬鎴愭椂淇濆瓨鎸夐挳绂佺敤 -->
+ <button class="btn-disabled" v-else>淇濆瓨骞剁敓鏁�</button>
+ <button class="cancel-btn" @click="cancel">鍙栨秷</button>
+ </view>
- <!-- 搴曢儴鎿嶄綔 -->
- <div class="bottom-section">
- <button class="save-btn"
- v-if="!maEndTime"
- :disabled="loading || !statusForm.id"
- @click="save">
- 淇濆瓨骞剁敓鏁�
- </button>
- <button class="btn-disabled"
- v-else
- disabled>
- 淇濆瓨骞剁敓鏁�
- </button>
-
- <button class="cancel-btn" :disabled="loading" @click="cancel">
- 鍙栨秷
- </button>
- </div>
-
- <div class="footer-info" v-if="error">
- <span class="error">{{ error }}</span>
- </div>
- </div>
+ </view>
</template>
<script>
export default {
- name: 'AdjustInspect',
props: {
- orderNo: { type: String, required: true },
- orderId: { type: Number, required: true },
- machineNo: { type: String, required: true }
+ orderNo: String, // 宸ュ崟鍙�
+ orderId: Number, // 宸ュ崟ID
+ machineNo: String // 鏈哄彴鍙�
},
data() {
return {
- maShoutTime: '',
- maStartTime: '',
- maEndTime: '',
- statusForm: {},
- flag: -1,
- loading: false,
- error: '',
- showStartBtn: true,
- showShoutBtn: true
+ maShoutTime: '', // 閫佹鍛煎彨鏃堕棿
+ maStartTime: '', // 璋冩満寮�濮嬫椂闂�
+ maEndTime: '', // 璋冩満瀹屾垚鏃堕棿
+ statusForm: {}, // 宸ュ崟鐘舵�佽〃鍗曟暟鎹紙鍖呭惈 remark 瀛楁锛�
+ flag: -1, // 鎿嶄綔鏍囪
+ failedRemark: '棣栨涓嶅悎鏍硷紝閫佹鏃堕棿宸叉竻绌猴紝璇烽噸鏂伴�佹鍛煎彨鐢熸垚鏂扮殑棣栨鍗�' // 棣栨涓嶅悎鏍煎悗鐢卞悗绔繑鍥炵殑鎻愮ず
+ }
+ },
+ computed: {
+ // 婊¤冻棣栨涓嶅悎鏍奸噸鏂板懠鍙潯浠朵笖褰撳墠灏氭湭閲嶆柊鐢熸垚閫佹鏃堕棿 => 鎸夐挳鍙敤
+ canFailResend() {
+ return this.statusForm &&
+ this.statusForm.remark === this.failedRemark &&
+ !this.maShoutTime;
}
},
created() {
- this.loadStatus();
+ // 缁勪欢鍒涘缓鏃惰嚜鍔ㄥ姞杞藉伐鍗曟暟鎹�
+ if (!this.orderId && !this.orderNo) {
+ return;
+ }
+ this.findByOrderId();
},
methods: {
- formatNow() {
- // 浣跨敤椤圭洰宸叉湁鐨勬棩鏈熷伐鍏� (鑻ュ繀椤荤敤 this.$getDate 淇濈暀)
- return this.$getDate('yyyy-mm-dd hh24:mi:ss');
- },
- async loadStatus() {
- this.loading = true;
- this.error = '';
- try {
- const res = await this.$post({
- url: '/MesOrderSta/FindByOrderNo',
- data: {
- orderId: this.orderId,
- orderNo: this.orderNo
- }
- });
- const row = res.data.tbBillList || {};
- this.statusForm = row;
- this.maStartTime = row.maStartTime || '';
- this.maShoutTime = row.maShoutTime || '';
- this.maEndTime = row.maEndTime || '';
- // 鎺у埗鎸夐挳鏄鹃殣
- this.showStartBtn = !this.maStartTime;
- this.showShoutBtn = !this.maShoutTime;
- } catch (e) {
- this.error = '鍔犺浇宸ュ崟鐘舵�佸け璐ワ細' + (e.message || e);
- } finally {
- this.loading = false;
- }
- },
- refresh() {
- this.loadStatus();
- },
- onStartClick() {
- if (this.maStartTime) return;
- this.maStartTime = this.formatNow();
- this.showStartBtn = false;
- // flag 淇濇寔 -1锛屼笉瑙﹀彂鑷姩棣栨閫昏緫
- this.flag = -1;
- },
- onShoutClick() {
+ // 澶勭悊璋冩満寮�濮嬫寜閽偣鍑�
+ handleMaStartTime() {
if (!this.maStartTime) {
- this.$showMessage('璇峰厛鐐瑰嚮璋冩満寮�濮�');
- return;
+ this.setMaStartTime();
+ this.flag = -1; // 璋冩満寮�濮嬫寜閽寜涓嬫椂鍥炰紶鐨刦lag=-1
}
- if (this.maShoutTime) return;
- this.maShoutTime = this.formatNow();
- this.showShoutBtn = false;
- this.flag = -1;
},
- async save() {
+ // 澶勭悊閫佹鍛煎彨鎸夐挳鐐瑰嚮锛堜笉鍚妫�涓嶅悎鏍奸噸鍛煎彨锛�
+ handleMaShoutTime() {
+ if (!this.maShoutTime) {
+ this.stateCheck(1);
+ }
+ },
+ // 棣栨涓嶅悎鏍奸噸鍛煎彨锛歠lag = 2
+ ReHandleMaShoutTime() {
+ if (!this.maShoutTime && this.canFailResend) {
+ this.stateCheck(2);
+ }
+ },
+ // 澶勭悊璋冩満瀹屾垚鎸夐挳鐐瑰嚮
+ 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涓虹┖锛屼笉鍏佽鎺ㄩ��');
+ this.$showMessage("id涓虹┖锛屼笉鍏佽鎺ㄩ��");
return;
}
- this.loading = true;
- this.error = '';
- try {
- const res = await 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,
- flag: this.flag
- }
- });
+ 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,
+ flag: this.flag
+ }
+ }).then(res => {
if (res.data.tbBillList) {
- this.$showMessage('淇濆瓨鎴愬姛');
- await this.loadStatus();
+ this.$showMessage("鍛煎彨鎴愬姛");
+ this.findByOrderId();
} else {
- this.$showMessage('淇濆瓨澶辫触');
+ this.$showMessage("鍛煎彨澶辫触");
this.cancel();
}
- } catch (e) {
- this.error = '淇濆瓨寮傚父锛�' + (e.message || e);
- this.$showMessage('淇濆瓨寮傚父');
- } finally {
- this.loading = false;
- }
+ })
},
+ // 鍙栨秷鎿嶄綔锛屾仮澶嶄负涓婃淇濆瓨鐨勬暟鎹�
cancel() {
- // 鍥為��鍒颁笂娆″姞杞界姸鎬�
- this.maStartTime = this.statusForm.maStartTime || '';
- this.maShoutTime = this.statusForm.maShoutTime || '';
- this.maEndTime = this.statusForm.maEndTime || '';
- this.showStartBtn = !this.maStartTime;
- this.showShoutBtn = !this.maShoutTime;
+ this.maShoutTime = this.statusForm.maShoutTime;
+ this.maStartTime = this.statusForm.maStartTime;
+ this.maEndTime = this.statusForm.maEndTime;
+ },
+ // 閫佹鍛煎彨锛宨tem=1鏃惰缃�佹鍛煎彨鏃堕棿
+ // 閫佹鍛煎彨涓庨噸鏂伴�佹鍛煎彨浠ュ強璋冩満寮�濮嬪搴旂殑 flag 鍊�
+ // flag 璇存槑锛�-1 = 璋冩満寮�濮嬶紱1 = 棣栨閫佹鍛煎彨锛�2 = 涓嶅悎鏍奸噸鏂伴�佹鍛煎彨
+ stateCheck(item) {
+ switch (item) {
+ case 0:
+ break;
+ case 1:// 棣栨閫佹鍛煎彨
+ this.maShoutTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
+ //this.flag = -1; // 閫佹鍛煎彨鏈夊�煎悗锛宖lag濮嬬粓涓�-1
+ break;
+ case 2:// 妫�楠屼笉鍚堟牸閲嶆柊閫佹鍛煎彨
+ this.maShoutTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
+ //this.flag = -1; // 閫佹鍛煎彨鏈夊�煎悗锛宖lag濮嬬粓涓�-1
+ break;
+ default:
+ // 鍏跺畠鍊间笉澶勭悊
+ break;
+ }
+ this.flag = item;
+ },
+ // 鏍规嵁宸ュ崟鍙�/ID鑾峰彇宸ュ崟鐘舵�佹暟鎹�
+ findByOrderId() {
+ this.$post({
+ url: "/MesOrderSta/FindByOrderNo",
+ data: {
+ orderId: this.orderId,
+ orderNo: this.orderNo
+ }
+ }).then(res => {
+ this.statusForm = res.data.tbBillList;
+ this.maShoutTime = res.data.tbBillList.maShoutTime;
+ this.maStartTime = res.data.tbBillList.maStartTime;
+ this.maEndTime = res.data.tbBillList.maEndTime;
+ })
}
- }
- }
+ },
+ mounted() {
+ // 椤甸潰鍔犺浇鏃讹紝鍚姩瀹氭椂鍣紝姣忛殧5鍒嗛挓鑷姩淇濆瓨
+ this.autoSaveTimer = setInterval(() => {
+ this.save(); // 鐩存帴璋冪敤宸叉湁鐨勪繚瀛樻柟娉�
+ }, 1 * 30 * 1000); // 30绉�
+ },
+ beforeDestroy() {
+ // 椤甸潰鍗歌浇鏃舵竻鐞嗗畾鏃跺櫒
+ clearInterval(this.autoSaveTimer);
+ },
+ };
</script>
<style scoped>
+ /* 椤甸潰鏁翠綋甯冨眬 */
.page {
padding: 2vh;
display: flex;
flex-direction: column;
+ justify-content: space-between;
box-sizing: border-box;
height: 100%;
- position: relative;
}
+ /* 鍙充笂瑙掑埛鏂版寜閽� */
.top-right {
position: absolute;
top: 10px;
right: 50px;
- z-index: 10;
+ z-index: 1000;
}
.refresh-btn {
padding: 10px;
background-color: #00A2E9;
- color: #fff;
- font-size: 1.2vw;
+ color: white;
border: none;
- border-radius: 4px;
- cursor: pointer;
+ font-size: 1.5vw;
+ border-radius: 5px;
}
+ label {
+ margin-right: 1vw;
+ font-size: 1.6vw;
+ }
+
+ input {
+ padding: 1vh;
+ font-size: 1.5vw;
+ border: 1px solid #ccc;
+ width: 100%;
+ margin-top: 1vh;
+ box-sizing: border-box;
+ }
+
+ /* 涓棿鐘舵�侀儴鍒嗗竷灞� */
.middle-section {
display: flex;
flex-direction: column;
- gap: 18px;
- margin-top: 60px;
+ margin-bottom: 4vh;
}
.item {
display: flex;
flex-direction: row;
align-items: flex-start;
- gap: 20px;
+ margin-bottom: 2vh;
}
- .item.notice {
- height: auto;
- }
-
button {
- width: 28%;
- min-width: 200px;
- padding: 14px;
- font-size: 1.1vw;
+ width: 100%;
+ padding: 1.5vh;
+ font-size: 1.5vw;
border: none;
- cursor: pointer;
- border-radius: 4px;
+ text-align: center;
+ }
+
+ .btn-disabled {
+ background-color: #ccc;
+ color: white;
}
.btn-blue {
background-color: #00A2E9;
- color: #fff;
+ color: white;
}
- .btn-disabled {
- background-color: #9d9d9d;
- color: #fff;
- cursor: not-allowed;
- }
-
- .btn-hidden {
- background-color: #d0d0d0;
- color: #666;
- cursor: not-allowed;
- }
-
- .txt-inp {
- flex: 1;
- height: 54px;
+ input {
+ margin-top: 10px;
padding: 10px;
- font-size: 1.0vw;
+ font-size: 14px;
border: 1px solid #ccc;
- border-radius: 4px;
- box-sizing: border-box;
+ width: 100%;
}
- .hint {
- flex: 0 0 240px;
- font-size: 0.9vw;
- color: #b40000;
- line-height: 1.4;
- }
-
+ /* 搴曢儴淇濆瓨/鍙栨秷鎸夐挳甯冨眬 */
.bottom-section {
display: flex;
justify-content: space-between;
- margin-top: auto;
- gap: 20px;
- padding-top: 30px;
+ margin-top: 4vh;
}
.save-btn,
.cancel-btn {
width: 48%;
- padding: 16px;
+ padding: 1.5vh;
background-color: #00A2E9;
- color: #fff;
- font-size: 1.2vw;
+ color: white;
+ font-size: 1.6vw;
border: none;
- border-radius: 4px;
- cursor: pointer;
+ text-align: center;
}
- .save-btn:disabled,
- .cancel-btn:disabled {
- background-color: #7fbfdc;
- cursor: not-allowed;
- }
-
- .footer-info {
- margin-top: 16px;
- font-size: 0.9vw;
- }
-
- .error {
- color: #d40000;
+ .txt-inp {
+ height: 8vh;
+ padding: 1vh;
+ font-size: 1.5vw;
+ width: 100%;
+ box-sizing: border-box;
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3