| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | async fetchTools(searchKey) { |
| | | // 实际项目中请替换为你的后端接口地址 |
| | | 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 fetchTools(searchKey) { |
| | | // 注意:body 直接是字符串 |
| | | const res = await fetch('/api/MesOrderSta/QueryTools', { |
| | | method: 'POST', |
| | | headers: { 'Content-Type': 'application/json' }, |
| | | body: JSON.stringify(searchKey) // 这里 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); |
| | | }, |