快乐的昕的电脑
2025-10-09 68a1318b769f46f87f2a094b40d07e6c3c983697
components/mold.vue
@@ -116,10 +116,24 @@
         };
      },
      methods: {
         searchTool() {
            this.filteredTools = this.toolList.filter(t =>
               t.no.includes(this.searchKey) || t.name.includes(this.searchKey)
            );
            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);
         },
         selectTool(tool) {
            this.selectedToolNo = tool.no;
@@ -141,11 +155,15 @@
            this.selectedToolNo = '';
            this.toolName = '';
            this.toolModel = '';
         },
         setUseLimit() {
            // 保存使用上限逻辑,实际应调用后端接口
            this.$showMessage('使用上限已保存(示例)');
         }
      },
      mounted() {
         // 实际应从后端加载刀具目录和使用记录
         this.filteredTools = this.toolList;
         // 页面加载时拉取全部刀具
         this.fetchTools('');
      }
   };
</script>