PrintModal.vue
6.1 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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
:maskClosable="false"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭"
okText="打印完成">
<a-card :bordered="false" :class="{'abcdefg':true}">
<div class="no-print" style="text-align: right">
<a-button v-print="'#printContent'" ghost type="primary">打印</a-button>
</div>
<section ref="print" id="printContent" class="abcdefg">
<div style="text-align: center">
<p style="font-size: 24px;font-weight: 800">出货单</p>
</div>
<div style="height: 1px;border-top: 1px solid #000000;margin-bottom: 30px;"></div>
<!--签字-->
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:scroll="{x:true}"
:columns="columns"
:dataSource="dataSource"
:loading="loading"
:pagination="false"
>
</a-table>
<a-row style="margin-top: 20px;">
<a-col :span="12">
<span>
收货人:
</span>
</a-col>
<a-col :span="12">
<span >收货日期:</span>
</a-col>
</a-row>
</section>
</a-card>
</j-modal>
</template>
<script>
import { httpAction,getAction } from '@/api/manage'
import { validateDuplicateValue,formatDate,filterObj } from '@/utils/util'
export default {
name: "PrintModal",
components: {
},
props:{
},
data () {
return {
title:"出货",
width:800,
visible: false,
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'物料编号',
align:"center",
dataIndex: 'partNumber'
},
{
title:'品名',
align:"center",
dataIndex: 'productName'
},
{
title:'型号',
align:"center",
dataIndex: 'type'
},
{
title:'规格',
align:"center",
dataIndex: 'spec'
},
{
title:'数量',
align:"center",
dataIndex: 'operNumber'
},
],
dataSource:[],
confirmLoading: false,
loading: false,
url: {
delivery: "/order_form/tblOrderForm/delivery",
list: "/order_form/tblOrderForm/listTblWorkOrderByMainIdNoPage",
},
/* 排序参数 */
isorter:{
column: 'createTime',
order: 'desc',
},
/* 筛选参数 */
filters: {},
/* 查询条件-请不要在queryParam中声明非字符串值的属性 */
queryParam: {},
model: {},
}
},
created () {
},
methods: {
open(record){
this.visible = true;
this.loading = true;
this.queryParam['orderFormId'] = record.id;
var params = this.getQueryParams();//查询条件
this.loading = true;
getAction(this.url.list, params).then((res) => {
if (res.success) {
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
this.dataSource = res.result.records||res.result;
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
}else{
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
getQueryParams() {
//获取查询条件
let sqp = {}
var param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters);
param.field = this.getQueryField();
return filterObj(param);
},
getQueryField() {
//TODO 字段权限控制
var str = "id,";
this.columns.forEach(function (value) {
str += "," + value.dataIndex;
});
return str;
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
that.confirmLoading = true;
let httpurl = '';
let method = '';
httpurl+=this.url.delivery;
method = 'put';
this.model.id = this.queryParam['orderFormId'];
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
},
handleCancel () {
this.close()
},
}
}
</script>
<style scoped>
/*update_begin author:scott date:20191203 for:打印机打印的字体模糊问题 */
* {
color: #000000!important;
-webkit-tap-highlight-color: #000000!important;
}
/*update_end author:scott date:20191203 for:打印机打印的字体模糊问题 */
.abcdefg .ant-card-body{
margin-left: 0%;
margin-right: 0%;
margin-bottom: 1%;
border:0px solid black;
min-width: 800px;
color:#000000!important;
}
.explain{
text-align: left;
margin-left: 50px;
color:#000000!important;
}
.explain .ant-input,.sign .ant-input{
font-weight:bolder;
text-align:center;
border-left-width:0px!important;
border-top-width:0px!important;
border-right-width:0px!important;
}
.explain div{
margin-bottom: 10px;
}
/* you can make up upload button and sample style by using stylesheets */
.ant-upload-select-picture-card i {
font-size: 32px;
color: #999;
}
.ant-upload-select-picture-card .ant-upload-text {
margin-top: 8px;
color: #666;
}
</style>