|
1
2
|
<template>
|
|
3
|
<div class="container" style=" width:320px;/*height:228px;*/color: #333">
|
|
4
5
6
7
|
<div class="noprint container" style="text-align:right; padding: 20px;float: right">
<a-button v-print="'#printContent'" ghost type="primary">打印</a-button>
</div>
<div class="row" id="printContent" >
|
|
8
|
|
|
9
10
11
12
13
14
15
16
|
<table width="100%" border="0" cellspacing="0" cellpadding="0"
v-for="source in dataSource">
<caption style="font-size:22px;text-align:center; color:#333; padding-bottom: 3px;"></caption>
<tbody>
<tr >
<td scope="col" style="font-size:12px;font-weight:bold" >物料图号:{{source.drawingNo}}</td>
</tr>
<tr >
|
|
17
|
<td scope="col" width="100%" style="font-size:12px;font-weight:bold" >物料名称:{{source.name}} </td>
|
|
18
|
<td rowspan="4" style="padding-right: 1px">
|
|
19
20
|
<!--<img class="" align="center" valign="middle" style="vertical-align:middle; padding:2px;"/>-->
<!--<span class="qrcode"></span>-->
|
|
21
|
<!-- <div id="qrcode" ></div>-->
|
|
22
|
<vue-qr :text="source.userDef3" :size="70" :margin="0"></vue-qr>
|
|
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
|
</td>
</tr>
<tr >
<td scope="col" style="font-size:12px;font-weight:bold" >物料规格:</td>
</tr>
<tr >
<td scope="col" style="font-size:12px;font-weight:bold" >生产数量:{{source.qty}}</td>
</tr>
<tr >
<td scope="col" style="font-size:12px;font-weight:bold">部件工作令:{{source.userDef1}}</td>
</tr>
<tr >
<td scope="col" style="font-size:12px;font-weight:bold">项目名称:{{source.userDef2}}</td>
</tr>
<tr >
<td scope="col" style="font-size:12px;font-weight:bold">工序:{{source.technology}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
<script>
import { getBom, getSchedulerPrint } from '../../api/api'
|
|
48
49
50
|
import QRCode from 'qrcodejs2' // 引入qrcode
// import QrcodeVue from 'qrcode.vue'
import VueQr from 'vue-qr'
|
|
51
52
53
|
export default {
name: 'printScheduler',
|
|
54
55
56
57
58
|
components: {
QRCode,
VueQr,
// QrcodeVue,
},
|
|
59
60
|
data() {
return {
|
|
61
62
63
64
65
66
67
|
dataSource:[],
downloadData: {
url: '扫码访问的链接地址',
icon: '随便一张图片的地址也行'
},
value: 'https://example.com',
size: 300,
|
|
68
69
70
71
72
73
74
|
}
},
methods:{
print(){
var print= document.getElementById('printContent');
var newContent = print.innerHTML;
var oldContent = document.body.innerHTML;
|
|
75
76
77
|
// this.$nextTick (function () {
// this.qrcode();
// });
|
|
78
79
80
81
82
83
84
85
86
87
88
|
document.body.innerHTML = newContent;
// 获取要打印的dom内容
// let newDomHtml = this.$refs.printContent.innerHTML;
// // 将要打印的内容赋值给本页
// window.document.body.innerHTML= newDomHtml ;
// 调用window的打印
window.print();
// 解决打印之后按钮失效的问题,刷新页面
window.location.reload();
return false;
},
|
|
89
90
91
92
93
94
95
96
97
|
// qrcode() {
// setTimeout(function() {
// let qrcode = new QRCode('qrcode', {
// width: 25,
// height: 25,
// text: 'https://www.baidu.com', // 二维码地址
// })
// },500)
// },
|
|
98
99
100
101
|
loadData(id){
getSchedulerPrint(id).then((res) => {
console.log(res);
this.dataSource = res;
|
|
102
|
// this.qrcode();
|
|
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
})
},
a(){
},
created() {
this.getDate();
},
},
mounted:function() {
console.log("123456");
let id = this.$route.query.id;
console.log(id);
this.loadData(id);
},
}
</script>
|
|
127
128
129
130
131
132
133
134
|
<style type="text/css">
@media print {
.noprint {
display: none;
}
}
</style>
|
|
135
136
137
138
139
140
|
<style scoped>
* {
color: #000000!important;
-webkit-tap-highlight-color: #000000!important;
}
</style>
|