diff --git a/src/components/BatchReceivingPrintDialog.vue b/src/components/BatchReceivingPrintDialog.vue
index 622a4fce..fd4b27da 100644
--- a/src/components/BatchReceivingPrintDialog.vue
+++ b/src/components/BatchReceivingPrintDialog.vue
@@ -56,11 +56,7 @@
-
+
@@ -126,6 +122,7 @@
import { computed, h, reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import JsBarcode from 'jsbarcode'
+import QRCode from 'qrcode'
import * as receivingApi from '@/api/storage_receiving/receiving'
import * as templateApi from '@/api/setting.printtemplate/printTemplate'
import * as stationApi from '@/api/print/print'
@@ -204,6 +201,29 @@ const barcodeImg = {
}
}
+const qrcodeImg = {
+ props: ['text'],
+ setup(innerProps: any) {
+ const src = ref('')
+ const renderQrcode = (val: string) => {
+ if (!val) {
+ src.value = ''
+ return
+ }
+ const canvas = document.createElement('canvas')
+ QRCode.toCanvas(canvas, val, { width: 200, margin: 1 }, (err: Error | null | undefined) => {
+ if (err) {
+ src.value = ''
+ return
+ }
+ src.value = canvas.toDataURL()
+ })
+ }
+ watch(() => innerProps.text, (val: string) => renderQrcode(val), { immediate: true })
+ return () => h('img', { src: src.value, style: { display: 'block', width: '100%', height: '100%', objectFit: 'contain' } })
+ }
+}
+
const previewInfo = computed(() => {
const t = templateOptions.value.find((item: any) => item.id === printSettings.template)
if (!t) return { width: 0, height: 0 }