headerprintDialog.vue
4.69 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
<template>
<el-dialog
title="出库单打印"
:visible.sync="visible"
:showheaderprint="showheaderprint"
width="800px"
append-to-body
@close="$emit('update:showheaderprint', false)">
<div ref="print">
<el-header style="height:40px;line-height: 30px">
发货单
</el-header>
<el-aside style="padding-bottom: 5px">发货单号:{{code}}</el-aside>
<el-main>
<el-header>
<el-row :gutter="24" class="dyBHeader">
<el-col :span="8" style="text-align: left;font-size: 13px">{{ parseTime(printDate) }}</el-col>
<el-col :span="8" style="font-size: 24px">出库单</el-col>
<el-col :span="8" style="text-align: right;">
<qrcode-vue :value="code" size="60" level="H" renderAs="svg"></qrcode-vue>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12" style="text-align: left;font-size: 13px">客户名称:{{customerCode}}</el-col>
<el-col :span="12" style="text-align: right;font-size: 13px;">
<span>明细条数:{{DetailList.length}}</span>
<span style="padding-left: 20px">明细总数:{{billTotal}}</span>
<el-button size="mini"
type="info" plain
icon="el-icon-printer"
@click="print"
class="no-print">打印</el-button>
</el-col>
</el-row>
</el-header>
<el-table :data="DetailList" border :cell-style="tableCellStyle" :header-cell-style="tableHeaderCellStyle">
<el-table-column prop="materialCode" align="center" label="物料编码" width="110"></el-table-column>
<el-table-column prop="materialName" align="center" label="物料名称" width="200"></el-table-column>
<el-table-column prop="batch" align="center" label="批次"></el-table-column>
<el-table-column prop="lot" align="center" label="批号"></el-table-column>
<el-table-column prop="projectNo" align="center" label="项目号"></el-table-column>
<el-table-column prop="shipQty" align="center" label="数量" width="55"></el-table-column>
<el-table-column prop="materialCodeUnit" align="left" label="条码">
<template slot-scope="scope">
<qrcode-vue :value="scope.row.materialCode" size="60" level="H" renderAs="svg" style="margin-top:5px;"></qrcode-vue>
</template>
</el-table-column>
</el-table>
</el-main>
</div>
</el-dialog>
</template>
<script>
import QrcodeVue from 'qrcode.vue'
export default {
components: {
QrcodeVue,
},
props: {
showheaderprint: {
type: Boolean,
default: false
},
printlist: {
type: Array,
},
code: {
type: String
},
customerCode: {
type: String
},
},
data() {
return {
printDate: new Date(),
visible: this.showheaderprint,
/*code: this.code,
customerCode: this.customerCode,*/
DetailList: this.printlist,
};
},
//计算右上角总单据数量、已出库数量
computed:{
billTotal:function () {
let result = 0
for(let i=0;i<this.DetailList.length;i++){
result +=this.DetailList[i].shipQty
}
return result
}
},
watch: {
showheaderprint() {
this.visible = this.showheaderprint;
},
printlist() {
this.DetailList = this.printlist;
}
},
methods: {
print() {
this.$print(this.$refs.print);
},
// 修改 table cell边框的背景色...
tableCellStyle () {
return 'border-color: #868686;'
},
// 修改 table header cell的背景色、边框背景色...
tableHeaderCellStyle () {
return 'border-color: #868686; color: #606266; background:#fff;font-size:14px'
},
},
};
</script>
<style lang="scss" scoped>
.el-header {
color: #333;
text-align: center;
line-height: 40px;
font-size: 16px;
}
.dyBHeader{
border-bottom: 1px solid #333;padding: 10px 0
}
.el-main{
padding: 0;
border: 1px solid #333;
}
aside{padding:5px 0px;line-height:21px;background: none;margin-bottom: 0px; font-size: 13px}
.el-table--border, .el-table--group {
border-top: 1px solid #333;
}
.no-print {
margin-top: 5px;
margin-left: 10px
}
.ad-sheet {
font-size: 22px;
}
@media print{
.el-table{ width: 99.9%}
.dys{
padding: 10px 0;
}
.dyBHeader{
padding: 20px 0;
}
}
</style>