Fix product performance grouped JSON build
This commit is contained in:
@@ -470,14 +470,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="sub-right pcd-sub-right-clickable" @click="toggleGroup(grp, gi)">
|
<div class="sub-right pcd-sub-right-clickable" @click="toggleGroup(grp, gi)">
|
||||||
<span class="pcd-group-total-text">
|
<span class="pcd-group-total-text">
|
||||||
Grup Toplamı TRY: {{ formatBarMoney(resolveGroupTRYTutar(gi, groupTotalsRevision)) }}
|
Grup Toplamı TRY: {{ formatBarMoney(grp.tryTotal) }}
|
||||||
<span class="pcd-group-total-divider">|</span>
|
<span class="pcd-group-total-divider">|</span>
|
||||||
USD: {{ formatBarMoney(resolveGroupUSDTutar(gi, groupTotalsRevision)) }}
|
USD: {{ formatBarMoney(grp.usdTotal) }}
|
||||||
</span>
|
|
||||||
<span class="pcd-group-debug">
|
|
||||||
Tanı: {{ resolveRenderedGroupIncludedCount(gi) }}/{{ resolveRenderedGroupRowCount(gi) }} kalem
|
|
||||||
<span>|</span>
|
|
||||||
Ham TRY: {{ formatBarMoney(resolveGroupTRYTutar(gi, groupTotalsRevision)) }}
|
|
||||||
</span>
|
</span>
|
||||||
<q-icon
|
<q-icon
|
||||||
:name="isGroupOpen(grp, gi) ? 'expand_less' : 'expand_more'"
|
:name="isGroupOpen(grp, gi) ? 'expand_less' : 'expand_more'"
|
||||||
@@ -1125,8 +1120,6 @@ const canReadOrder = canRead('order')
|
|||||||
const detailLoading = ref(false)
|
const detailLoading = ref(false)
|
||||||
const detailError = ref('')
|
const detailError = ref('')
|
||||||
const detailGroups = ref([])
|
const detailGroups = ref([])
|
||||||
const groupTotalsRevision = ref(0)
|
|
||||||
const renderedGroupAmounts = ref({})
|
|
||||||
const detailHeader = ref(null)
|
const detailHeader = ref(null)
|
||||||
const costDate = ref('')
|
const costDate = ref('')
|
||||||
const exchangeRates = ref(createEmptyExchangeRates())
|
const exchangeRates = ref(createEmptyExchangeRates())
|
||||||
@@ -2847,7 +2840,6 @@ function recalculateAllDetailRows () {
|
|||||||
...grp,
|
...grp,
|
||||||
items: (Array.isArray(grp?.items) ? grp.items : []).map(row => recalculateDetailRow({ ...row }, { preserveInputs: true }))
|
items: (Array.isArray(grp?.items) ? grp.items : []).map(row => recalculateDetailRow({ ...row }, { preserveInputs: true }))
|
||||||
}))
|
}))
|
||||||
refreshLiveGroupTotals()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveRowTRYTutar (row) {
|
function resolveRowTRYTutar (row) {
|
||||||
@@ -2931,74 +2923,6 @@ const detailGroupsWithTotals = computed(() => (
|
|||||||
})
|
})
|
||||||
))
|
))
|
||||||
|
|
||||||
function refreshLiveGroupTotals () {
|
|
||||||
// Totals are derived directly from reactive rows. The revision only forces
|
|
||||||
// Quasar's table/sub-header render after an in-place row edit.
|
|
||||||
groupTotalsRevision.value += 1
|
|
||||||
}
|
|
||||||
|
|
||||||
const pendingRenderedAmounts = new Map()
|
|
||||||
let renderedAmountFlushScheduled = false
|
|
||||||
|
|
||||||
function captureRenderedGroupAmount (groupIndex, grp, row, currency, value) {
|
|
||||||
const rowKey = String(row?.__rowKey || row?.nOnMLDetNo || row?.sKodu || '').trim()
|
|
||||||
const cacheKey = `${groupIndex}:${rowKey}`
|
|
||||||
const previousPending = pendingRenderedAmounts.get(cacheKey) || {}
|
|
||||||
pendingRenderedAmounts.set(cacheKey, {
|
|
||||||
...previousPending,
|
|
||||||
groupIndex,
|
|
||||||
rowKey,
|
|
||||||
included: shouldIncludeRowInGroupTotal(grp, row),
|
|
||||||
[currency]: parseMoneyInput(value)
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!renderedAmountFlushScheduled) {
|
|
||||||
renderedAmountFlushScheduled = true
|
|
||||||
Promise.resolve().then(() => {
|
|
||||||
const next = { ...renderedGroupAmounts.value }
|
|
||||||
let changed = false
|
|
||||||
pendingRenderedAmounts.forEach(entry => {
|
|
||||||
const groupRows = { ...(next[entry.groupIndex] || {}) }
|
|
||||||
const previous = groupRows[entry.rowKey] || {}
|
|
||||||
if (previous.try !== entry.try || previous.usd !== entry.usd || previous.included !== entry.included) {
|
|
||||||
groupRows[entry.rowKey] = { ...previous, ...entry }
|
|
||||||
changed = true
|
|
||||||
}
|
|
||||||
next[entry.groupIndex] = groupRows
|
|
||||||
})
|
|
||||||
pendingRenderedAmounts.clear()
|
|
||||||
renderedAmountFlushScheduled = false
|
|
||||||
if (changed) {
|
|
||||||
renderedGroupAmounts.value = next
|
|
||||||
groupTotalsRevision.value += 1
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderedRowsForGroup (groupIndex) {
|
|
||||||
return Object.values(renderedGroupAmounts.value[groupIndex] || {})
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveRenderedGroupIncludedCount (groupIndex) {
|
|
||||||
const grp = detailGroups.value[groupIndex]
|
|
||||||
return (Array.isArray(grp?.items) ? grp.items : []).filter(row => shouldIncludeRowInGroupTotal(grp, row)).length
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveRenderedGroupRowCount (groupIndex) {
|
|
||||||
const grp = detailGroups.value[groupIndex]
|
|
||||||
return Array.isArray(grp?.items) ? grp.items.length : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveGroupTRYTutar (groupIndex, _revision) {
|
|
||||||
return parseMoneyInput(detailGroupsWithTotals.value[groupIndex]?.tryTotal)
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveGroupUSDTutar (groupIndex, _revision) {
|
|
||||||
return parseMoneyInput(detailGroupsWithTotals.value[groupIndex]?.usdTotal)
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveGroupQuantity (grp) {
|
function resolveGroupQuantity (grp) {
|
||||||
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
return (Array.isArray(grp?.items) ? grp.items : []).reduce((total, row) => (
|
||||||
total + resolveNumericRowQuantity(row)
|
total + resolveNumericRowQuantity(row)
|
||||||
@@ -3121,8 +3045,6 @@ async function fetchDetail (options = {}) {
|
|||||||
detailLoading.value = true
|
detailLoading.value = true
|
||||||
detailError.value = ''
|
detailError.value = ''
|
||||||
detailGroups.value = []
|
detailGroups.value = []
|
||||||
renderedGroupAmounts.value = {}
|
|
||||||
pendingRenderedAmounts.clear()
|
|
||||||
detailHeader.value = null
|
detailHeader.value = null
|
||||||
costDate.value = ''
|
costDate.value = ''
|
||||||
exchangeRates.value = createEmptyExchangeRates()
|
exchangeRates.value = createEmptyExchangeRates()
|
||||||
@@ -3380,7 +3302,7 @@ function onRowQuantityInput (row, value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function triggerUIUpdate () {
|
function triggerUIUpdate () {
|
||||||
refreshLiveGroupTotals()
|
// detailGroupsWithTotals is computed from the reactive row fields.
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeRowQuantityDisplay (row) {
|
function normalizeRowQuantityDisplay (row) {
|
||||||
|
|||||||
Reference in New Issue
Block a user