From cb0f0660986138df8cd2b268124edfe9c06b39e3 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 09 十月 2025 11:14:22 +0800
Subject: [PATCH] 添加刀具查询

---
 components/mold.vue |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/components/mold.vue b/components/mold.vue
index a3d446b..d0e0b08 100644
--- a/components/mold.vue
+++ b/components/mold.vue
@@ -116,10 +116,26 @@
 			};
 		},
 		methods: {
-			searchTool() {
-				this.filteredTools = this.toolList.filter(t =>
-					t.no.includes(this.searchKey) || t.name.includes(this.searchKey)
-				);
+			async fetchTools(searchKey) {
+				// 瀹為檯椤圭洰涓鏇挎崲涓轰綘鐨勫悗绔帴鍙e湴鍧�
+				const res = await fetch('/api/QueryTools', {
+					method: 'POST',
+					headers: { 'Content-Type': 'application/json' },
+					body: JSON.stringify(searchKey)
+				});
+				const data = await res.json();
+				if (data.status === 0) {
+					this.filteredTools = data.data.tbBillList.map(t => ({
+						no: t.cutterId || t.no,
+						name: t.cutterName || t.name,
+						model: t.cutterModel || t.model
+					}));
+				} else {
+					this.$showMessage(data.message || '鏌ヨ澶辫触');
+				}
+			},
+			async searchTool() {
+				await this.fetchTools(this.searchKey);
 			},
 			selectTool(tool) {
 				this.selectedToolNo = tool.no;
@@ -141,11 +157,15 @@
 				this.selectedToolNo = '';
 				this.toolName = '';
 				this.toolModel = '';
+			},
+			setUseLimit() {
+				// 淇濆瓨浣跨敤涓婇檺閫昏緫锛屽疄闄呭簲璋冪敤鍚庣鎺ュ彛
+				this.$showMessage('浣跨敤涓婇檺宸蹭繚瀛橈紙绀轰緥锛�');
 			}
 		},
 		mounted() {
-			// 瀹為檯搴斾粠鍚庣鍔犺浇鍒�鍏风洰褰曞拰浣跨敤璁板綍
-			this.filteredTools = this.toolList;
+			// 椤甸潰鍔犺浇鏃舵媺鍙栧叏閮ㄥ垁鍏�
+			this.fetchTools('');
 		}
 	};
 </script>

--
Gitblit v1.9.3