| | |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | // 数量运算保留6位小数,避免浮点减法出现 7.199999999999999 这类精度误差 |
| | | const toQuantity = val => { |
| | | const n = Number(val); |
| | | if (!Number.isFinite(n)) return 0; |
| | | return parseFloat(n.toFixed(6)); |
| | | }; |
| | | const toProgressPercentage = val => { |
| | | const n = Number(val); |
| | | if (!Number.isFinite(n)) return 0; |
| | |
| | | currentReportRowData.value = row; |
| | | const planQuantity = Number(row.planQuantity || 0); |
| | | const completeQuantity = Number(row.completeQuantity || 0); |
| | | const remainingQuantity = Math.max(0, planQuantity - completeQuantity); |
| | | const remainingQuantity = Math.max( |
| | | 0, |
| | | toQuantity(planQuantity - completeQuantity) |
| | | ); |
| | | reportForm.planQuantity = remainingQuantity; |
| | | reportForm.quantity = |
| | | row.quantity !== undefined && row.quantity !== null ? row.quantity : null; |