v1.0.41: детали в модалке + ошибки парсера в статусе

This commit is contained in:
2026-06-19 07:18:41 +04:00
parent 75ebfb02fe
commit 70e1ce8b98
2 changed files with 27 additions and 5 deletions
+15 -4
View File
@@ -61,7 +61,7 @@
<body>
<div class="topbar">
<img src="/nubes-logo.svg" alt="Nubes">
<span class="title">Сверка договоров — LLM <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.40 — Lucee</span></span>
<span class="title">Сверка договоров — LLM <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.41 — Lucee</span></span>
</div>
<div class="content">
@@ -266,10 +266,11 @@ parseBtn.addEventListener('click', async function() {
var d = await resp.json();
if (d.OK && d.STATUS === 'parsed') {
f.parsed = true;
f.parseInfo = d;
f.status = '<span class="status-ok">✓ ' + d.ELEMENT_COUNT + ' эл.</span>';
f.element_count = d.ELEMENT_COUNT;
} else {
f.status = '<span class="status-err">✗ ' + (d.ERROR_COUNT > 0 ? 'ошибка' : '') + '</span>';
f.status = '<span class="status-err">✗ ' + (d.ERROR_COUNT > 0 ? (d.ERRORS && d.ERRORS[0] || 'ошибка') : 'ошибка') + '</span>';
f.parseInfo = d;
}
} catch(e) {
f.status = '<span class="status-err">✗ сеть</span>';
@@ -391,8 +392,18 @@ function showInfo(i) {
document.getElementById('modalTitle').textContent = f.name;
var html = '<div class="kv"><span class="k">Размер</span><span class="v">' + formatSize(f.size) + '</span></div>';
html += '<div class="kv"><span class="k">Изменён</span><span class="v">' + formatDate(f.lastModified) + '</span></div>';
if (f.parseInfo) {
var d = f.parseInfo;
html += '<div class="kv"><span class="k">Элементов</span><span class="v">' + (d.ELEMENT_COUNT||0) + '</span></div>';
html += '<div class="kv"><span class="k">Параграфов</span><span class="v">' + (d.PARAGRAPHS||0) + '</span></div>';
html += '<div class="kv"><span class="k">Таблиц</span><span class="v">' + (d.TABLES||0) + '</span></div>';
html += '<div class="kv"><span class="k">Строк таблиц</span><span class="v">' + (d.TABLE_ROWS||0) + '</span></div>';
if (d.ERRORS && d.ERRORS.length > 0) {
html += '<div style="margin-top:8px;color:var(--destructive);font-weight:600;">Ошибки:</div>';
html += '<pre>' + d.ERRORS.join('\n') + '</pre>';
}
}
html += '<div class="kv"><span class="k">doc_id</span><span class="v">' + (f.doc_id || '—') + '</span></div>';
if (f.element_count) html += '<div class="kv"><span class="k">Элементов</span><span class="v">' + f.element_count + '</span></div>';
document.getElementById('modalBody').innerHTML = html;
document.getElementById('modalOverlay').classList.add('open');
}
+12 -1
View File
@@ -280,10 +280,21 @@
error_message = <cfqueryparam value="#arrayLen(errors) ? serializeJSON(errors) : ''#" cfsqltype="cf_sql_varchar">
WHERE id = <cfqueryparam value="#url.doc_id#" cfsqltype="cf_sql_varchar">
</cfquery>
<!--- Статистика --->
<cfset paraCount = 0>
<cfset tblCount = 0>
<cfset tblRows = 0>
<cfloop array="#elements#" index="el">
<cfif el.type EQ "paragraph"><cfset paraCount++>
<cfelseif el.type EQ "table"><cfset tblCount++><cfset tblRows += arrayLen(el.rows)>
</cfif>
</cfloop>
<cfset result = {ok: true, doc_id: url.doc_id, filename: doc.filename,
mime_type: doc.mime_type, status: newStatus,
element_count: arrayLen(elements), error_count: arrayLen(errors),
files: files}>
paragraphs: paraCount, tables: tblCount, table_rows: tblRows,
errors: errors, files: files}>
</cfif>
</cfif>
<cfcatch>