| | |
| | | }; |
| | | |
| | | const mergeSelectedProducts = selectedRows => { |
| | | const existing = new Set((form.value.purchaseReturnOrderProductsDtos || []).map(i => String(i.salesLedgerProductId || i.id))); |
| | | const existing = new Set( |
| | | (form.value.purchaseReturnOrderProductsDtos || []).map(i => |
| | | String(i.stockInRecordId || i.salesLedgerProductId || i.id) |
| | | ) |
| | | ); |
| | | const toAdd = (selectedRows || []) |
| | | .filter(i => !existing.has(String(i.id))) |
| | | .map(i => ({ |
| | | ...i, |
| | | stockInRecordId: i.stockInRecordId || i.id, |
| | | salesLedgerProductId: i.id, |
| | | returnQuantity: 0, |
| | | taxInclusiveTotalPrice: 0, |
| | |
| | | loading.value = true; |
| | | const rows = (form.value.purchaseReturnOrderProductsDtos || []).map(i => { |
| | | const cloned = { ...i }; |
| | | cloned.stockInRecordId = cloned.stockInRecordId || cloned.id; |
| | | syncRowTotal(cloned); |
| | | return cloned; |
| | | }); |