| | |
| | | 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 || '获取表单数据失败'); |
| | | } |
| | |
| | | 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> |