diff --git a/src/api/ultrasoniccom/index.ts b/src/api/ultrasoniccom/index.ts index c9ae677f..fe95f750 100644 --- a/src/api/ultrasoniccom/index.ts +++ b/src/api/ultrasoniccom/index.ts @@ -3,7 +3,8 @@ import request from '@/config/axios' //分检操作使用 export interface updateexamineimageVO { - + + regid:string id: string // 主键 isDelete: string // 删除标记 deletePerson: string//删除人 diff --git a/src/router/index.ts b/src/router/index.ts index 8f66ca31..ff345323 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -5,7 +5,7 @@ import remainingRouter from './modules/remaining' // 创建路由实例 const router = createRouter({ - history: createWebHistory(), // createWebHashHistory URL带#,createWebHistory URL不带# + history: createWebHistory(), // createWebHashHistory URL带#,createWebHistory URL不带# liunx 病理 需要在这里加 '/bl/' strict: true, routes: remainingRouter as RouteRecordRaw[], scrollBehavior: () => ({ left: 0, top: 0 }) diff --git a/src/utils/htmlPdf.js b/src/utils/htmlPdf.js index 95adc752..f9ff1f1c 100644 --- a/src/utils/htmlPdf.js +++ b/src/utils/htmlPdf.js @@ -1,63 +1,115 @@ -// 页面导出为pdf格式 import html2Canvas from 'html2canvas'; import jsPDF from 'jspdf'; const htmlToPdf = { - getPdf(title, id) { - html2Canvas( - document.querySelector(id), - { - allowTaint: false, - taintTest: false, - logging: false, - useCORS: true, - dpi: window.devicePixelRatio * 4, //将分辨率提高到特定的DPI 提高四倍 - scale: 4, //按比例增加分辨率 - } - ).then((canvas) => { - var pdf = new jsPDF('p', 'mm', 'a4'); //A4纸,纵向 - var ctx = canvas.getContext('2d'), - a4w = 190, - a4h = 272, //A4大小,210mm x 297mm,四边各保留10mm的边距,显示区域190x277 - imgHeight = Math.floor((a4h * canvas.width) / a4w), //按A4显示比例换算一页图像的像素高度 - renderedHeight = 0; + getPdfBase64(title, id) { + return new Promise((resolve) => { + html2Canvas(document.querySelector(id), { + allowTaint: false, + taintTest: false, + logging: false, + useCORS: true, + dpi: window.devicePixelRatio * 4, // 将分辨率提高到特定的DPI 提高四倍 + scale: 4, // 按比例增加分辨率 + }).then((canvas) => { + const pdf = new jsPDF('p', 'mm', 'a4'); // A4纸,纵向 + const ctx = canvas.getContext('2d'), + a4w = 190, + a4h = 272; // A4大小,210mm x 297mm,四边各保留10mm的边距,显示区域190x277 + let imgHeight = Math.floor((a4h * canvas.width) / a4w), // 按A4显示比例换算一页图像的像素高度 + renderedHeight = 0; - while (renderedHeight < canvas.height) { - var page = document.createElement('canvas'); - page.width = canvas.width; - page.height = Math.min(imgHeight, canvas.height - renderedHeight); //可能内容不足一页 + while (renderedHeight < canvas.height) { + const page = document.createElement('canvas'); + page.width = canvas.width; + const pageHeight = Math.min(imgHeight, canvas.height - renderedHeight); // 可能内容不足一页 + page.height = pageHeight; - //用getImageData剪裁指定区域,并画到前面创建的canvas对象中 - page - .getContext('2d') - .putImageData( - ctx.getImageData( - 0, - renderedHeight, - canvas.width, - Math.min(imgHeight, canvas.height - renderedHeight), - ), - 0, - 0, - ); - pdf.addImage( - page.toDataURL('image/jpeg', 1.0), - 'JPEG', - 10, - 10, - a4w, - Math.min(a4h, (a4w * page.height) / page.width), - ); //添加图像到页面,保留10mm边距 + // 用getImageData剪裁指定区域,并画到前面创建的canvas对象中 + page + .getContext('2d') + .putImageData( + ctx.getImageData( + 0, + renderedHeight, + canvas.width, + pageHeight, + ), + 0, + 0, + ); + pdf.addImage( + page.toDataURL('image/jpeg', 1.0), + 'JPEG', + 10, + 10, + a4w, + Math.min(a4h, (a4w * page.height) / page.width), + ); // 添加图像到页面,保留10mm边距 - renderedHeight += imgHeight; - if (renderedHeight < canvas.height) { - pdf.addPage(); //如果后面还有内容,添加一个空页 - } - // delete page; - } - pdf.save(title + '.pdf') - }); - }, + renderedHeight += pageHeight; + if (renderedHeight < canvas.height) { + pdf.addPage(); // 如果后面还有内容,添加一个空页 + } + } + const pdfBase64String = pdf.output('datauristring'); // 获取 base64 编码的 PDF 文件 + resolve(pdfBase64String); // 解析 base64 字符串 + }); + }); + }, + + getPdf(title, id) { + html2Canvas(document.querySelector(id), { + allowTaint: false, + taintTest: false, + logging: false, + useCORS: true, + dpi: window.devicePixelRatio * 4, // 将分辨率提高到特定的DPI 提高四倍 + scale: 4, // 按比例增加分辨率 + }).then((canvas) => { + const pdf = new jsPDF('p', 'mm', 'a4'); // A4纸,纵向 + const ctx = canvas.getContext('2d'), + a4w = 190, + a4h = 272; // A4大小,210mm x 297mm,四边各保留10mm的边距,显示区域190x277 + let imgHeight = Math.floor((a4h * canvas.width) / a4w), // 按A4显示比例换算一页图像的像素高度 + renderedHeight = 0; + + while (renderedHeight < canvas.height) { + const page = document.createElement('canvas'); + page.width = canvas.width; + const pageHeight = Math.min(imgHeight, canvas.height - renderedHeight); // 可能内容不足一页 + page.height = pageHeight; + + // 用getImageData剪裁指定区域,并画到前面创建的canvas对象中 + page + .getContext('2d') + .putImageData( + ctx.getImageData( + 0, + renderedHeight, + canvas.width, + pageHeight, + ), + 0, + 0, + ); + pdf.addImage( + page.toDataURL('image/jpeg', 1.0), + 'JPEG', + 10, + 10, + a4w, + Math.min(a4h, (a4w * page.height) / page.width), + ); // 添加图像到页面,保留10mm边距 + + renderedHeight += pageHeight; + if (renderedHeight < canvas.height) { + pdf.addPage(); // 如果后面还有内容,添加一个空页 + } + } + pdf.save(title + '.pdf'); // 保存 PDF 文件 + }); + }, }; export default htmlToPdf; \ No newline at end of file diff --git a/src/views/applyregistration/reportPrintStatistics/ReportInfoCT.vue b/src/views/applyregistration/reportPrintStatistics/ReportInfoCT.vue index c9de459c..5b6b9f05 100644 --- a/src/views/applyregistration/reportPrintStatistics/ReportInfoCT.vue +++ b/src/views/applyregistration/reportPrintStatistics/ReportInfoCT.vue @@ -107,11 +107,16 @@ const infoParams = defineProps({ diagDoctor: String, diagDate: String, reviewDoctor: String, - reviewDate: String + reviewDate: String, + extraInfo: { + type: Object as PropType, // 使用 Object 作为 any 类型的替代 + required: false + } }) /** 数据内容 **/ const orgInfo = ref('') + const VITE_BASE_URL_YunJiaoPian = ref(import.meta.env.VITE_BASE_URL_YunJiaoPian) const age = computed(() => { @@ -134,9 +139,18 @@ const age = computed(() => { /** 钩子方法 **/ onMounted(async () => { - let userInfo = await getUserProfile() + + if(!infoParams.extraInfo) //any类型 + { + let userInfo = await getUserProfile() if (userInfo && userInfo.orgId) orgInfo.value = await ReportPrintStatisticsApi.getOrg(userInfo.orgId.trim()) + console.log('查询到机构' + orgInfo.value) + }else + { + orgInfo.value=infoParams.extraInfo; + } + }) /** 导出内容 **/ diff --git a/src/views/dicomForm/dicomViewForm.vue b/src/views/dicomForm/dicomViewForm.vue index c45d0423..de6bdaa9 100644 --- a/src/views/dicomForm/dicomViewForm.vue +++ b/src/views/dicomForm/dicomViewForm.vue @@ -311,6 +311,16 @@ + + +
+
+ +
+