| | |
| | | // 计算总制造数量 (默认qtyRequired的和) |
| | | const totalAssignedQuantity = selectedRows.value.reduce((sum, row) => { |
| | | return sum + Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0); |
| | | }, 0); |
| | | sumAssignedQuantity.value = totalAssignedQuantity; |
| | | console.log(totalAssignedQuantity); |
| | | }, 0); // 避免浮点数精度问题(如 37.800000000000004) |
| | | const fixedTotal = Math.round(totalAssignedQuantity * 100) / 100; |
| | | sumAssignedQuantity.value = fixedTotal; |
| | | console.log(fixedTotal); |
| | | // 设置表单数据 |
| | | mergeForm.productName = productName; |
| | | mergeForm.model = firstRow.model || ""; |
| | | mergeForm.totalAssignedQuantity = totalAssignedQuantity; |
| | | mergeForm.totalAssignedQuantity = fixedTotal; |
| | | mergeForm.planCompleteTime = firstRow.requiredDate || ""; |
| | | mergeForm.productId = firstRow.productId || ""; |
| | | mergeForm.ids = selectedRows.value.map(row => row.id); |