detailprintDialog.vue
4.84 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
<template>
<el-dialog
title="入库铭牌打印"
:visible.sync="visible"
:showprint="showprint"
width="800px"
append-to-body
@close="$emit('update:showprint', false)"
>
<div ref="print">
<el-row>
<el-button
size="mini"
type="primary"
icon="el-icon-printer"
@click="print"
class="no-print pull-right"
>打印</el-button
>
</el-row>
<!-- <div class="horizontal-line"></div> -->
<!-- <block v-for="(item,index) in list" :key="index"> -->
<div style="text-align:center;font-size:18px;margin-bottom:5px;">长沙华恒机器人系统有限公司</div>
<el-table :data="list" border>
<el-table-column label="物料编码" align="left" prop="materialCode" />
<!-- <el-table-column label="存货代码" align="left" prop="materialName" /> -->
<el-table-column label="物料名称" align="left" prop="materialName" />
<el-table-column label="物料规格" align="left" prop="materialSpec" />
<el-table-column label="数量" align="left" prop="totalQty" />
<el-table-column label="项目号" align="left" prop="projectNo" />
<el-table-column label="条码" align="left">
<template slot-scope="scope">
<qrcode-vue
:value="scope.row.materialCode+'/'+scope.row.materialName+'//'+scope.row.totalQty"
size="60"
level="H"
renderAs="svg"
style="margin-top: 5px"
></qrcode-vue>
</template>
</el-table-column>
</el-table>
<!-- </block> -->
<block v-for="(item,index) in list" :key="index">
<div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="dy-report table table-bordered">
<caption style="font-size:18px;text-align:center; color:#333; padding-bottom: 3px;">长沙华恒机器人系统有限公司</caption>
<tbody>
<tr>
<td width="20%" scope="col">物料编码</td>
<td colspan="2" scope="col" style="text-align:center">
<span>{{item.materialCode}}</span>
</td>
</tr>
<tr>
<td scope="col">存货代码</td>
<td colspan="2" scope="col" style="text-align:center">
<span></span>
</td>
</tr>
<tr style="vertical-align:middle">
<td>物料名称</td>
<td style="text-align:center">
<span>{{item.materialName}}</span>
</td>
<td rowspan="3" width="15%" style="padding: 2px">
<qrcode-vue
:value="item.materialCode+'/'+item.materialName+'//'+item.totalQty"
size="60"
level="H"
renderAs="svg"
style="margin-top: 5px"
></qrcode-vue>
</td>
</tr>
<tr>
<td>物料规格</td>
<td style="text-align:center">
<span>{{item.materialSpec}}</span>
</td>
</tr>
<tr>
<td>数 量</td>
<td style="text-align:center; padding: 0">
<input id="qty" name="qty" value="34534.00" class="form-control" type="text" style="text-align:center;height:30px;border: none">
</td>
</tr>
<tr>
<td scope="col">项目号</td>
<td colspan="2" scope="col" style="text-align:center">
<span>{{item.projectNo}}</span>
</td>
</tr>
</tbody>
</table>
</div>
</block>
</div>
</el-dialog>
</template>
<script>
import QrcodeVue from "qrcode.vue";
export default {
components: {
QrcodeVue,
},
props: {
showprint: {
type: Boolean,
default: false,
},
printlist: {
type: Array,
},
},
data() {
return {
printDate: new Date(),
visible: this.showprint,
list: this.printlist,
};
},
watch: {
showprint() {
this.visible = this.showprint;
},
printlist() {
this.list = this.printlist;
console.log(this.list)
},
},
methods: {
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
if (rowIndex % 2 === 0) {
return {
rowspan: 2,
colspan: 1
};
} else {
return {
rowspan: 0,
colspan: 0
};
}
}
},
print() {
this.$print(this.$refs.print);
},
}
};
</script>
<style lang="scss" scoped>
.detail {
margin-top: 15px;
.total {
padding-left: 20px;
}
.no-print {
margin-left: 20px;
}
}
.ad-sheet {
font-size: 22px;
}
// .horizontal-line {
// margin: 25px 0;
// width: 100%;
// border-top: none;
// border-bottom:1px solid #DCDFE6;
// }
</style>