v6: исправлен rowId — теперь берёт КАТО из заголовка колонки

This commit is contained in:
Dauren777 2026-06-24 07:43:20 +00:00
parent 854a459915
commit 3bd259c5d2

View File

@ -173,9 +173,9 @@ function detectColumn(name) {
return null; return null;
} }
function rowId(row, idx) { function rowId(row, idx, headers) {
const katoCol = dataColumns.indexOf('kato'); const katoCol = dataColumns.indexOf('kato');
if (katoCol !== -1 && row[dataColumns[katoCol]]) return String(row[dataColumns[katoCol]]).trim(); if (katoCol !== -1 && row[headers[katoCol]]) return String(row[headers[katoCol]]).trim();
return 'row_' + idx; return 'row_' + idx;
} }
@ -470,7 +470,7 @@ function handleFile(file) {
allData = rows.map((r, idx) => { allData = rows.map((r, idx) => {
const obj = {}; const obj = {};
headers.forEach((h, i) => { obj[h] = r[i] != null ? r[i] : ''; }); headers.forEach((h, i) => { obj[h] = r[i] != null ? r[i] : ''; });
obj._id = rowId(obj, idx); obj._id = rowId(obj, idx, headers);
return obj; return obj;
}); });
allData.columns = headers; allData.columns = headers;