Refine import wizard: simplify permit details, add image zoom, and enhance risk metadata display (legal basis, document no, summary)
This commit is contained in:
parent
e7da819fea
commit
347af34bfc
2
app.py
2
app.py
|
|
@ -84,4 +84,4 @@ def create_app() -> Flask:
|
|||
if __name__ == "__main__":
|
||||
port = int(os.getenv("PORT", "8000"))
|
||||
app = create_app()
|
||||
app.run(host="0.0.0.0", port=port)
|
||||
app.run(host="0.0.0.0", port=port, debug=True)
|
||||
|
|
|
|||
|
|
@ -346,6 +346,9 @@ def _score_import_header(canonical: str, cell_text: str, col_idx: int) -> float:
|
|||
elif canonical == "summary":
|
||||
if "摘要" in text:
|
||||
score += 3
|
||||
elif canonical == "document_no":
|
||||
if "文号" in text:
|
||||
score += 5
|
||||
elif canonical == "remark":
|
||||
if "备注" in text:
|
||||
score += 3
|
||||
|
|
@ -1795,6 +1798,7 @@ def describe_permit_import_session(session_id: str) -> Dict[str, Any]:
|
|||
"serial_number": row.get("serial_number"),
|
||||
"risk_content": row.get("risk_content"),
|
||||
"legal_basis": row.get("legal_basis"),
|
||||
"document_no": row.get("document_no"),
|
||||
"summary": row.get("summary"),
|
||||
"remark": row.get("remark"),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -4639,7 +4639,7 @@
|
|||
html += `<button class="btn btn-warning btn-sm" onclick="submitImport()" ${commitDisabled ? 'disabled' : ''}>${commitLabel}</button>`;
|
||||
html += '</div></div>';
|
||||
|
||||
html += `<div class="import-preview-summary"><span>文件:${escapeHtml(state.filename || '(未命名)')}</span><span>已选区划:${selectedCount}</span><span>风险条目:${state.totalRows || 0}</span></div>`;
|
||||
html += `<div class="import-preview-summary"><span>文件:${escapeHtml(state.filename || '(未命名)')}</span><span>风险条目:${state.totalRows || 0}</span></div>`;
|
||||
|
||||
if (state.error) {
|
||||
html += `<div class="import-error">${escapeHtml(state.error)}</div>`;
|
||||
|
|
@ -4662,7 +4662,6 @@
|
|||
const safeSheet = sheetName.replace(/'/g, "\\'");
|
||||
html += `<button class="preview-tab ${isActive ? 'active' : ''}" onclick="setActivePreviewSheet('${safeSheet}')">`;
|
||||
html += `<span>${escapeHtml(sheetLabel)}</span>`;
|
||||
html += `<span class="preview-tab-badge">${summary.permit_count || 0} 项</span>`;
|
||||
html += '</button>';
|
||||
});
|
||||
html += '</div>';
|
||||
|
|
@ -4728,11 +4727,7 @@
|
|||
const themeOptions = filterThemeOptionsForPreview(sheet);
|
||||
const totalThemes = Array.isArray(sheet.theme_options) ? sheet.theme_options.length : 0;
|
||||
|
||||
let html = '<div class="import-preview-summary">';
|
||||
html += `<span>区划:${escapeHtml(regionLabel)}</span>`;
|
||||
html += `<span>许可事项:${filteredPermits.length}/${totalPermits}</span>`;
|
||||
html += `<span>主题候选:${themeOptions.length}/${totalThemes}</span>`;
|
||||
html += '</div>';
|
||||
let html = ''; // Removed summary line as per request
|
||||
|
||||
if (sheet.missing_region) {
|
||||
html += '<div class="import-error">检测到新地区,导入后会自动创建该区划,请确认名称是否正确。</div>';
|
||||
|
|
@ -4767,10 +4762,7 @@
|
|||
|
||||
// Detailed Metadata
|
||||
html += '<div class="preview-permit-details-grid">';
|
||||
if (meta.unit_name) html += `<div class="detail-item"><span>单位:</span>${escapeHtml(meta.unit_name)}</div>`;
|
||||
if (meta.responsible_contact) html += `<div class="detail-item"><span>联系人:</span>${escapeHtml(meta.responsible_contact)}</div>`;
|
||||
if (meta.permit_status) html += `<div class="detail-item"><span>许可情况:</span>${escapeHtml(meta.permit_status)}</div>`;
|
||||
if (meta.jurisdiction_scope) html += `<div class="detail-item" style="grid-column: span 2;"><span>管辖范围:</span>${escapeHtml(meta.jurisdiction_scope)}</div>`;
|
||||
html += '</div>';
|
||||
|
||||
html += `<div class="muted-text" style="margin-top:8px;">共 ${permit.risk_count || 0} 条风险提示</div>`;
|
||||
|
|
@ -4785,7 +4777,11 @@
|
|||
<div class="risk-serial">${escapeHtml(r.serial_number || (idx + 1))}</div>
|
||||
<div class="risk-body">
|
||||
<div class="risk-text">${escapeHtml(r.risk_content)}</div>
|
||||
${r.legal_basis ? `<div class="risk-basis">依据:${escapeHtml(r.legal_basis)}</div>` : ''}
|
||||
<div class="risk-meta-grid" style="display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; font-size: 12px; color: #64748b;">
|
||||
${r.legal_basis ? `<div><strong style="color: #475569;">法律依据:</strong>${escapeHtml(r.legal_basis)}</div>` : ''}
|
||||
${r.document_no ? `<div><strong style="color: #475569;">依据文号:</strong>${escapeHtml(r.document_no)}</div>` : ''}
|
||||
${r.summary ? `<div style="width: 100%;"><strong style="color: #475569;">摘要:</strong>${escapeHtml(r.summary)}</div>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
|
|
|||
Loading…
Reference in New Issue