打印
This commit is contained in:
parent
4ab72870e7
commit
27a821e585
@ -104,7 +104,7 @@
|
|||||||
<el-table-column
|
<el-table-column
|
||||||
prop="examid"
|
prop="examid"
|
||||||
label="检查ID"
|
label="检查ID"
|
||||||
min-width="120"
|
min-width="200"
|
||||||
align="center"
|
align="center"
|
||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
>
|
>
|
||||||
@ -116,7 +116,7 @@
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="name" label="姓名" min-width="70" align="center" />
|
<el-table-column prop="name" label="姓名" min-width="200" align="center" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="gender"
|
prop="gender"
|
||||||
label="性别"
|
label="性别"
|
||||||
@ -137,59 +137,6 @@
|
|||||||
>
|
>
|
||||||
<template #default="{ row }"> {{ row.age }}岁 </template>
|
<template #default="{ row }"> {{ row.age }}岁 </template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="wearstarttime" label="佩戴时间" align="center" min-width="300">
|
|
||||||
<template #default="{ row, $index }">
|
|
||||||
<!-- 编辑状态 -->
|
|
||||||
<div v-if="row.editingMeasureTime" class="wear-time-editor">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="row.wearstarttime"
|
|
||||||
type="datetime"
|
|
||||||
placeholder="选择时间"
|
|
||||||
size="small"
|
|
||||||
style="width: 140px"
|
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
|
||||||
:popper-class="'no-tooltip'"
|
|
||||||
/>
|
|
||||||
<div class="edit-actions">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
size="small"
|
|
||||||
circle
|
|
||||||
@click="saveMeasureTime(row, $index)"
|
|
||||||
class="confirm-btn"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:check" />
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
size="small"
|
|
||||||
circle
|
|
||||||
@click="cancelEditMeasureTime(row, $index)"
|
|
||||||
class="cancel-btn"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:close" />
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 显示状态 -->
|
|
||||||
<div v-else class="wear-time-display">
|
|
||||||
<div class="time-content">
|
|
||||||
<span class="time-text">{{ formatMeasureTime(row.wearstarttime) }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="edit-button-wrapper">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
size="small"
|
|
||||||
circle
|
|
||||||
@click="editMeasureTime(row, $index)"
|
|
||||||
class="edit-btn"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:edit" />
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="采集" min-width="80" align="center" show-overflow-tooltip>
|
<el-table-column label="采集" min-width="80" align="center" show-overflow-tooltip>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
@ -215,7 +162,7 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="导入数据" min-width="110" align="center" show-overflow-tooltip>
|
<el-table-column label="导入数据" min-width="80" align="center" show-overflow-tooltip>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -227,7 +174,7 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="上传" min-width="110" align="center" show-overflow-tooltip>
|
<el-table-column label="上传" min-width="80" align="center" show-overflow-tooltip>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="!row.uploading"
|
v-if="!row.uploading"
|
||||||
@ -623,7 +570,7 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="closeReportView">关闭</el-button>
|
<el-button @click="closeReportView">关闭</el-button>
|
||||||
<el-button type="primary" @click="handlePrintReport" :icon="Download">打印图片</el-button>
|
<el-button type="primary" @click="handlePrintReport" :icon="Download">打印</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -671,6 +618,12 @@ const selectedFolderPath = ref('')
|
|||||||
const currentFolderPath = ref('')
|
const currentFolderPath = ref('')
|
||||||
const folderNavigationHistory = ref<string[]>([])
|
const folderNavigationHistory = ref<string[]>([])
|
||||||
|
|
||||||
|
// 报告查看相关
|
||||||
|
const reportViewVisible = ref(false)
|
||||||
|
const reportImageUrl = ref('')
|
||||||
|
const currentReportRow = ref<EcgworkstationVO | null>(null)
|
||||||
|
const reportLoading = ref(false)
|
||||||
|
|
||||||
// 文件夹过滤
|
// 文件夹过滤
|
||||||
const filteredFolderList = computed(() => {
|
const filteredFolderList = computed(() => {
|
||||||
if (!folderSearchKeyword.value) return folderList.value
|
if (!folderSearchKeyword.value) return folderList.value
|
||||||
@ -1118,9 +1071,46 @@ const handleAnalysis = async (row) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 采集(占位,后续由你提供实现) */
|
/** 采集 */
|
||||||
const handleCollect = (row: EcgworkstationVO) => {
|
const handleCollect = async (row: EcgworkstationVO) => {
|
||||||
ElMessage.info('采集功能待实现')
|
try {
|
||||||
|
// 构建请求参数
|
||||||
|
const params = {
|
||||||
|
examId: row.examid,
|
||||||
|
patientName: row.name,
|
||||||
|
sex: row.gender === '1' ? '男' : row.gender === '2' ? '女' : '未知',
|
||||||
|
age: row.age?.toString() || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用采集接口
|
||||||
|
const response = await fetch('http://localhost:48082/api/analyzecj-json', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await response.json()
|
||||||
|
|
||||||
|
// 处理返回结果
|
||||||
|
if (result.message === '采集程序已启动') {
|
||||||
|
ElMessage.success('采集程序已启动,正在进行数据采集...')
|
||||||
|
} else if (result.message === '采集设备未连接') {
|
||||||
|
ElMessage.warning('采集设备未连接,请检查设备连接状态')
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
// 其他情况,显示返回的消息
|
||||||
|
ElMessage.success(result.message || '采集请求已发送')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('启动采集程序失败:', error)
|
||||||
|
ElMessage.error('启动采集程序失败,请检查程序是否正确安装')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文件浏览器相关方法
|
// 文件浏览器相关方法
|
||||||
@ -1453,13 +1443,36 @@ const handleUpload = async (row: any) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 申请上级审核handleApply = async (row) => {
|
/** 申请上级审核 */
|
||||||
|
const handleApply = async (row) => {
|
||||||
try {
|
try {
|
||||||
const userinfo = await getUserProfile()
|
const userinfo = await getUserProfile()
|
||||||
orfOrg(userinf).gid)
|
const orginfo = await OrgApi.getOrg(userinfo.orgid)
|
||||||
if ErM= nul k (
|
if (orginfo.parentOrgId != null) {
|
||||||
} else ow
|
await EcgworkstationApi.applySuperiorReview(row.id, orginfo.parentOrgId)
|
||||||
|
ElMessage.success(`${row.name} 申请成功`)
|
||||||
|
getList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error('无上级机构')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('申请失败:', error)
|
||||||
|
ElMessage.error('申请失败,请重试')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查看报告 */
|
||||||
|
const handleViewReport = async (row) => {
|
||||||
|
try {
|
||||||
|
// 显示加载提示
|
||||||
|
const loading = ElLoading.service({
|
||||||
|
lock: true,
|
||||||
|
text: '正在加载报告...',
|
||||||
|
background: 'rgba(0, 0, 0, 0.8)'
|
||||||
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
// 调用接口查询报告
|
// 调用接口查询报告
|
||||||
const result = await EcgworkstationApi.getPdfUrl({
|
const result = await EcgworkstationApi.getPdfUrl({
|
||||||
orgid: row.orgid,
|
orgid: row.orgid,
|
||||||
@ -1478,9 +1491,8 @@ const handleUpload = async (row: any) => {
|
|||||||
|
|
||||||
if (pdfUrl) {
|
if (pdfUrl) {
|
||||||
console.log('处理后的PDF URL:', pdfUrl)
|
console.log('处理后的PDF URL:', pdfUrl)
|
||||||
reportImageUrl.value = pdfUrl
|
// 直接打开新窗口显示报告
|
||||||
reportViewVisible.value = true
|
openReportWindow(pdfUrl, row)
|
||||||
ElMessage.success('报告加载成功')
|
|
||||||
} else {
|
} else {
|
||||||
console.warn('API返回数据异常:', {
|
console.warn('API返回数据异常:', {
|
||||||
result,
|
result,
|
||||||
@ -1489,6 +1501,9 @@ const handleUpload = async (row: any) => {
|
|||||||
})
|
})
|
||||||
ElMessage.warning('报告未生成或查询失败')
|
ElMessage.warning('报告未生成或查询失败')
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
loading.close()
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('查询报告失败:', error)
|
console.error('查询报告失败:', error)
|
||||||
console.error('错误详情:', {
|
console.error('错误详情:', {
|
||||||
@ -1497,11 +1512,173 @@ const handleUpload = async (row: any) => {
|
|||||||
status: error?.response?.status
|
status: error?.response?.status
|
||||||
})
|
})
|
||||||
ElMessage.error('查询报告失败,请重试')
|
ElMessage.error('查询报告失败,请重试')
|
||||||
} finally {
|
|
||||||
reportLoading.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 = `
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>心电图报告</title>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Microsoft YaHei', Arial, sans-serif;
|
||||||
|
background: #f5f5f5;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-container {
|
||||||
|
text-align: center;
|
||||||
|
padding: 20px;
|
||||||
|
background: white;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
flex: 1;
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-container {
|
||||||
|
background: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||||
|
padding: 20px;
|
||||||
|
max-width: 95%;
|
||||||
|
max-height: 95%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-image {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
display: block;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
text-align: center;
|
||||||
|
color: #666;
|
||||||
|
font-size: 16px;
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
text-align: center;
|
||||||
|
color: #f56c6c;
|
||||||
|
font-size: 16px;
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 12px 24px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: all 0.3s;
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-print {
|
||||||
|
background: #007bff;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-print:hover {
|
||||||
|
background: #0056b3;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
body {
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-container {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-container {
|
||||||
|
box-shadow: none !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
max-width: 100% !important;
|
||||||
|
max-height: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-image {
|
||||||
|
width: 100% !important;
|
||||||
|
height: auto !important;
|
||||||
|
max-width: none !important;
|
||||||
|
max-height: none !important;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="button-container">
|
||||||
|
<button class="btn btn-print" onclick="window.print()">
|
||||||
|
🖨️ 打印
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="image-container">
|
||||||
|
<div class="loading" id="loading">正在加载心电图...</div>
|
||||||
|
<div class="error" id="error" style="display: none;">图片加载失败,请重试</div>
|
||||||
|
<img
|
||||||
|
src="${imageUrl}"
|
||||||
|
alt="心电图"
|
||||||
|
class="report-image"
|
||||||
|
style="display: none;"
|
||||||
|
onload="document.getElementById('loading').style.display='none'; this.style.display='block';"
|
||||||
|
onerror="document.getElementById('loading').style.display='none'; document.getElementById('error').style.display='block';"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`
|
||||||
|
|
||||||
|
reportWindow.document.write(reportContent)
|
||||||
|
reportWindow.document.close()
|
||||||
|
reportWindow.focus()
|
||||||
|
}
|
||||||
|
|
||||||
/** 打印报告 */
|
/** 打印报告 */
|
||||||
const handlePrintReport = () => {
|
const handlePrintReport = () => {
|
||||||
if (!reportImageUrl.value) {
|
if (!reportImageUrl.value) {
|
||||||
@ -1509,80 +1686,77 @@ const handlePrintReport = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建打印样式
|
// 创建新窗口用于打印
|
||||||
const printStyle = `
|
const printWindow = window.open('', '_blank')
|
||||||
|
if (!printWindow) {
|
||||||
|
ElMessage.error('无法打开打印窗口,请检查浏览器设置')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建打印页面内容
|
||||||
|
const printContent = `
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>心电图报告打印</title>
|
||||||
<style>
|
<style>
|
||||||
@media print {
|
|
||||||
* {
|
* {
|
||||||
visibility: hidden !important;
|
margin: 0;
|
||||||
margin: 0 !important;
|
padding: 0;
|
||||||
padding: 0 !important;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
width: 100% !important;
|
width: 100%;
|
||||||
height: 100% !important;
|
height: 100%;
|
||||||
margin: 0 !important;
|
overflow: hidden;
|
||||||
padding: 0 !important;
|
|
||||||
overflow: hidden !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.medical-image {
|
.print-container {
|
||||||
visibility: visible !important;
|
width: 100vw;
|
||||||
position: fixed !important;
|
height: 100vh;
|
||||||
top: 0 !important;
|
display: flex;
|
||||||
left: 0 !important;
|
justify-content: center;
|
||||||
width: 100vw !important;
|
align-items: center;
|
||||||
height: 100vh !important;
|
background: white;
|
||||||
border: none !important;
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
z-index: 9999 !important;
|
|
||||||
object-fit: contain !important;
|
|
||||||
background: white !important;
|
|
||||||
box-shadow: none !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.medical-image img {
|
.print-image {
|
||||||
width: 100% !important;
|
max-width: 100%;
|
||||||
height: 100% !important;
|
max-height: 100%;
|
||||||
object-fit: contain !important;
|
object-fit: contain;
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 隐藏所有其他元素 */
|
@media print {
|
||||||
.el-dialog,
|
.print-container {
|
||||||
.el-dialog *:not(.medical-image):not(.medical-image *),
|
width: 100%;
|
||||||
.dialog-footer,
|
height: 100%;
|
||||||
.report-view-container > *:not(.report-content),
|
margin: 0;
|
||||||
.report-content > *:not(.report-image-container),
|
padding: 0;
|
||||||
.report-image-container > *:not(.medical-image) {
|
}
|
||||||
display: none !important;
|
|
||||||
visibility: hidden !important;
|
.print-image {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
max-width: none;
|
||||||
|
max-height: none;
|
||||||
|
page-break-inside: avoid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="print-container">
|
||||||
|
<img src="${reportImageUrl.value}" alt="心电图报告" class="print-image" onload="setTimeout(() => window.print(), 500);" onerror="alert('图片加载失败');">
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
`
|
`
|
||||||
|
|
||||||
// 添加打印样式到head
|
// 写入内容到新窗口
|
||||||
const existingStyle = document.querySelector('#print-style')
|
printWindow.document.write(printContent)
|
||||||
if (existingStyle) {
|
printWindow.document.close()
|
||||||
existingStyle.remove()
|
|
||||||
}
|
|
||||||
|
|
||||||
const styleElement = document.createElement('style')
|
|
||||||
styleElement.id = 'print-style'
|
|
||||||
styleElement.innerHTML = printStyle
|
|
||||||
document.head.appendChild(styleElement)
|
|
||||||
|
|
||||||
// 触发打印
|
|
||||||
window.print()
|
|
||||||
|
|
||||||
// 打印完成后清理
|
|
||||||
setTimeout(() => {
|
|
||||||
if (styleElement) {
|
|
||||||
styleElement.remove()
|
|
||||||
}
|
|
||||||
}, 1000)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 关闭报告查看弹窗 */
|
/** 关闭报告查看弹窗 */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user