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:
+23
-1
@@ -260,8 +260,30 @@ function renderSummary(s) {
|
||||
}
|
||||
if (tgt.units) html += row('Единицы', tgt.units);
|
||||
if (s.conversion) html += row('Конвертация', s.conversion);
|
||||
|
||||
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;
|
||||
|
||||
function row(label, value) {
|
||||
|
||||
Reference in New Issue
Block a user