diff --git a/batch_v2.py b/batch_v2.py index 63143d4..5c89ad1 100644 --- a/batch_v2.py +++ b/batch_v2.py @@ -227,9 +227,20 @@ JSON with these fields (in Russian): }}, "units": "тыс.руб" }}, - "conversion": "делить на 1000 (руб → тыс.руб)" или "без конвертации" + "conversion": "делить на 1000 (руб → тыс.руб)" или "без конвертации", + "preview": [ + {{ + "source_file": "имя файла источника", + "source_values": {{"строительные работы": 15460805.77, "монтажные работы": 0}}, + "target_sheet": "ССРСС ТУЦ", + "target_row": "строка 17 (ЛС-01-02-2-00-01 Устройство насыпи)", + "target_values": {{"D": 15460.81, "E": 0, "F": 0, "G": 0}} + }} + ] }} ``` +The "preview" array must contain entries for ALL sample files — show the actual extracted values +and where they will go in the target. This is the most important part for the user to verify! ### File 2: /data/batch_script.py — Python script diff --git a/static/batch2.html b/static/batch2.html index f79646f..865219f 100644 --- a/static/batch2.html +++ b/static/batch2.html @@ -260,8 +260,30 @@ function renderSummary(s) { } if (tgt.units) html += row('Единицы', tgt.units); if (s.conversion) html += row('Конвертация', s.conversion); - html += ''; + + // Preview table: source → target mapping with actual values + if (s.preview && s.preview.length > 0) { + html += '
Превью маппинга (по сэмплам):
'; + html += ''; + html += '' + + '' + + '' + + '' + + ''; + for (const p of s.preview) { + const srcVals = p.source_values ? Object.entries(p.source_values).map(([k,v]) => k + ': ' + v).join('
') : '-'; + const tgtVals = p.target_values ? Object.entries(p.target_values).map(([k,v]) => k + '=' + v).join(', ') : '-'; + const tgtWhere = (p.target_sheet || '') + '
' + (p.target_row || ''); + html += '' + + '' + + '' + + '' + + ''; + } + html += '
Исходный файлИзвлечённые значения→ КудаЗаписываемые значения
' + (p.source_file || '') + '' + srcVals + '' + tgtWhere + '' + tgtVals + '
'; + } + el.innerHTML = html; function row(label, value) {