From 308bf5032884d8c7e0060c5c48db93c77d219d01 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期六, 11 十月 2025 16:41:54 +0800
Subject: [PATCH] bug修改

---
 components/mold.vue |   81 ++++++++++++++++++++++++++++++++++------
 1 files changed, 69 insertions(+), 12 deletions(-)

diff --git a/components/mold.vue b/components/mold.vue
index 5c608d3..d490fa0 100644
--- a/components/mold.vue
+++ b/components/mold.vue
@@ -175,7 +175,28 @@
 			confirmTool() {
 				this.showToolDialog = false;
 			},
-            async handleUpTool() {
+			async handleUpTool() {
+                if (!this.workOrderNo) {
+                    this.$showMessage('宸ュ崟鍙蜂笉鑳戒负绌�');
+                    return;
+                }
+                if (!this.machineNo) {
+                    this.$showMessage('鏈哄彴鍙蜂笉鑳戒负绌�');
+                    return;
+                }
+                if (!this.selectedToolNo) {
+                    this.$showMessage('鍒�鍏风紪鍙蜂笉鑳戒负绌�');
+                    return;
+                }
+                if (!this.useLimitInput) {
+                    this.$showMessage('浣跨敤涓婇檺涓嶈兘涓虹┖');
+                    return;
+				}
+                const useLimit = Number(this.useLimitInput);
+                if (isNaN(useLimit) || useLimit <= 0) {
+                    this.$showMessage('璇疯緭鍏ユ湁鏁堢殑浣跨敤涓婇檺');
+                    return;
+                }
                 const payload = {
                     workOrderNo: this.workOrderNo,   // 宸ュ崟鍙�
                     machineNo: this.machineNo,       // 鏈哄彴缂栧彿
@@ -194,7 +215,28 @@
                     this.$showMessage(res.message || '涓婂垁鎻愪氦澶辫触');
                 }
             },
-            async handleDownTool() {
+			async handleDownTool() {
+                if (!this.workOrderNo) {
+                    this.$showMessage('宸ュ崟鍙蜂笉鑳戒负绌�');
+                    return;
+                }
+                if (!this.machineNo) {
+                    this.$showMessage('鏈哄彴鍙蜂笉鑳戒负绌�');
+                    return;
+                }
+                if (!this.selectedToolNo) {
+                    this.$showMessage('鍒�鍏风紪鍙蜂笉鑳戒负绌�');
+                    return;
+                }
+                if (!this.useLimitInput) {
+                    this.$showMessage('浣跨敤涓婇檺涓嶈兘涓虹┖');
+                    return;
+				}
+                const useLimit = Number(this.useLimitInput);
+                if (isNaN(useLimit) || useLimit <= 0) {
+                    this.$showMessage('璇疯緭鍏ユ湁鏁堢殑浣跨敤涓婇檺');
+                    return;
+                }
                 const payload = {
                     workOrderNo: this.workOrderNo,
                     machineNo: this.machineNo,
@@ -218,17 +260,32 @@
 				this.toolName = '';
 				this.toolModel = '';
 			},
-			setUseLimit() {
-				// 淇濆瓨浣跨敤涓婇檺閫昏緫锛屽疄闄呭簲璋冪敤鍚庣鎺ュ彛
-				this.$showMessage('浣跨敤涓婇檺宸蹭繚瀛橈紙绀轰緥锛�');
-			}
+            async fetchFormData() {
+                const formData = new FormData();
+                formData.append('workOrderNo', this.workOrderNo);
+                formData.append('machineNo', this.machineNo);
+
+                const res = await this.$post({
+                    url: '/MesCutterLedger/GetFormData',
+                    data: formData,
+                    // 涓嶈璁剧疆 Content-Type锛岃娴忚鍣ㄨ嚜鍔ㄨ缃�
+                });
+
+                if (res.status === 0) {
+                    this.toolRecords = res.data;
+                } else {
+                    this.$showMessage(res.message || '鑾峰彇琛ㄥ崟鏁版嵁澶辫触');
+                }
+            },
 		},
-		mounted() {
-			// 椤甸潰鍔犺浇鏃舵媺鍙栧叏閮ㄥ垁鍏�
-			this.fetchTools('');            
-            this.machineNo = uni.getStorageSync('machineNo') || '';// 璇诲彇鏈湴缂撳瓨鐨勬満鍙扮紪鍙�
-            this.workOrderNo = uni.getStorageSync('workOrderNo') || '';// 璇诲彇鏈湴缂撳瓨鐨勫伐鍗曠紪鍙�
-		}
+        mounted() {
+            this.fetchTools('');
+            this.machineNo = uni.getStorageSync('machineNo') || '';
+            this.workOrderNo = uni.getStorageSync('daa001') || '';
+            if (this.machineNo && this.workOrderNo) {
+                this.fetchFormData();
+            }
+        }
 	};
 </script>
 

--
Gitblit v1.9.3