feat: превью маппинга — сметчик видит откуда/куда идут значения
Claude генерирует preview[] в batch_summary.json: - source_file + извлечённые значения (руб) - target_sheet + target_row (лист и строка назначения) - target_values (конвертированные тыс.руб по столбцам D-G) UI показывает таблицу маппинга перед запуском обработки. Протестировано на сервере — 2/2 файла с корректным превью. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+12
-1
@@ -227,9 +227,20 @@ JSON with these fields (in Russian):
|
|||||||
}},
|
}},
|
||||||
"units": "тыс.руб"
|
"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
|
### File 2: /data/batch_script.py — Python script
|
||||||
|
|
||||||
|
|||||||
+23
-1
@@ -260,8 +260,30 @@ function renderSummary(s) {
|
|||||||
}
|
}
|
||||||
if (tgt.units) html += row('Единицы', tgt.units);
|
if (tgt.units) html += row('Единицы', tgt.units);
|
||||||
if (s.conversion) html += row('Конвертация', s.conversion);
|
if (s.conversion) html += row('Конвертация', s.conversion);
|
||||||
|
|
||||||
html += '</table>';
|
html += '</table>';
|
||||||
|
|
||||||
|
// Preview table: source → target mapping with actual values
|
||||||
|
if (s.preview && s.preview.length > 0) {
|
||||||
|
html += '<div style="margin-top:.8rem"><b>Превью маппинга (по сэмплам):</b></div>';
|
||||||
|
html += '<table style="width:100%;border-collapse:collapse;margin:.3rem 0;font-size:.8rem">';
|
||||||
|
html += '<tr style="background:#ede5db">' +
|
||||||
|
'<td style="padding:5px">Исходный файл</td>' +
|
||||||
|
'<td style="padding:5px">Извлечённые значения</td>' +
|
||||||
|
'<td style="padding:5px">→ Куда</td>' +
|
||||||
|
'<td style="padding:5px">Записываемые значения</td></tr>';
|
||||||
|
for (const p of s.preview) {
|
||||||
|
const srcVals = p.source_values ? Object.entries(p.source_values).map(([k,v]) => k + ': ' + v).join('<br>') : '-';
|
||||||
|
const tgtVals = p.target_values ? Object.entries(p.target_values).map(([k,v]) => k + '=' + v).join(', ') : '-';
|
||||||
|
const tgtWhere = (p.target_sheet || '') + '<br>' + (p.target_row || '');
|
||||||
|
html += '<tr>' +
|
||||||
|
'<td style="padding:4px 5px;border-bottom:1px solid #eee;word-break:break-all">' + (p.source_file || '') + '</td>' +
|
||||||
|
'<td style="padding:4px 5px;border-bottom:1px solid #eee;font-size:.75rem">' + srcVals + '</td>' +
|
||||||
|
'<td style="padding:4px 5px;border-bottom:1px solid #eee;font-size:.75rem">' + tgtWhere + '</td>' +
|
||||||
|
'<td style="padding:4px 5px;border-bottom:1px solid #eee"><code>' + tgtVals + '</code></td></tr>';
|
||||||
|
}
|
||||||
|
html += '</table>';
|
||||||
|
}
|
||||||
|
|
||||||
el.innerHTML = html;
|
el.innerHTML = html;
|
||||||
|
|
||||||
function row(label, value) {
|
function row(label, value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user