From a8e998ae4591fb97b0fc7a605226424316ae5742 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 25 十二月 2025 16:44:38 +0800
Subject: [PATCH] 没有调机时间转跳到上下刀界面

---
 pages/index.vue |  126 +++++++++++++++++++++++++++++++++--------
 1 files changed, 101 insertions(+), 25 deletions(-)

diff --git a/pages/index.vue b/pages/index.vue
index 46af944..805efc3 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -361,17 +361,8 @@
 		onShow() {
 			this.refresh();
 			this.resetAutoRedirectTimer();
-			// 椤甸潰鏄剧ず鏃跺姞杞藉伐鍗曞垪琛�
+			// 濡傛灉鍦ㄥ伐鍗曢�夋嫨椤甸潰锛屽惎鍔ㄥ畾鏃跺埛鏂�
 			if (this.currentTab === 7) {
-				// 榛樿閫変腑鈥滃緟寮�宸ャ�佹湭寮�宸ャ�佹殏鍋溾��
-				this.engineeringNo = '寰呭紑宸ャ�佹湭寮�宸ャ�佹殏鍋�';
-				this.engineeringNoMapList = [
-					'寰呭紑宸ャ�佹湭寮�宸ャ�佹殏鍋�',
-					'寮�宸�',
-					'瀹屽伐'
-				];
-				this.getWomdaaByStatus();
-				// 鍚姩瀹氭椂鍒锋柊
 				this.startAutoRefresh();
 			}
 		},
@@ -474,12 +465,20 @@
 			
 			refresh() {
 				this.getMachineList();
-				this.getPrintInfo();
-				this.getWomdaaIsShow();
+				this.getPrintInfo(); // getPrintInfo 瀹屾垚鍚庝細鑷姩璋冪敤 getWomdaaIsShow()
 				// 濡傛灉褰撳墠鍦ㄥ伐鍗曢�夋嫨椤甸潰锛岄粯璁ゅ姞杞藉伐鍗曞垪琛�
 				if (this.currentTab === 7) {
-					// 榛樿閫変腑鈥滃緟寮�宸ャ�佹湭寮�宸ャ�佹殏鍋溾��
-					this.engineeringNo = '寰呭紑宸ャ�佹湭寮�宸ャ�佹殏鍋�';
+					// 鏍规嵁褰撳墠缁戝畾宸ュ崟鐨勭姸鎬佸喅瀹氶粯璁ょ瓫閫夋潯浠�
+					let defaultStatus = '寰呭紑宸ャ�佹湭寮�宸ャ�佹殏鍋�';
+					if (this.isShowTableData.length > 0) {
+						const currentOrderStatus = this.isShowTableData[0].daa018;
+						if (currentOrderStatus === '寮�宸�') {
+							defaultStatus = '寮�宸�';
+						} else if (currentOrderStatus === '瀹屽伐') {
+							defaultStatus = '瀹屽伐';
+						}
+					}
+					this.engineeringNo = defaultStatus;
 					this.engineeringNoMapList = [
 						'寰呭紑宸ャ�佹湭寮�宸ャ�佹殏鍋�',
 						'寮�宸�',
@@ -862,7 +861,12 @@
 			getStartBtnText(item) {
 				const isSelected = this.isShowTableData.length > 0 && this.isShowTableData[0].daa001 === item.daa001;
 				if (isSelected) {
-					return '杞烦鍒颁富鐣岄潰';
+					// 妫�鏌ユ槸鍚︽湁璋冩満鏃堕棿
+					if (this.isShowTableData[0].maShoutTime) {
+						return '杞烦鎶ュ伐鐣岄潰';
+					} else {
+						return '杞烦涓婁笅鍒�鐣岄潰';
+					}
 				}
 				return '寮�宸�';
 			},
@@ -873,8 +877,19 @@
 				const isSelected = this.isShowTableData.length > 0 && this.isShowTableData[0].daa001 === item.daa001;
 				
 				if (isSelected) {
-					// 濡傛灉宸查�変腑锛屽垯璺宠浆鍒颁富鐣岄潰
+					// 濡傛灉宸查�変腑锛屽厛璺宠浆鍒颁富鐣岄潰
 					this.toDetail(item);
+					
+					// 寤惰繜璺宠浆锛氭牴鎹槸鍚︽湁璋冩満鏃堕棿鍐冲畾璺宠浆鍒板摢涓晫闈�
+					setTimeout(() => {
+						if (this.isShowTableData[0].maShoutTime) {
+							// 鏈夎皟鏈烘椂闂达紝璺宠浆鍒版姤宸ョ晫闈�
+							this.currentTab = 4;
+						} else {
+							// 娌℃湁璋冩満鏃堕棿锛岃烦杞埌涓婁笅鍒�鐣岄潰
+							this.currentTab = 2;
+						}
+					}, 100);
 				} else {
 					// 濡傛灉鏈�変腑锛屽垯鎵ц寮�宸ラ�昏緫
 					let orderSelect = [{
@@ -891,16 +906,50 @@
 							editDate: editDate,
 							item: orderSelect
 						}
-					}).then(res => {
+					}).then(async res => {
 						if (res.data.tbBillList) {
 							this.getWomdaaIsShow();
-							uni.showToast({
-								title: '寮�宸ユ垚鍔�',
-								icon: 'success',
-								duration: 2000
-							});
+							
+							// 璋冪敤鍚庣鏂规硶缁戝畾鏁伴噰鏍囧織
+							const bindSuccess = await this.bindDataCollectionFlag(item.daa001);
+							
+							// 缁戝畾鎴愬姛鍚庡啀鎻愮ず寮�宸ユ垚鍔�
+							if (bindSuccess) {
+								uni.showToast({
+									title: '寮�宸ユ垚鍔�',
+									icon: 'success',
+									duration: 2000
+								});
+							}
 						}
 					});
+				}
+			},
+			
+			// 鏂板锛氱粦瀹氭暟閲囨爣蹇楁柟娉�
+			async bindDataCollectionFlag(orderNo) {
+				try {
+					const res = await this.$post({
+						url: '/MesOrderDataCollection/BindDataCollectionFlag',
+						data: {
+							machineNo: this.machineNo,
+							orderNo: orderNo
+						}
+					});
+					
+					if (res && res.status === 0) {
+						console.log('鏁伴噰鏍囧織缁戝畾鎴愬姛');
+						this.$showMessage('鏁伴噰鏍囧織缁戝畾鎴愬姛');
+						return true;
+					} else {
+						console.error('鏁伴噰鏍囧織缁戝畾澶辫触:', res.message || '鏈煡閿欒');
+						this.$showMessage('鏁伴噰鏍囧織缁戝畾澶辫触');
+						return false;
+					}
+				} catch (err) {
+					console.error('缁戝畾鏁伴噰鏍囧織閿欒:', err);
+					this.$showMessage('缁戝畾鏁伴噰鏍囧織澶辫触');
+					return false;
 				}
 			},
 			
@@ -909,7 +958,7 @@
 				if (!this.machineNo) {
 					return;
 				}
-				
+								
 				// 鐩存帴鐢� flag 鍒ゆ柇
 				if (this.hasBindedCutterFlag) {
 					uni.showToast({
@@ -919,10 +968,10 @@
 					});
 					return;
 				}
-				
+								
 				let editDate = this.formatDate(new Date());
 				this.selectedIndexs = [];
-				
+								
 				this.$post({
 					url: "/MesOrderSelect/Remove",
 					data: {
@@ -937,8 +986,35 @@
 							icon: 'success',
 							duration: 2000
 						});
+											
+						// 鏆傚仠鎴愬姛鍚庯紝鍒锋柊褰撳墠椤甸潰
+						setTimeout(() => {
+							this.refresh();
+						}, 500);
 					}
 				});
+			},
+				
+			// 鍚姩鑷姩鍒锋柊
+			startAutoRefresh() {
+				// 鍏堟竻闄ょ幇鏈夊畾鏃跺櫒
+				this.stopAutoRefresh();
+				// 鍙湪宸ュ崟閫夋嫨椤甸潰鍚姩瀹氭椂鍒锋柊
+				if (this.currentTab === 7) {
+					this.autoRefreshTimer = setInterval(() => {
+						if (this.currentTab === 7) {
+							this.refresh();
+						}
+					}, this.autoRefreshInterval);
+				}
+			},
+				
+			// 鍋滄鑷姩鍒锋柊
+			stopAutoRefresh() {
+				if (this.autoRefreshTimer) {
+					clearInterval(this.autoRefreshTimer);
+					this.autoRefreshTimer = null;
+				}
 			}
 		},
 		computed: {}

--
Gitblit v1.9.3