Fix product performance grouped JSON build
This commit is contained in:
@@ -389,6 +389,16 @@ function escapeExcelCsvCell (value) {
|
|||||||
return `"${text.replace(/"/g, '""')}"`
|
return `"${text.replace(/"/g, '""')}"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const excelNumericColumns = new Set(['lTutarTL', 'lTutarUSD', 'lTutarEURO'])
|
||||||
|
|
||||||
|
function formatExcelCsvCell (col, rawValue, displayValue) {
|
||||||
|
if (excelNumericColumns.has(col?.name)) {
|
||||||
|
const numericValue = Number(rawValue)
|
||||||
|
if (Number.isFinite(numericValue)) return String(numericValue).replace('.', ',')
|
||||||
|
}
|
||||||
|
return escapeExcelCsvCell(displayValue)
|
||||||
|
}
|
||||||
|
|
||||||
function exportVisibleRows () {
|
function exportVisibleRows () {
|
||||||
const visibleRows = Array.isArray(rows.value) ? rows.value : []
|
const visibleRows = Array.isArray(rows.value) ? rows.value : []
|
||||||
if (visibleRows.length === 0) return
|
if (visibleRows.length === 0) return
|
||||||
@@ -399,7 +409,7 @@ function exportVisibleRows () {
|
|||||||
...visibleRows.map(row => exportColumns.map(col => {
|
...visibleRows.map(row => exportColumns.map(col => {
|
||||||
const rawValue = typeof col.field === 'function' ? col.field(row) : row?.[col.field]
|
const rawValue = typeof col.field === 'function' ? col.field(row) : row?.[col.field]
|
||||||
const displayValue = typeof col.format === 'function' ? col.format(rawValue, row) : rawValue
|
const displayValue = typeof col.format === 'function' ? col.format(rawValue, row) : rawValue
|
||||||
return escapeExcelCsvCell(displayValue)
|
return formatExcelCsvCell(col, rawValue, displayValue)
|
||||||
}).join(';'))
|
}).join(';'))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -476,6 +476,14 @@ function escapeExcelCsvCell (value) {
|
|||||||
return `"${text.replace(/"/g, '""')}"`
|
return `"${text.replace(/"/g, '""')}"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatExcelCsvCell (col, rawValue, displayValue) {
|
||||||
|
if (col?.name === 'lMMiktar_G') {
|
||||||
|
const numericValue = Number(rawValue)
|
||||||
|
if (Number.isFinite(numericValue)) return String(numericValue).replace('.', ',')
|
||||||
|
}
|
||||||
|
return escapeExcelCsvCell(displayValue)
|
||||||
|
}
|
||||||
|
|
||||||
function exportVisibleRows () {
|
function exportVisibleRows () {
|
||||||
const visibleRows = Array.isArray(rows.value) ? rows.value : []
|
const visibleRows = Array.isArray(rows.value) ? rows.value : []
|
||||||
if (visibleRows.length === 0) {
|
if (visibleRows.length === 0) {
|
||||||
@@ -489,7 +497,7 @@ function exportVisibleRows () {
|
|||||||
...visibleRows.map(row => exportColumns.map(col => {
|
...visibleRows.map(row => exportColumns.map(col => {
|
||||||
const rawValue = typeof col.field === 'function' ? col.field(row) : row?.[col.field]
|
const rawValue = typeof col.field === 'function' ? col.field(row) : row?.[col.field]
|
||||||
const displayValue = typeof col.format === 'function' ? col.format(rawValue, row) : rawValue
|
const displayValue = typeof col.format === 'function' ? col.format(rawValue, row) : rawValue
|
||||||
return escapeExcelCsvCell(displayValue)
|
return formatExcelCsvCell(col, rawValue, displayValue)
|
||||||
}).join(';'))
|
}).join(';'))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user