From 65c7ecdabe3a29cde1144db1c4a049f14602a9f7 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期三, 23 十月 2024 11:53:48 +0800
Subject: [PATCH] 打印小票

---
 src/views/ecg/doctor/components/DevReadyPanel.vue |   51 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/src/views/ecg/doctor/components/DevReadyPanel.vue b/src/views/ecg/doctor/components/DevReadyPanel.vue
index ef0fbfb..40818e5 100644
--- a/src/views/ecg/doctor/components/DevReadyPanel.vue
+++ b/src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -126,11 +126,12 @@
 import { DevRentApi, DevRentVO } from '@/api/ecg/devrent'
 import {QueueVO} from "@/api/ecg/queue";
 import {isStringEmpty} from "@/utils/stringUtil";
-import {dateFormatter, timeFormatter} from "@/utils/formatTime";
+import {dateFormatter} from "@/utils/formatTime";
 import {JobRecordApi, JobRecordVO} from "@/api/ecg/jobrecord";
 import {DeviceApi, DeviceVO} from "@/api/ecg/devmanage";
 import {curDayEnd, curDayStart} from "@/utils/dateUtil";
-import {PatientStatisticVO, RoomBedVO} from "@/api/ecg/doctor";
+import {RoomBedVO} from "@/api/ecg/doctor";
+import {hiprint, defaultElementTypeProvider} from "vue-plugin-hiprint"
 
 /** 璁惧棰嗙敤 琛ㄥ崟 */
 defineComponent({ name: 'DevReadyPanel' })
@@ -332,12 +333,48 @@
 }
 
 const printBill = async () => {
-  ElNotification({
-    title: '娓╅Θ鎻愮ず',
-    message: '寰呭疄鐜帮紒',
-    type: 'warning'
-  })
+  // ElNotification({
+  //   title: '娓╅Θ鎻愮ず',
+  //   message: '寰呭疄鐜帮紒',
+  //   type: 'warning'
+  // })
+
+// 寮曞叆鍚庝娇鐢ㄧず渚�
+  hiprint.init({
+//    host: 'http://192.168.2.100:17521',
+    token: '111111'
+  });
+// 涓嬪垪鏂规硶閮芥槸娌℃湁鎷栨嫿璁捐椤甸潰鐨�, 鐩稿綋浜庝唬鐮佹ā寮�, 浣跨敤浠g爜璁捐椤甸潰
+// 鎯宠瀹炵幇鎷栨嫿璁捐椤甸潰,璇峰線涓嬬湅 '鑷畾涔夎璁�'
+  var hiprintTemplate = new hiprint.PrintTemplate();  // 鍙紶鍙傛暟
+  var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 });
+//鏂囨湰
+  panel.addPrintText({ options: { width: 140, height: 15, top: 20, left: 20, title: 'hiprint鎻掍欢鎵嬪姩娣诲姞text', textAlign: 'center' } });
+//鏉″舰鐮�
+  panel.addPrintText({ options: { width: 140, height: 35, top: 40, left: 20, title: '123456', textType: 'barcode' } });
+//浜岀淮鐮�
+  panel.addPrintText({ options: { width: 35, height: 35, top: 40, left: 165, title: '123456', textType: 'qrcode' } });
+//闀挎枃鏈�
+  panel.addPrintLongText({ options: { width: 180, height: 35, top: 90, left: 20, title: '闀挎枃鏈細hiprint鏄竴涓緢濂界殑webjs鎵撳嵃,娴忚鍣ㄥ湪鐨勫湴鏂逛粬閮藉彲浠ヨ繍琛�' } });
+//鎵撳嵃
+  hiprintTemplate.print2({}); // 鍙互浼� [瀹氫綅鍙傛暟]  http://https://ccsimple.github.io/sv-print-docs/config/template.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%AE%BE%E8%AE%A1%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B
 }
+/* 鍒嗛〉鎵撳嵃
+HiPrint.print({
+  pages: [
+    {
+      text: 'Hello World!'
+    },
+    {
+      html: '<div><h1>Hello World!</h1></div>',
+      pageBreak: true
+    },
+    {
+      image: 'image.png'
+    }
+  ]
+});
+*/
 
 const getDevInfo = async () => {
   deviceInfo.value.category = ''

--
Gitblit v1.9.3