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

update:修改pdf打印方法

parent 7cc15289
<template> <template>
<view> <view>
<u-button @click="exportPDF">预览pdf</u-button> <u-button @click="exportPDF">预览pdf</u-button>
<u-button @click="printPdfSocket">打印pdf</u-button> <u-button @click="handlePrint">打印pdf</u-button>
</view> </view>
</template> </template>
...@@ -17,13 +17,16 @@ export default { ...@@ -17,13 +17,16 @@ export default {
}, },
methods: { methods: {
handlePrint() { handlePrint() {
console.log(this.socket, 'this.$socket'); this.printPdfSocket({
this.socket.emit('news', { reportName: 'mysql:qrcode-100*100',
client: null, values: {
printer: 'HP LaserJet 1022n', detail: [
type: 'url_pdf', {
pdf_path: 'http://192.168.3.91:8082/static/123.pdf' qrcode: 'qqq',
}); },
],
},
})
}, },
previewPdf() { previewPdf() {
// 预览pdf文件 // 预览pdf文件
......
...@@ -52,22 +52,13 @@ module.exports = { ...@@ -52,22 +52,13 @@ module.exports = {
console.log(printerList, 'printerList'); console.log(printerList, 'printerList');
}); });
}, },
printPdfSocket() { printPdfSocket(params) {
console.log(this.pdfSocket, 'pdfSocket') console.log(this.pdfSocket, 'pdfSocket')
if (!this.pdfSocket) { if (!this.pdfSocket) {
this.createSocket() this.createSocket()
} }
this.$u.api this.$u.api
.getPrintDown({ .getPrintDown(params)
reportName: 'mysql:qrcode-100*100',
values: {
detail: [
{
qrcode: 'qqq',
},
],
},
})
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.pdfSocket.emit('news', { 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