Ignore PDF prefix truncation AI issues

This commit is contained in:
Codex
2026-05-27 16:06:10 +08:00
parent e0574d16a3
commit 54ea338bd6
4 changed files with 101 additions and 185 deletions

View File

@@ -190,10 +190,6 @@ function userPermissions() {
return state.currentUser?.permissions || {};
}
function isAdminUser() {
return state.currentUser?.source === "env" || state.currentUser?.username === "admin";
}
function canOpenPage(page) {
const key = page === "auditHistory" ? "audit_history" : page;
return userPermissions()[key] !== false;
@@ -402,9 +398,6 @@ function renderRecords() {
const active = record.id === state.selectedId ? " is-active" : "";
const manual = record.manual_corrected ? " · 人工已改" : "";
const activity = record.last_activity_at ? `<span class="record-time">最近 ${escapeHtml(formatTime(record.last_activity_at))}</span>` : "";
const exportButton = isAdminUser() && record.has_pdf
? `<button class="record-download" type="button" data-export-record="${record.id}" title="下载影像/PDF">下载</button>`
: "";
return `
<div class="record-item${active}" role="button" tabindex="0" data-id="${record.id}">
<div class="record-main">
@@ -414,17 +407,13 @@ function renderRecords() {
<div class="record-sub">
${escapeHtml(record.inpatient_no || record.medical_record_no || "")} · ${escapeHtml(record.major_department || record.discharge_dept || "")}${manual}<br>
${escapeHtml(record.primary_diagnosis || "")}
<div class="record-footer">
<span>${activity}</span>
${exportButton}
</div>
${activity}
</div>
</div>
`;
}).join("") + loadingNotice + endNotice;
list.querySelectorAll(".record-item").forEach((item) => {
item.addEventListener("click", (event) => {
if (event.target.closest("[data-export-record]")) return;
item.addEventListener("click", () => {
selectRecord(Number(item.dataset.id));
});
item.addEventListener("keydown", (event) => {
@@ -433,18 +422,11 @@ function renderRecords() {
selectRecord(Number(item.dataset.id));
});
});
list.querySelectorAll("[data-export-record]").forEach((button) => {
button.addEventListener("click", (event) => {
event.stopPropagation();
exportRecordPdf(Number(button.dataset.exportRecord));
});
});
list.scrollTop = previousScrollTop;
}
function renderFilterActions() {
const button = $("approveAiNoIssueBtn");
const exportButton = $("batchExportBtn");
if (!button) return;
const filter = $("statusFilter")?.value || "review_all";
const aiPassedCount = Number(state.status?.ai_passed || 0);
@@ -452,33 +434,6 @@ function renderFilterActions() {
button.classList.toggle("is-hidden", !shouldShow);
button.disabled = !shouldShow || aiPassedCount <= 0 || Boolean(state.bulkJob?.running);
button.textContent = aiPassedCount > 0 ? `通过所有AI已通过${aiPassedCount}` : "通过所有AI已通过";
if (exportButton) {
exportButton.classList.toggle("is-hidden", !isAdminUser());
exportButton.disabled = !isAdminUser() || state.recordsLoading;
}
}
function downloadUrl(url) {
const link = document.createElement("a");
link.href = url;
link.rel = "noopener";
document.body.appendChild(link);
link.click();
link.remove();
}
function exportRecordPdf(recordId) {
if (!isAdminUser() || !recordId) return;
downloadUrl(`/api/records/${recordId}/export`);
}
function exportCurrentFilter() {
if (!isAdminUser()) return;
const params = new URLSearchParams({
q: $("searchInput").value.trim(),
status_filter: $("statusFilter").value || "review_all",
});
downloadUrl(`/api/records/export?${params.toString()}`);
}
function scrollSelectedRecordIntoView() {
@@ -711,7 +666,7 @@ function renderTargetSummary(targets, targetId = "targetSummary", formId = "deta
<ul>${baseNotesHtml}</ul>
</details>
${targets.hasAiNotes ? `
<details class="collapsible-panel target-panel is-ai-target">
<details class="collapsible-panel target-panel is-ai-target" open>
<summary>
<strong>AI建议复核点</strong>
<span>${aiGroups.length ? `${aiGroups.length} 个模块` : "无待看点"}</span>
@@ -1894,7 +1849,6 @@ async function boot() {
$("aiAllBtn").addEventListener("click", () => runAiReview("all"));
$("aiCancelBtn").addEventListener("click", () => handleAiProgressAction().catch((error) => showMessage(error.message, "error")));
$("approveAiNoIssueBtn").addEventListener("click", approveAiNoIssueRecords);
$("batchExportBtn").addEventListener("click", exportCurrentFilter);
$("pdfZoomOutBtn").addEventListener("click", () => changePdfZoom(-PDF_ZOOM_STEP));
$("pdfZoomInBtn").addEventListener("click", () => changePdfZoom(PDF_ZOOM_STEP));
$("pdfZoomResetBtn").addEventListener("click", () => setPdfZoom(100));

View File

@@ -98,7 +98,6 @@
<button id="aiCancelBtn" type="button">中止AI</button>
</div>
<button id="approveAiNoIssueBtn" class="bulk-action is-hidden" type="button">通过所有AI已通过</button>
<button id="batchExportBtn" class="bulk-action export-action is-hidden" type="button">批量导出当前筛选</button>
</div>
<div class="record-list" id="recordList" tabindex="0"></div>
</aside>

View File

@@ -362,12 +362,6 @@ h2 {
min-height: 34px;
}
.export-action {
border-color: #b6c3d0;
background: #f7fafc;
color: var(--accent-dark);
}
input,
select,
textarea {
@@ -478,32 +472,8 @@ textarea {
.record-time {
display: block;
color: #7b8794;
}
.record-footer {
min-height: 26px;
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 8px;
margin-top: 2px;
}
.record-download {
flex: 0 0 auto;
min-height: 24px;
padding: 2px 8px;
border: 1px solid #b6c3d0;
border-radius: 5px;
background: #fff;
color: var(--accent);
font-size: 12px;
}
.record-download:hover {
border-color: var(--accent);
background: #eef6fb;
color: #7b8794;
}
.pdf-panel {