78 lines
1.6 KiB
Vue
Raw Normal View History

2025-04-14 16:04:52 +08:00
<template>
2025-04-23 17:47:28 +08:00
<el-dialog :model-value="state.show" @close="closeFun" width="600">
<div id="printTemplate" class="print-hide" ref="typefaceBoxRef">
<div class="typefaceBox">
<VueQr text="props.data.tiaoMa" :size="200"></VueQr>
2025-04-14 16:04:52 +08:00
<div class="titleList">
2025-04-23 17:47:28 +08:00
<div class="itemText">供应商{{ state.data.supplierName }}</div>
2025-04-14 16:04:52 +08:00
</div>
</div>
</div>
<div class="btnList">
<el-button type="primary" @click="handlePrint">打印</el-button>
</div>
</el-dialog>
</template>
<script setup lang="ts">
2025-04-23 17:47:28 +08:00
import { reactive, ref, defineExpose } from 'vue';
2025-04-14 16:04:52 +08:00
import VueQr from 'vue-qr/src/packages/vue-qr.vue';
import printJS from 'print-js';
2025-04-23 17:47:28 +08:00
import html2canvas from 'html2canvas';
const LODOP = window.LODOP;
2025-04-14 16:04:52 +08:00
const typefaceBoxRef = ref();
2025-04-23 17:47:28 +08:00
2025-04-14 16:04:52 +08:00
const state = reactive({
2025-04-23 17:47:28 +08:00
show: false,
data: {},
2025-04-14 16:04:52 +08:00
snapshotUrl: '',
2025-04-23 17:47:28 +08:00
printWidth: 100,
printHeight: 100,
2025-04-14 16:04:52 +08:00
});
2025-04-23 17:47:28 +08:00
const openDataFun = (obj:object) => {
state.data = obj
state.show = true
}
const handlePrintInitialization = () => {
LODOP.PRINT_INITA(0,0,0,0,"L4");
LODOP.SET_PRINT_PAGESIZE(0,state.printWidth * 10,state.printHeight * 10,"A4");
// LODOP.PREVIEW();
LODOP.PRINT();
}
//打印配置
const handlePrintZhuhai = async () => {
LODOP.ADD_PRINT_BARCODE(125,25,150,150,"QRCode","1234567890版本7的最大值是122个字符123123");
2025-04-14 16:04:52 +08:00
};
2025-04-23 17:47:28 +08:00
const handlePrintTaiguo = () => {
}
2025-04-14 16:04:52 +08:00
const closeFun = () => {
2025-04-23 17:47:28 +08:00
state.show = false
2025-04-14 16:04:52 +08:00
};
2025-04-23 17:47:28 +08:00
defineExpose({
openDataFun
})
2025-04-14 16:04:52 +08:00
</script>
<style scoped lang="scss">
.typefaceBox {
display: flex;
align-items: center;
justify-content: center;
2025-04-23 17:47:28 +08:00
2025-04-14 16:04:52 +08:00
.titleList {
flex: 1;
}
}
.btnList {
margin-top: 26px;
display: flex;
justify-content: center;
}
</style>