diff --git a/src/api/ecgworkstation/index.ts b/src/api/ecgworkstation/index.ts index fa2d80c..1652f87 100644 --- a/src/api/ecgworkstation/index.ts +++ b/src/api/ecgworkstation/index.ts @@ -89,6 +89,13 @@ export const EcgworkstationApi = { url: `${import.meta.env.VITE_FILE_DOWNLOAD_URL}${filename}`, responseType: 'blob' }) + }, + + // 申请上级审核 + applySuperiorReview: async (id: number, orgid: string) => { + return await request.get({ + url: `/system/ecgworkstation/apply-superior-review?id=${id}&orgid=${orgid}` + }) } } diff --git a/src/views/analysis/ECG_workstation.vue b/src/views/analysis/ECG_workstation.vue index 0d6795e..47861e3 100644 --- a/src/views/analysis/ECG_workstation.vue +++ b/src/views/analysis/ECG_workstation.vue @@ -240,15 +240,16 @@ 已申请 + - + @@ -532,25 +533,25 @@ - + - - - + + + ElMessage.error('报告加载失败')" + class="new-medical-image" + @error="() => ElMessage.error('新报告加载失败')" :preview-teleported="true" > @@ -562,15 +563,15 @@ - + @@ -618,11 +619,11 @@ const selectedFolderPath = ref('') const currentFolderPath = ref('') const folderNavigationHistory = ref([]) -// 报告查看相关 -const reportViewVisible = ref(false) -const reportImageUrl = ref('') -const currentReportRow = ref(null) -const reportLoading = ref(false) +// 新报告查看相关 +const newReportViewVisible = ref(false) +const newReportImageUrl = ref('') +const currentNewReportRow = ref(null) +const newReportLoading = ref(false) // 文件夹过滤 const filteredFolderList = computed(() => { @@ -1303,8 +1304,7 @@ const confirmFileSelect = async (file?: any) => { // 更新心电图的文件名称 console.log(currentRow.value) await EcgworkstationApi.updateFilename({ - orgid: currentRow.value.orgid, - examid: currentRow.value.examid, + ...currentRow.value, filename: result.targetFile }) @@ -1462,9 +1462,12 @@ const handleApply = async (row) => { } } -/** 查看报告 */ -const handleViewReport = async (row) => { +/** 查看新报告 */ +const handleNewReport = async (row) => { try { + newReportLoading.value = true + currentNewReportRow.value = row + // 调用接口查询报告 const result = await EcgworkstationApi.getPdfUrl({ orgid: row.orgid, @@ -1482,276 +1485,120 @@ const handleViewReport = async (row) => { } if (pdfUrl) { - // 直接打开新窗口显示报告 - openReportWindow(pdfUrl, row) + // 设置图片URL并显示弹窗 + newReportImageUrl.value = pdfUrl + newReportViewVisible.value = true } else { console.warn('API返回数据异常:', { result, resultType: typeof result, hasData: !!result?.data }) - ElMessage.warning('报告未生成或查询失败') + ElMessage.warning('新报告未生成或查询失败') } } catch (error) { - console.error('查询报告失败:', error) - console.error('错误详情:', { - message: error?.message, - response: error?.response, - status: error?.response?.status - }) - ElMessage.error('查询报告失败,请重试') + console.error('查询新报告失败:', error) + ElMessage.error('查询新报告失败,请重试') + } finally { + newReportLoading.value = false } } -/** 打开报告窗口 */ -const openReportWindow = (imageUrl, patientInfo) => { - const reportWindow = window.open( - '', - '_blank', - 'width=1000,height=700,scrollbars=yes,resizable=yes' - ) - if (!reportWindow) { - ElMessage.error('无法打开报告窗口,请检查浏览器设置') - return - } - - const reportContent = ` - - - - 心电图报告 - - - - - - - 🖨️ 打印 - - - - - - 正在加载心电图... - 图片加载失败,请重试 - - - - - - ` - - reportWindow.document.write(reportContent) - reportWindow.document.close() - reportWindow.focus() +/** 关闭新报告查看弹窗 */ +const closeNewReportView = () => { + newReportViewVisible.value = false + newReportImageUrl.value = '' + currentNewReportRow.value = null } -/** 打印报告 */ -const handlePrintReport = () => { - if (!reportImageUrl.value) { - ElMessage.warning('没有可打印的报告') +/** 打印新报告 */ +const handlePrintNewReport = () => { + if (!newReportImageUrl.value) { + ElMessage.warning('没有可打印的新报告') return } - // 创建新窗口用于打印 - const printWindow = window.open('', '_blank') - if (!printWindow) { - ElMessage.error('无法打开打印窗口,请检查浏览器设置') - return - } - - // 创建打印页面内容 + // 直接调用浏览器打印功能 const printContent = ` - 心电图报告打印 + 新报告打印 - - - + ` - // 写入内容到新窗口 - printWindow.document.write(printContent) - printWindow.document.close() -} + // 创建临时iframe进行打印 + const iframe = document.createElement('iframe') + iframe.style.display = 'none' + document.body.appendChild(iframe) -/** 关闭报告查看弹窗 */ -const closeReportView = () => { - reportViewVisible.value = false - reportImageUrl.value = '' - currentReportRow.value = null + iframe.contentDocument?.write(printContent) + iframe.contentDocument?.close() + + // 等待图片加载完成后打印 + const img = iframe.contentDocument?.querySelector('img') as HTMLImageElement + if (img) { + img.onload = () => { + setTimeout(() => { + iframe.contentWindow?.print() + // 打印完成后移除iframe + setTimeout(() => { + document.body.removeChild(iframe) + }, 1000) + }, 500) + } + img.onerror = () => { + ElMessage.error('图片加载失败,无法打印') + document.body.removeChild(iframe) + } + } } /** 下载 */ @@ -2161,7 +2008,8 @@ onMounted(async () => { .collect-btn, .upload-btn, .download-btn, - .apply-btn { + .apply-btn, + .new-report-btn { border-radius: 12px; padding: 2px 8px; font-weight: 500; @@ -2195,6 +2043,10 @@ onMounted(async () => { background: linear-gradient(135deg, #ff9a56, #ff6b6b); } + .new-report-btn { + background: linear-gradient(135deg, #8b5cf6, #a855f7); + } + .status-tag { border-radius: 4px; padding: 1px 6px; @@ -2972,58 +2824,26 @@ onMounted(async () => { } } -// 报告查看弹窗样式 -.report-view-container { - .report-header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 16px; - background: #f8f9fa; - border-radius: 8px; - margin-bottom: 16px; - - .patient-info { - display: flex; - flex-wrap: wrap; - gap: 16px; - - .info-item { - font-size: 14px; - color: #606266; - font-weight: 500; - - &:first-child { - color: #409eff; - font-weight: 600; - } - } - } - - .report-actions { - display: flex; - gap: 8px; - } - } - - .report-content { - min-height: 400px; +// 新报告查看弹窗样式 +.new-report-view-container { + .new-report-content { + min-height: 500px; display: flex; justify-content: center; align-items: center; - .report-image-container { + .new-report-image-container { width: 100%; text-align: center; display: flex; justify-content: center; align-items: center; - .medical-image { - width: 90%; - height: 70vh; - min-height: 500px; - max-height: 800px; + .new-medical-image { + width: 95%; + height: 75vh; + min-height: 600px; + max-height: 900px; border: 1px solid #e4e7ed; border-radius: 8px; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); @@ -3065,16 +2885,15 @@ onMounted(async () => { // 响应式设计 @media (max-width: 768px) { - .report-view-container { - .report-header { - flex-direction: column; - gap: 12px; + .new-report-view-container { + .new-report-content { + min-height: 400px; - .patient-info { - justify-content: center; - - .info-item { - font-size: 12px; + .new-report-image-container { + .new-medical-image { + width: 100%; + height: 60vh; + min-height: 400px; } } }