printScheduler.vue
6.47 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<template>
<div class="container" style=" width:600px;/*height:228px;*/color: #333">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="24">
<a-col :md="12" :sm="8">
<a-form-item label="物料图号" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
<a-input placeholder="请输入物料图号" v-model="querySource.drawingNo"></a-input>
</a-form-item>
</a-col>
<a-col :md="12" :sm="8">
<a-form-item label="物料名称" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
<a-input placeholder="请输入物料名称" v-model="querySource.name"></a-input>
</a-form-item>
</a-col>
<a-col :md="12" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="search" icon="search">查询</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<div class="noprint container" style="text-align:right; padding: 20px;float: right">
<a-button id="print2" ghost type="primary" @click.native="print2">打印</a-button>
</div>
<div class="row" id="printContent">
<table width="100%" border="0" cellspacing="0" cellpadding="0"
v-for="(source,index) 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>
<td scope="col" width="100%" style="font-size:12px;font-weight:bold">物料名称:{{ source.name }}</td>
<td rowspan="4" style="padding: 1px">
<vue-qr :text="source.userDef3" :size="70" :margin="0"></vue-qr>
</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>
<a-input type="checkbox" @click="checkclick(source,$event)"/>
</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 class="row" id="printContent2" v-show="showRentPrise">
<table width="100%" border="0" cellspacing="0" cellpadding="0"
v-for="source in dataSource2">
<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>
<td scope="col" width="100%" style="font-size:12px;font-weight:bold">物料名称:{{ source.name }}</td>
<td rowspan="4" style="padding: 1px">
<vue-qr :text="source.userDef3" :size="70" :margin="0"></vue-qr>
</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 {getSchedulerPrintDetail, getSchedulerPrint} from '../../api/api'
import QRCode from 'qrcodejs2' // 引入qrcode
// import QrcodeVue from 'qrcode.vue'
import VueQr from 'vue-qr'
export default {
name: 'printScheduler',
components: {
QRCode,
VueQr,
// QrcodeVue,
},
data() {
return {
querySource: {},
dataSource: [],
downloadData: {
url: '扫码访问的链接地址',
icon: '随便一张图片的地址也行'
},
value: '',
size: 300,
isShow: true,
checkedAll: [{isTrue: false}],
isIndeterminate: true,
checkedItem: [],
dataSource2: [],
showRentPrise: false,
}
},
methods: {
checkclick(source, event) {//明白这一点之后我们将@click换成@change,点击复选框之后将会得到true
this.isShow = false;
if (event.target.checked === true) {
this.checkedItem.push(source);
} else {
for (var checkedItemKey in this.checkedItem) {
let checkedItemId = this.checkedItem[checkedItemKey].id
if (checkedItemId == source.id) {
this.checkedItem.splice(this.checkedItem[checkedItemKey], 1)
}
}
}
this.dataSource2 = this.checkedItem;
},
print2() {
this.showRentPrise = true
var print = document.getElementById('printContent2');
var newContent = print.innerHTML;
var oldContent = document.body.innerHTML;
document.body.innerHTML = newContent;
window.print();
// 解决打印之后按钮失效的问题,刷新页面
//document.body.innerHTML = oldContent;
window.location.reload();
},
loadData(id) {
getSchedulerPrint(id).then((res) => {
this.dataSource = res;
this.dataSource2 = res;
this.querySource.headerId = id;
// this.qrcode();
})
},
search() {
getSchedulerPrintDetail(this.querySource).then((res) => {
console.log(res);
this.dataSource = res;
this.dataSource2 = res;
// this.qrcode();
})
}
},
mounted: function () {
let id = this.$route.query.id;
window.print2=()=>{
this.print2()
}
this.loadData(id);
},
}
</script>
<style type="text/css">
@media print {
.noprint {
display: none;
}
}
</style>
<style scoped>
* {
color: #000000 !important;
-webkit-tap-highlight-color: #000000 !important;
}
</style>