快乐的昕的电脑
2025-10-09 68a1318b769f46f87f2a094b40d07e6c3c983697
components/mold.vue
@@ -116,24 +116,22 @@
         };
      },
      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) {
                // 传递对象,而不是字符串
                const res = await this.$post({
                    url: '/MesCutterLedger/QueryTools',
                    data:searchKey
                });
                if (res.status === 0) {
                    this.filteredTools = res.data.tbBillList.map(t => ({
                        no: t.cutterId || t.no,
                        name: t.cutterName || t.name,
                        model: t.cutterModel || t.model
                    }));
                } else {
                    this.$showMessage(res.message || '查询失败');
                }
            },
         async searchTool() {
            await this.fetchTools(this.searchKey);
         },