PurchaseInPrintModal.vue
2.81 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
<template>
<a-modal
:visible="visible"
:confirm-loading="confirmLoading"
@cancel="handleCancel"
width="70%"
>
<div>
<a-row>
<div class="noprint container" style="text-align:right; padding: 20px;float: right">
<a-button v-print="'#content'" ghost type="primary" >打印</a-button>
</div>
</a-row>
<div id="content">
<h2 class="center">送货单</h2>
<span>供应商:XXX</span>
<a-row>
<a-table
ref="table"
bordered
size="middle"
rowKey="id"
:pagination="false"
:dataSource="dataSource"
:loading="loading"
:columns="columns">
<span slot="flag" slot-scope="text, record">
<vue-qr :text="qrText(record)" :size="80" :margin="0"></vue-qr>
</span>
</a-table>
</a-row>
</div>
</div>
<template slot="footer">
<a-button @click="handleCancel" v-show="false"></a-button>
</template>
</a-modal>
</template>
<script>
import { getPurchaseByIds } from '../../../api/api'
import VueQr from 'vue-qr'
export default {
name: 'PurchaseInPrintModal',
components: {
VueQr
},
data() {
return {
confirmLoading: false,
visible: false,
loading: false,
dataSource: [],
columns: [
{
title: '工作令号',
dataIndex: 'workNo',
key: 'workNo'
},
{
title: '物料编码',
dataIndex: 'materialCode',
key: 'materialCode'
}, {
title: '物料名称',
dataIndex: 'materialName',
key: 'materialName'
}, {
title: '物料单位',
dataIndex: 'unit',
key: 'unit'
}, {
title: '规格',
dataIndex: 'spec',
key: 'spec'
}, {
title: '数量',
dataIndex: 'qty',
key: 'qty'
}, {
title: '二维码',
dataIndex: 'qr',
scopedSlots: { customRender: 'flag' },
align: 'center',
}
]
}
},
methods: {
handleCancel(e) {
this.visible = false
},
open(ids) {
console.log("打印")
this.loading = true
this.visible = true
let params = {
'ids': ids
}
getPurchaseByIds(params).then(res => {
if (res.success) {
this.dataSource = res.result
this.loading = false
}
})
},
print() {
window.print()
},
doPrint() { //方法
},
qrText(record) {
return "物料编码:"+record.materialCode+"\r\n物料名称:"+record.materialName+"\r\n规格:"
+record.spec+"\r\n工作令号:"+record.workNo+"\r\n数量:"+record.qty
}
}
}
</script>
<style scoped>
</style>