From 24946a7945620878b05120a7fa91a2cc1be550ed Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 13 十一月 2025 13:50:58 +0800
Subject: [PATCH] BUG
---
components/machine.vue | 227 +++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 156 insertions(+), 71 deletions(-)
diff --git a/components/machine.vue b/components/machine.vue
index e47a4ea..e0a039c 100644
--- a/components/machine.vue
+++ b/components/machine.vue
@@ -55,15 +55,15 @@
</view>
<!--鍚敤璇ュ姛鑳�-->
- <!--鏂板锛氭楠屼笉鍚堟牸閫佹鍛煎彨 鎸夐挳锛堝姛鑳戒笌閫佹鍛煎彨涓�鏍凤紝浠呭湪鐗瑰畾 remark 涓嬪彲浠ョ偣鍑伙級-->
+ <!--鏂板锛氭楠屼笉鍚堟牸閫佹鍛煎彨 鎸夐挳锛堝姛鑳戒笌閫佹鍛煎彨涓�鏍凤紝浠呭湪鐗瑰畾 remark 涓嬪彲浠ョ偣鍑伙級-->
<view class="item">
- <!--妫�楠屼笉鍚堟牸閫佹鍛煎彨鎸夐挳锛屼粎鍦� remark 涓烘寚瀹氭枃鏈� 涓� 褰撳墠鏃犻�佹鏃堕棿 鏃跺彲鐐瑰嚮-->
+ <!--妫�楠屼笉鍚堟牸閫佹鍛煎彨鎸夐挳锛屼粎鍦� remark 涓烘寚瀹氭枃鏈� 涓� 褰撳墠鏃犻�佹鏃堕棿 鏃跺彲鐐瑰嚮-->
<button :class="canFailResend ? 'btn-blue' : 'btn-disabled'"
:disabled="!canFailResend"
@click="ReHandleMaShoutTime">
妫�楠屼笉鍚堟牸閲嶆柊閫佹鍛煎彨
</button>
- <!--浠嶅鐢ㄥ悓涓�閫佹鏃堕棿瀛楁锛岄伩鍏嶉噸澶嶇姸鎬�-->
+ <!--浠嶅鐢ㄥ悓涓�閫佹鏃堕棿瀛楁锛岄伩鍏嶉噸澶嶇姸鎬�-->
<input class="txt-inp"
v-model="maShoutTime"
placeholder="棣栨涓嶅悎鏍奸噸鏂板懠鍙椂鐐瑰嚮鎸夐挳甯﹀嚭閫佹鏃堕棿"
@@ -130,12 +130,12 @@
this.stateCheck(1);
}
},
- // 棣栨涓嶅悎鏍奸噸鍛煎彨锛歠lag = 2
- ReHandleMaShoutTime() {
- if (!this.maShoutTime && this.canFailResend) {
- this.stateCheck(2);
- }
- },
+ // 棣栨涓嶅悎鏍奸噸鍛煎彨锛歠lag = 2
+ ReHandleMaShoutTime() {
+ if (!this.maShoutTime && this.canFailResend) {
+ this.stateCheck(2);
+ }
+ },
// 澶勭悊璋冩満瀹屾垚鎸夐挳鐐瑰嚮
handleMaEndTime() {
if (!this.maEndTime) {
@@ -151,17 +151,17 @@
console.log('璋冩満瀹屾垚鎸夐挳琚偣鍑�');
this.maEndTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
},
- // 鍒锋柊宸ュ崟鏁版嵁
+ // 鍒锋柊宸ュ崟鏁版嵁锛堝眬閮ㄥ埛鏂板綋鍓嶇粍浠讹級
refresh() {
this.findByOrderId();
},
- // 淇濆瓨骞剁敓鏁堬紝灏嗘椂闂寸瓑淇℃伅鎻愪氦鍒板悗绔�
+ // 淇濆瓨骞剁敓鏁堬紝灏嗘椂闂寸瓑淇℃伅鎻愪氦鍒板悗绔�
+ // 鍙樻洿锛氳繑鍥� Promise锛涙垚鍔熷悗灞�閮ㄥ埛鏂帮紙璋冪敤 findByOrderId锛夎�屼笉鏄暣椤� reload
save() {
if (!this.statusForm.id) {
this.$showMessage("id涓虹┖锛屼笉鍏佽鎺ㄩ��");
- return;
+ return Promise.resolve();
}
- // 杩斿洖 Promise 鏂逛究璋冪敤鑰呴摼寮忓鐞�
return this.$post({
url: "/MesOrderSta/ChangeMachineTime",
data: {
@@ -174,19 +174,44 @@
flag: this.flag
}
}).then(res => {
- if (res.data && res.data.tbBillList) {
+ if (res && res.data && res.data.tbBillList) {
this.$showMessage("鍛煎彨鎴愬姛");
- // 鍏堝埛鏂扮粍浠舵暟鎹紝纭繚鏈湴鐘舵�佷笌鍚庣涓�鑷�
+
+ // 鍏抽敭淇敼锛氭竻绌� flag 鐨勫��
+ this.flag = -1; // 鎴栬�呮牴鎹笟鍔¢渶姹傝缃负鍏朵粬鍒濆鍊�
+
+ // 鏂规1锛氫娇鐢╱ni-app鐨勯〉闈㈠埛鏂版柟娉�
+ // 鏂规硶1锛氳Е鍙戜笅鎷夊埛鏂帮紙濡傛灉椤甸潰鏀寔锛�
+ if (uni.startPullDownRefresh) {
+ uni.startPullDownRefresh();
+ // 2绉掑悗鍋滄鍒锋柊
+ setTimeout(() => {
+ uni.stopPullDownRefresh();
+ }, 2000);
+ }
+
+ // 鏂规硶2锛氶噸鏂拌皟鐢ㄩ〉闈㈢殑onLoad鏂规硶锛堟帹鑽愶級
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ if (currentPage && currentPage.onLoad) {
+ // 淇濆瓨褰撳墠椤甸潰鍙傛暟
+ const pageOptions = currentPage.options || {};
+ // 閲嶆柊鍔犺浇椤甸潰鏁版嵁
+ currentPage.onLoad(pageOptions);
+ }
+
+ // 鏂规硶3锛氬悓鏃跺埛鏂扮粍浠舵暟鎹�
this.findByOrderId();
- // 鍙鍖栨彁绀哄悗鍒锋柊鏁翠釜椤甸潰锛堟暣椤� reload锛夛紝璁╃晫闈㈠畬鍏ㄩ噸杞�
- setTimeout(() => {
- window.location.reload();
- }, 700); // 700ms 鐢ㄤ簬璁╂彁绀虹煭鏆傚彲瑙侊紝鍙牴鎹渶瑕佽皟鏁存垨鍘绘帀 setTimeout
+
} else {
this.$showMessage("鍛煎彨澶辫触");
this.cancel();
}
return res;
+ }).catch(err => {
+ console.error('淇濆瓨澶辫触锛�', err);
+ this.$showMessage("淇濆瓨鏃跺彂鐢熼敊璇�");
+ throw err;
});
},
// 鍙栨秷鎿嶄綔锛屾仮澶嶄负涓婃淇濆瓨鐨勬暟鎹�
@@ -196,23 +221,23 @@
this.maEndTime = this.statusForm.maEndTime;
},
// 閫佹鍛煎彨锛宨tem=1鏃惰缃�佹鍛煎彨鏃堕棿
- // 閫佹鍛煎彨涓庨噸鏂伴�佹鍛煎彨浠ュ強璋冩満寮�濮嬪搴旂殑 flag 鍊�
- // flag 璇存槑锛�-1 = 璋冩満寮�濮嬶紱1 = 棣栨閫佹鍛煎彨锛�2 = 涓嶅悎鏍奸噸鏂伴�佹鍛煎彨
- stateCheck(item) {
+ // 閫佹鍛煎彨涓庨噸鏂伴�佹鍛煎彨浠ュ強璋冩満寮�濮嬪搴旂殑 flag 鍊�
+ // flag 璇存槑锛�-1 = 璋冩満寮�濮嬶紱1 = 棣栨閫佹鍛煎彨锛�2 = 涓嶅悎鏍奸噸鏂伴�佹鍛煎彨
+ stateCheck(item) {
switch (item) {
case 0:
break;
- case 1:// 棣栨閫佹鍛煎彨
+ 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
+ case 2:// 妫�楠屼笉鍚堟牸閲嶆柊閫佹鍛煎彨
+ this.maShoutTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
+ //this.flag = -1; // 閫佹鍛煎彨鏈夊�煎悗锛宖lag濮嬬粓涓�-1
break;
- default:
- // 鍏跺畠鍊间笉澶勭悊
- break;
+ default:
+ // 鍏跺畠鍊间笉澶勭悊
+ break;
}
this.flag = item;
},
@@ -233,22 +258,30 @@
}
},
mounted() {
- // 椤甸潰鍔犺浇鏃讹紝鍚姩瀹氭椂鍣紝姣忛殧5鍒嗛挓鑷姩淇濆瓨
- this.autoSaveTimer = setInterval(() => {
- this.save(); // 鐩存帴璋冪敤宸叉湁鐨勪繚瀛樻柟娉�
- }, 1 * 30 * 1000); // 30绉�
- },
- beforeDestroy() {
- // 椤甸潰鍗歌浇鏃舵竻鐞嗗畾鏃跺櫒
- clearInterval(this.autoSaveTimer);
- },
+ // 椤甸潰鍔犺浇鏃讹紝鍚姩瀹氭椂鍣紝姣忛殧30绉掕嚜鍔ㄤ繚瀛�
+ this.autoSaveTimer = setInterval(() => {
+ // 1. 璋冩満瀹屾垚鏃堕棿鏈変簡灏变笉鑷姩淇濆瓨
+ if (this.maEndTime) {
+ return;
+ }
+ // 2. 閫佹鏃堕棿涓虹┖涔熶笉鑷姩淇濆瓨
+ if (!this.maShoutTime) {
+ return;
+ }
+ this.save(); // 婊¤冻鏉′欢鎵嶈嚜鍔ㄤ繚瀛�
+ }, 1 * 30 * 1000); // 30绉�
+ },
+ beforeDestroy() {
+ // 椤甸潰鍗歌浇鏃舵竻鐞嗗畾鏃跺櫒
+ clearInterval(this.autoSaveTimer);
+ },
};
</script>
<style scoped>
/* 椤甸潰鏁翠綋甯冨眬 */
.page {
- padding: 2vh;
+ padding: 8px;
display: flex;
flex-direction: column;
justify-content: space-between;
@@ -259,54 +292,56 @@
/* 鍙充笂瑙掑埛鏂版寜閽� */
.top-right {
position: absolute;
- top: 10px;
- right: 50px;
+ top: 8px;
+ right: 40px;
+ width: 200px;
z-index: 1000;
}
.refresh-btn {
- padding: 10px;
+ padding: 8px 16px;
background-color: #00A2E9;
color: white;
border: none;
- font-size: 1.5vw;
+ font-size: 16px;
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;
+ margin-right: 10px;
+ font-size: 16px;
}
/* 涓棿鐘舵�侀儴鍒嗗竷灞� */
.middle-section {
display: flex;
flex-direction: column;
- margin-bottom: 4vh;
+ margin-bottom: 8px;
}
.item {
display: flex;
flex-direction: row;
- align-items: flex-start;
- margin-bottom: 2vh;
+ align-items: center;
+ margin-bottom: 10px;
+ gap: 10px;
+ }
+
+ .item h4 {
+ font-size: 14px;
+ line-height: 1.4;
+ margin: 0;
+ padding: 5px 0;
}
button {
- width: 100%;
- padding: 1.5vh;
- font-size: 1.5vw;
+ width: 50%;
+ flex-shrink: 0;
+ padding: 10px;
+ font-size: 16px;
border: none;
text-align: center;
+ min-height: 40px;
}
.btn-disabled {
@@ -320,36 +355,86 @@
}
input {
- margin-top: 10px;
- padding: 10px;
- font-size: 14px;
+ margin-top: 0;
+ padding: 8px;
+ font-size: 15px;
border: 1px solid #ccc;
- width: 100%;
+ width: 50%;
+ flex-grow: 1;
+ box-sizing: border-box;
}
/* 搴曢儴淇濆瓨/鍙栨秷鎸夐挳甯冨眬 */
.bottom-section {
display: flex;
justify-content: space-between;
- margin-top: 4vh;
+ margin-top: 10px;
+ padding-top: 10px;
}
.save-btn,
.cancel-btn {
width: 48%;
- padding: 1.5vh;
+ padding: 12px;
background-color: #00A2E9;
color: white;
- font-size: 1.6vw;
+ font-size: 18px;
border: none;
text-align: center;
+ min-height: 45px;
}
.txt-inp {
- height: 8vh;
- padding: 1vh;
- font-size: 1.5vw;
- width: 100%;
+ height: 40px;
+ padding: 8px;
+ font-size: 15px;
+ width: 50%;
+ flex-grow: 1;
box-sizing: border-box;
+ margin-top: 0;
+ }
+
+ /* 閽堝1280*717灞忓箷鐨勭壒瀹氫紭鍖� */
+ @media screen and (max-width: 1280px) and (max-height: 800px) {
+ .page {
+ padding: 6px;
+ }
+
+ .middle-section {
+ margin-bottom: 6px;
+ }
+
+ .item {
+ margin-bottom: 8px;
+ }
+
+ .item h4 {
+ font-size: 13px;
+ padding: 3px 0;
+ }
+
+ button {
+ padding: 8px;
+ font-size: 15px;
+ min-height: 38px;
+ }
+
+ .txt-inp {
+ height: 38px;
+ padding: 6px;
+ font-size: 14px;
+ }
+
+ .bottom-section {
+ margin-top: 8px;
+ padding-top: 8px;
+ }
+
+ .save-btn,
+ .cancel-btn {
+ padding: 10px;
+ font-size: 17px;
+ min-height: 42px;
+ }
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3