快乐的昕的电脑
2025-10-13 749b366b2af987479d3e13a3dd1a478781211bb7
components/mold.vue
@@ -261,16 +261,17 @@
            this.toolModel = '';
         },
            async fetchFormData() {
                const payload = {
                    workOrderNo: this.workOrderNo && this.workOrderNo.trim() !== '' ? this.workOrderNo : null,
                    machineNo: this.machineNo && this.machineNo.trim() !== '' ? this.machineNo : null,
                };
                const res = await this.$post({
                    url: '/MesCutterLedger/GetFormData',
                    data: JSON.stringify({
                        workOrderNo: this.workOrderNo,
                        machineNo: this.machineNo
                    }),
                    url: '/api/MesCutterLedger/GetFormData', // 加上 /api 前缀
                    data: JSON.stringify(payload),
                    headers: { 'Content-Type': 'application/json' }
                });
                if (res.status === 0) {
                    this.toolRecords = res.data; // 假设后端直接返回表格数组
                    this.toolRecords = res.data;
                } else {
                    this.$showMessage(res.message || '获取表单数据失败');
                }
@@ -280,9 +281,7 @@
            this.fetchTools('');
            this.machineNo = uni.getStorageSync('machineNo') || '';
            this.workOrderNo = uni.getStorageSync('daa001') || '';
            if (this.machineNo && this.workOrderNo) {
                this.fetchFormData();
            }
            if (this.machineNo && this.workOrderNo) {this.fetchFormData();}
        }
   };
</script>