快乐的昕的电脑
2025-10-11 308bf5032884d8c7e0060c5c48db93c77d219d01
components/mold.vue
@@ -260,33 +260,32 @@
            this.toolName = '';
            this.toolModel = '';
         },
         setUseLimit() {
            // 保存使用上限逻辑,实际应调用后端接口
            this.$showMessage('使用上限已保存(示例)');
         },
         async fetchFormData() {
            async fetchFormData() {
                const formData = new FormData();
                formData.append('workOrderNo', this.workOrderNo);
                formData.append('machineNo', this.machineNo);
                const res = await this.$post({
                    url: '/MesCutterLedger/GetFormData',
                    data: JSON.stringify({
                        workOrderNo: this.workOrderNo,
                        machineNo: this.machineNo
                    }),
                    headers: { 'Content-Type': 'application/json' }
                    data: formData,
                    // 不要设置 Content-Type,让浏览器自动设置
                });
                if (res.status === 0) {
                    this.toolRecords = res.data; // 假设后端直接返回表格数组
                    this.toolRecords = res.data;
                } else {
                    this.$showMessage(res.message || '获取表单数据失败');
                }
            }
            },
      },
      mounted() {
         // 页面加载时拉取全部刀具
         this.fetchTools('');
            this.machineNo = uni.getStorageSync('machineNo') || '';// 读取本地缓存的机台编号
         this.workOrderNo = uni.getStorageSync('daa001') || ''; // 读取本地缓存的工单编号
            this.fetchFormData(); // 页面加载时获取表单数据
      }
        mounted() {
            this.fetchTools('');
            this.machineNo = uni.getStorageSync('machineNo') || '';
            this.workOrderNo = uni.getStorageSync('daa001') || '';
            if (this.machineNo && this.workOrderNo) {
                this.fetchFormData();
            }
        }
   };
</script>