Fix Bug #540: 检查申请打印功能"申请单描述"区域与详情弹窗显示不一致 — 根因:handlePrint函数仍使用固定orderedDescFieldKeys遍历+空值过滤,与已修复的详情弹窗不一致;修复:改为遍历descData所有key并通过labelMap过滤,空值显示为'-',同时移除已废弃的orderedDescFieldKeys常量

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 14:18:47 +08:00
parent 680db771cd
commit e247aac319

View File

@@ -511,13 +511,6 @@ const hasMatchedFields = computed(() => {
return Object.keys(descJsonData.value).some((key) => isFieldMatched(key));
});
// Ordered field keys for detail display and print, matching the bug requirement order
const orderedDescFieldKeys = [
'targetDepartment', 'urgencyLevel', 'allergyHistory', 'examinationPurpose',
'expectedExaminationTime', 'medicalHistorySummary', 'symptom', 'sign',
'clinicalDiagnosis', 'otherDiagnosis', 'relatedResult', 'attention',
];
/** 查询科室 */
const getLocationInfo = async () => {
try {
@@ -685,20 +678,18 @@ const handlePrint = async (row) => {
});
}
// 构建 descJson 字段行(与详情弹窗展示的字段一致)
const fieldKeys = orderedDescFieldKeys;
// 构建 descJson 字段行(与详情弹窗展示的字段一致遍历所有key并通过isFieldMatched过滤
let descFieldsHtml = '';
fieldKeys.forEach((key) => {
for (const key in descData) {
if (!(key in labelMap)) continue;
const label = labelMap[key] || key;
const value = transformField(key, descData[key]);
if (descData[key] != null && descData[key] !== '' && value != null && value !== '') {
descFieldsHtml += `
descFieldsHtml += `
<div class="info-row">
<span class="label">${label}</span>
<span class="value">${value}</span>
<span class="value">${value || '-'}</span>
</div>`;
}
});
}
// 构建完整打印HTML
const printContent = `