fix: BUG#280 会诊申请单打印逻辑修复(点击具体记录打印该条,不传参数时打印全部)

This commit is contained in:
2026-04-24 10:07:42 +08:00
parent 41fe89447f
commit 6b6e56c79b

View File

@@ -549,15 +549,16 @@ const handleCurrentChange = (val) => {
} }
const handlePrint = async (row) => { const handlePrint = async (row) => {
const printRows = tableData.value // 如果传入了具体行数据,则只打印该行;否则打印所有数据
const printRows = row ? [row] : tableData.value;
if (printRows.length === 0) { if (printRows.length === 0) {
ElMessage.warning('没有可打印的数据') ElMessage.warning('没有可打印的数据');
return return;
} }
const userStore = useUserStore() const userStore = useUserStore();
const hospitalName = userStore.tenantName || userStore.hospitalName || '' const hospitalName = userStore.tenantName || userStore.hospitalName || '';
try { try {
const printDataList = printRows.map(printRow => ({ const printDataList = printRows.map(printRow => ({
@@ -570,11 +571,11 @@ const handlePrint = async (row) => {
consultationReason: printRow.consultationPurpose || '', consultationReason: printRow.consultationPurpose || '',
applyTime: printRow.consultationRequestDate || '', applyTime: printRow.consultationRequestDate || '',
applyDoctor: printRow.requestingPhysician || '' applyDoctor: printRow.requestingPhysician || ''
})) }));
await simplePrint(PRINT_TEMPLATE.CONSULTATION, printDataList) await simplePrint(PRINT_TEMPLATE.CONSULTATION, printDataList);
} catch (error) { } catch (error) {
console.error('会诊申请单打印失败:', error) console.error('会诊申请单打印失败:', error);
ElMessage.error('打印失败') ElMessage.error('打印失败');
} }
} }