Bläddra i källkod

病案首页儿科

‘chenzhilei’ 2 månader sedan
förälder
incheckning
83ff043b50
1 ändrade filer med 126 tillägg och 2 borttagningar
  1. 126 2
      src/views/hospitalization/case-front-sheet/FillCaseFrontSheet.vue

+ 126 - 2
src/views/hospitalization/case-front-sheet/FillCaseFrontSheet.vue

@@ -2214,6 +2214,7 @@ import HistorySheetExport from "@/views/hospitalization/case-front-sheet/compone
 import { useDialog } from "@/components/cy/CyDialog/index";
 import env from "../../../utils/setting";
 import {isNumeric} from "@/utils/validate.js";
+// import html2canvas from 'html2canvas';
 
 const userStore = useUserStore();
 const userWards = ref([]);
@@ -2333,6 +2334,9 @@ const showGoSearchBtn1 = ref(false);
 const showGoSearchBtn2 = ref(false);
 const showDel = initShowDel();
 const asideTable = ref(null);
+// const previewImage = ref(null);
+// const paperSize = ref('a4');
+// const orientation = ref('portrait');
 const showDateTimePicker = ref(false);
 const showDateTimePickerData = ref(null);
 
@@ -2519,7 +2523,7 @@ const fetchSheetInfo = row => {
 
     initSheetInfoLine(patient);
     console.log("initSheetInfoLine0",patient.value.age,patient.value.age == 0)
-    if(patient.value.age == null || patient.value.age == 0){
+    if(patient.value.age == null){
       
       // patientTransformData.value.age = '-'
     } else {
@@ -3556,7 +3560,7 @@ const mergePrintHeadpage = () => {
       }
     }
   }
-  console.log("headPagePatient.value",headPagePatient.value)
+  // console.log("headPagePatient.value",headPagePatient.value)
 };
 const mergePrintTailpage = () => {
   tailpagePatient.value = {
@@ -3624,6 +3628,126 @@ const execPrint = page => {
   LODOP.PREVIEW();
 };
 
+// const execPrint = page => {
+//   let prntContent;
+//   if(page === 1){
+//     mergePrintHeadpage()
+//     prntContent = document.getElementById("headpage")
+//   } else {
+//     mergePrintTailpage()
+//     prntContent = document.getElementById("tailpage")
+//   }
+//   console.log("prntContent",prntContent);
+//   prntContent.style.opacity = 1
+
+//   // 使用 html2canvas 转换
+//   html2canvas(prntContent, {
+//       scale: 2, // 提高输出图片的缩放倍数,例如2倍,更清晰
+//       useCORS: true, // 尝试加载跨域图片
+//       allowTaint: true // 允许跨域图片,但可能会污染 canvas
+//   }).then(canvas => {
+//       // canvas 就是转换后的画布元素
+//       // 你可以将其转换为图片数据 URL
+//       previewImage.value =  canvas.toDataURL('image/png');
+//       printImage()
+//       // 接下来可以处理 dataUrl,比如打印
+//       console.log(dataUrl);
+//   }).catch(error => {
+//       console.error('转换失败:', error);
+//   });
+
+// };
+
+// const printImage = () => {
+//   if (!previewImage.value) {
+//     xcMessage.error("请先生成预览图片");
+//       return;
+//   }
+
+//   // showStatus('准备打印中...', 'success');
+
+//   // 创建打印窗口
+//   const printWindow = window.open('', '_blank');
+//   if (!printWindow) {
+//     xcMessage.error("请允许弹出窗口以进行打印");
+//       return;
+//   }
+
+//   // 构建打印内容
+//   printWindow.document.write(`
+//       <!DOCTYPE html>
+//       <html>
+//       <head>
+//           <title>打印文档</title>
+//           <style>
+//               body {
+//                   margin: 0;
+//                   padding: 20px;
+//                   display: flex;
+//                   justify-content: center;
+//                   align-items: center;
+//                   min-height: 100vh;
+//               }
+//               img {
+//                   max-width: 100%;
+//                   height: auto;
+//                   box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+//               }
+//               @media print {
+//                   body {
+//                       padding: 0;
+//                   }
+//                   @page {
+//                       size: ${paperSize.value} ${orientation.value};
+//                       margin: 0;
+//                   }
+//               }
+//           </style>
+//       </head>
+//       <body>
+//           <img src="${previewImage.value}" />
+//       </body>
+//       </html>
+//   `);
+//   printWindow.document.close();
+
+//   // 等待图片加载完成后打印
+//   printWindow.onload = function() {
+//       printWindow.focus();
+//       printWindow.print();
+//       xcMessage.success("准备打印");
+      
+//       // 监听打印后的事件
+//       if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
+//         xcMessage.success("谷歌清理打印");
+//           // Chrome浏览器
+//           printWindow.onafterprint = function() {
+//               cleanupPrint(printWindow);
+//           };
+//       } else {
+//           // 其他浏览器
+//           xcMessage.success("其他浏览器清理打印");
+//           setTimeout(function() {
+//               cleanupPrint(printWindow);
+//           }, 500);
+//       }
+//   };
+// }
+
+// const cleanupPrint = printWindow => {
+//   try {
+//       printWindow.close();
+//       xcMessage.success("打印完成,临时资源已清理");
+//   } catch (e) {
+//       console.log('清理打印窗口:', e);
+//   }
+// }
+
+// const paresetPreviewge = () => {
+//   previewImage.value = null;
+//   statusMessage.value = '';
+// }
+
 onActivated(async () => {
   const params = router.currentRoute.value.query;
   if (params && params.patNo && params.deptCode) {