Commit fa3838ff authored by 张海景's avatar 张海景

update:修改pdf打印方法

parent 7cc15289
<template>
<view>
<u-button @click="exportPDF">预览pdf</u-button>
<u-button @click="printPdfSocket">打印pdf</u-button>
<u-button @click="handlePrint">打印pdf</u-button>
</view>
</template>
......@@ -17,13 +17,16 @@ export default {
},
methods: {
handlePrint() {
console.log(this.socket, 'this.$socket');
this.socket.emit('news', {
client: null,
printer: 'HP LaserJet 1022n',
type: 'url_pdf',
pdf_path: 'http://192.168.3.91:8082/static/123.pdf'
});
this.printPdfSocket({
reportName: 'mysql:qrcode-100*100',
values: {
detail: [
{
qrcode: 'qqq',
},
],
},
})
},
previewPdf() {
// 预览pdf文件
......
......@@ -52,22 +52,13 @@ module.exports = {
console.log(printerList, 'printerList');
});
},
printPdfSocket() {
printPdfSocket(params) {
console.log(this.pdfSocket, 'pdfSocket')
if (!this.pdfSocket) {
this.createSocket()
}
this.$u.api
.getPrintDown({
reportName: 'mysql:qrcode-100*100',
values: {
detail: [
{
qrcode: 'qqq',
},
],
},
})
.getPrintDown(params)
.then((res) => {
if (res.code === 200) {
this.pdfSocket.emit('news', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment