bug280 会诊管理-》门诊会诊申请管理-》【打印】不是打印某一条会诊记录的申请单 打印表格数据
This commit is contained in:
@@ -377,7 +377,6 @@ import { Search, Refresh, Printer, Edit, View, Delete } from '@element-plus/icon
|
||||
import { queryConsultationListPage, cancelConsultation, saveConsultation, getConsultationOpinions } from './api'
|
||||
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
|
||||
import { formatDate } from '@/utils/index.js'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
@@ -549,33 +548,33 @@ const handleCurrentChange = (val) => {
|
||||
}
|
||||
|
||||
const handlePrint = async (row) => {
|
||||
// 如果传入了具体行数据,则只打印该行;否则打印所有数据
|
||||
const printRows = row ? [row] : tableData.value;
|
||||
|
||||
const printRows = row && row.consultationId ? [row] : tableData.value
|
||||
if (printRows.length === 0) {
|
||||
ElMessage.warning('没有可打印的数据');
|
||||
return;
|
||||
ElMessage.warning('没有可打印的数据')
|
||||
return
|
||||
}
|
||||
|
||||
const userStore = useUserStore();
|
||||
const hospitalName = userStore.tenantName || userStore.hospitalName || '';
|
||||
|
||||
try {
|
||||
const printDataList = printRows.map(printRow => ({
|
||||
hospitalName,
|
||||
const consultationRows = printRows.map(printRow => ({
|
||||
consultationId: printRow.consultationId || '',
|
||||
urgent: printRow.consultationUrgency === '2' ? '√' : '',
|
||||
patientName: printRow.patientName || '',
|
||||
gender: printRow.genderEnum === 1 ? '男' : '女',
|
||||
age: printRow.age || '',
|
||||
deptName: printRow.department || '',
|
||||
diagnosis: printRow.provisionalDiagnosis || '',
|
||||
consultationReason: printRow.consultationPurpose || '',
|
||||
applyTime: printRow.consultationRequestDate || '',
|
||||
applyDoctor: printRow.requestingPhysician || ''
|
||||
}));
|
||||
await simplePrint(PRINT_TEMPLATE.CONSULTATION, printDataList);
|
||||
consultationDate: formatDate(printRow.consultationDate),
|
||||
department: printRow.department || '',
|
||||
invitedObject: printRow.invitedObject || '',
|
||||
consultationRequestDate: formatDate(printRow.consultationRequestDate),
|
||||
requestingPhysician: printRow.requestingPhysician || '',
|
||||
submitted: printRow.consultationStatus >= STATUS.SUBMITTED ? '√' : '',
|
||||
ended: printRow.consultationStatus === STATUS.ENDED ? '√' : ''
|
||||
}))
|
||||
await simplePrint(PRINT_TEMPLATE.CONSULTATION, { consultationRows }, undefined, {
|
||||
title: '会诊申请列表',
|
||||
width: 297,
|
||||
height: 210
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('会诊申请单打印失败:', error);
|
||||
ElMessage.error('打印失败');
|
||||
console.error('会诊申请单打印失败:', error)
|
||||
ElMessage.error('打印失败')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -840,4 +839,3 @@ onMounted(() => {
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user