快乐的昕的电脑
2025-10-09 7cf04fdaf898c6d055d3b5915e70f1e3af7d85f2
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: JSON.stringify(searchKey), // 注意要手动序列化
                    headers: { 'Content-Type': 'application/json' }
                });
                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>