headerprintDialog.vue
2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<template>
<el-dialog
title="入库单打印"
:visible.sync="visible"
:showheaderprint="showheaderprint"
width="800px"
append-to-body
@close="$emit('update:showheaderprint', false)">
<div ref="print">
<el-row>
<el-col :span="10"><div>{{parseTime(printDate)}}</div></el-col>
<el-col :span="4" style="font-size: 24px"><div class="ad-sheet">入库单</div></el-col>
<el-col :span="10">
<div class="qrcode" ref="qrCodeUrl"></div>
入库二维码
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="20" style="text-align: right;font-size: 17px;">
<span>明细条数:<span></span></span>
<span style="padding-left: 20px">明细总数:<span></span></span>
</el-col>
<el-col class="no-print" :span="4">
<el-button
size="mini"
type="primary"
icon="el-icon-printer"
@click="print"
class="pull-right"
>打印</el-button>
</el-col>
</el-row>
<el-table :data="DetailList" border :cell-style="tableCellStyle" :header-cell-style="tableHeaderCellStyle">
<el-table-column prop="materialCode" label="物料编码" align="center"></el-table-column>
<el-table-column prop="materialName" label="物料名称" align="center"></el-table-column>
<el-table-column prop="batch" label="批次" align="center"></el-table-column>
<el-table-column prop="lot" label="批号" align="center"></el-table-column>
<el-table-column prop="projectNo" label="工程号" align="center"></el-table-column>
<el-table-column prop="totalQty" label="数量" align="center"></el-table-column>
<el-table-column prop="materialCode" label="条码" align="center">
</el-table-column>
</el-table>
</div>
</el-dialog>
</template>
<script>
import html2canvas from "html2canvas";
import QRCode from 'qrcodejs2'
export default {
props: {
showheaderprint: {
type: Boolean,
default: false
},
printlist: {
type: Array,
},
},
data() {
return {
printDate: new Date(),
visible: this.showheaderprint,
DetailList: this.printlist,
isHide:false,
};
},
watch: {
showheaderprint() {
this.visible = this.showheaderprint;
},
printlist() {
this.DetailList = this.printlist;
},
},
methods: {
print() {
this.$print(this.$refs.print);
},
creatQrCode() {
var qrcode = new QRCode(this.$refs.qrCodeUrl, {
text: 'xxxx', // 需要转换为二维码的内容
width: 100,
height: 100,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
})
},
},
mounted() {
this.creatQrCode();
},
};
</script>
<style>
</style>