|
@@ -0,0 +1,63 @@
|
|
|
+<template>
|
|
|
+ <page-layer>
|
|
|
+ <template #header>
|
|
|
+ <el-button @click="horizontalPrint" type="primary">打印</el-button>
|
|
|
+ </template>
|
|
|
+ <template #main>
|
|
|
+ <div style="width: 800px; height: 50px; padding: 10px 0 10px 20px; background: silver;display: flex">
|
|
|
+ <div id="qrcode"></div>
|
|
|
+ <div style="width: 20px"></div>
|
|
|
+ <div>
|
|
|
+ <div id="person" style="font-size: 12px;font-weight: bold">姓名:一二三四五六七八九 / 性别:男 / 年龄:37</div>
|
|
|
+ <div id="department" style="font-size: 12px; margin-top: 5px;font-weight: bold">入院科室:呼吸内科</div>
|
|
|
+ <div id="contact" style="font-size: 12px; margin-top: 5px;font-weight: bold">紧急联系人:13698072587</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </page-layer>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+
|
|
|
+// 280mm * 30mm
|
|
|
+
|
|
|
+import { initLodop, getLodop } from '@/utils/c-lodop'
|
|
|
+import {onMounted} from "vue";
|
|
|
+import {qrcanvas} from "qrcanvas";
|
|
|
+import PageLayer from "@/layout/PageLayer.vue";
|
|
|
+
|
|
|
+const PRINTER_NAME = 'DASCOM DL-520Z'
|
|
|
+const inpatientNo = ref('0374562')
|
|
|
+
|
|
|
+const drawQrcoce = (inpatientNo) => {
|
|
|
+ const labelCanvas = qrcanvas({
|
|
|
+ data: inpatientNo,
|
|
|
+ size: '50',
|
|
|
+ })
|
|
|
+ document.getElementById('qrcode').appendChild(labelCanvas)
|
|
|
+}
|
|
|
+
|
|
|
+const horizontalPrint = () => {
|
|
|
+ let LODOP = getLodop()
|
|
|
+ LODOP.PRINT_INIT('inpatient_info2')
|
|
|
+ LODOP.SET_PRINTER_INDEX(PRINTER_NAME)
|
|
|
+ LODOP.SET_PRINT_PAGESIZE(2, 0, 0, '')
|
|
|
+ LODOP.SET_PRINT_STYLE('FontSize', 9)
|
|
|
+ LODOP.SET_PRINT_STYLE('Bold', 1)
|
|
|
+
|
|
|
+ LODOP.ADD_PRINT_BARCODE('7mm', '30mm', '18.5mm', '18.5mm', 'QRCode', inpatientNo.value)
|
|
|
+
|
|
|
+ // ADD_PRINT_HTM(Top,Left,Width,Height,strHtmlContent)
|
|
|
+ LODOP.ADD_PRINT_TEXT('8mm', '50mm', '220mm', '7mm', document.getElementById('person').innerHTML)
|
|
|
+ LODOP.ADD_PRINT_TEXT('14mm', '50mm', '220mm', '7mm', document.getElementById('department').innerHTML)
|
|
|
+ LODOP.ADD_PRINT_TEXT('20mm', '50mm', '220mm', '7mm', document.getElementById('contact').innerHTML)
|
|
|
+
|
|
|
+ LODOP.PREVIEW()
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ initLodop()
|
|
|
+ drawQrcoce(inpatientNo.value)
|
|
|
+})
|
|
|
+
|
|
|
+</script>
|