Page7.vue
21.5 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<template>
<section>
<!-- 工具条-->
<el-row class="toolbar" style="padding-bottom: 0px;">
<el-form :inline="true" ref="filters" :model="filters" :rules="rules" >
<el-row>
<el-col :span="8">
<el-form-item label="主单号:" prop="waybill">
<el-input v-model="filters.waybill" placeholder="" size="small" style="width: 240px"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-button type="primary" @click="getWaybillList('filters')" size="small" style="margin-left: 40px">查询</el-button>
<span style="color: red;margin-left: 10px">查询单号前请先选定业务类型</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-row>
<!-- 列表-->
<el-row>
<el-table :data="awbaList" v-loading="commonLoading" style="width: 100%">
<el-table-column fixed label="操作">
<template slot-scope="scope">
<el-button @click="addWaybill(scope.$index, scope.row)" type="primary" size="small">添加</el-button>
</template>
</el-table-column>
<el-table-column prop="flightno" label="航班号">
</el-table-column>
<el-table-column prop="flightDate" :formatter="flightDate" label="航班日期">
</el-table-column>
<el-table-column prop="segment" label="航段">
</el-table-column>
<el-table-column prop="waybillnomaster" label="主单号">
</el-table-column>
<el-table-column prop="totalpiece" label="件数">
</el-table-column>
<el-table-column prop="totalweight" label="重量">
</el-table-column>
<el-table-column prop="customscode" label="关区">
</el-table-column>
<el-table-column prop="createdate" :formatter="formatDate" label="时间">
</el-table-column>
<el-table-column prop="receiptinformation" label="回执内容" width="280px">
</el-table-column>
</el-table>
</el-row>
<!-- 申请表单信息-->
<el-row style="padding-bottom: 0px;">
<el-form ref="addForm" :model="addForm" :rules="addFormRules">
<el-row>
<el-col :span="10">
<el-row>
<el-form-item label="输入备注:">
<el-input
type="text"
v-model="addForm.remark3"
maxlength="10"
show-word-limit
size="small" style="width: 180px">
</el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="车牌号码:" prop="trailerFrameNo">
<el-input v-model="addForm.trailerFrameNo" placeholder="请输入车牌号" @change="trailerFrameNo(addForm.trailerFrameNo)" size="small" style="width: 180px"></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="货物类型:" prop="cocode">
<el-select v-model="addForm.cocode" placeholder="请选择" size="small" style="width: 180px">
<el-option label="转关货" value="转关货"></el-option>
<el-option label="换单货" value="换单货"></el-option>
<el-option label="普通货" value="普通货"></el-option>
<el-option label="退库货" value="退库货"></el-option>
<el-option label="查验货" value="查验货"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="场站选择:" prop="endstationList">
<el-select v-model="addForm.endstationList" multiple placeholder="请选择">
<el-option
v-for="item in options"
:key="item.stationId"
:label="item.name"
:value="item.stationId">
</el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="运输公司:">
<el-input v-model="addForm.agentno" placeholder="" size="small" style="width: 180px"></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="挂靠单位:">
<el-input v-model="addForm.agentname" placeholder="" size="small" style="width: 180px"></el-input>
</el-form-item>
</el-row>
</el-col>
<el-col :span="7">
<el-row>
<el-form-item label="业务类型:" prop="businesstype">
<el-select v-model="addForm.businesstype" clearable placeholder="请选择" size="small" style="width: 180px">
<el-option label="进口提货" value="进口提货"></el-option>
<el-option label="出口送货" value="出口送货"></el-option>
<el-option label="分拨业务" value="分拨业务"></el-option>
<el-option label="调拨业务" value="调拨业务"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="申请单位:">
<el-input v-model="addForm.veProperty" disabled size="small" style="width: 180px"></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="备案单位:">
<el-input v-model="addForm.trailerLicenseNo" disabled size="small" style="width: 180px"></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="主单列表:">
<el-input
type="textarea"
:rows="4"
placeholder="请输入主单号,例如17212341234,多个单号以‘,’(英文)分割"
v-model="addForm.masterList"
style="width: 180px">
</el-input>
</el-form-item>
</el-row>
</el-col>
</el-row>
<el-row style="margin-left: 320px">
<!-- <el-button type="primary" @click="saveSubmit()" :disabled="disabledStr">保存</el-button>-->
<el-button type="primary" @click="saveSubmit()" :disabledStr="disabledStr" >保存</el-button>
</el-row>
</el-form>
</el-row>
</section>
</template>
<script>
import {getYardList as yartList} from '../../api/station_dispatch'
import {trailerFrameNoSuccess, save} from '../../api/remote_interface/byont_import'
import loginUserInfo from "../../api/base";
import {add} from "../../api/security/security";
export default {
data() {
return {
rules:{
waybill: [
{ required: true, message: '请输入运单号', trigger: 'change' }
]
},
addFormRules:{
businesstype: [
{required: true, message: '请输入运单号', trigger: 'blur'}
],
trailerFrameNo: [
{required: true, message: '请输入车牌号', trigger: 'blur'}
],
cocode: [
{required: true, message: '请选择货务类型', trigger: 'blur'}
],
endstationList: [
{required: true, message: '请选择场站', trigger: 'blur'}
]
},
options:[],
filters: {
waybill: '828-12161085',
},
radio:'',
awbaList:[],
yardList: [],
commonLoading: false,
textarea: '',
disabledStr: true,
addForm: {
// 备注
remark3: '',
// 业务类型
businesstype: '',
// 车牌号
trailerFrameNo: '',
//备案单位
trailerLicenseNo: '',
// 主单列表
masterList: '',
// 场站编号
endstation: '',
endstationList: '',
// 运输公司
agentno: '',
// 挂靠单位
agentname: '',
//申请单位
veProperty: '',
// 货物类型
cocode:'',
// 货物重量
remark: ''
},
}
},
methods: {
// 运单查询
getWaybillList(filters){
let businesstype = this.addForm.businesstype;
if (businesstype != undefined && businesstype != null && businesstype != ''){
this.$refs[filters].validate((valid) => {
if (valid) {
this.commonLoading = true;
if (businesstype == '进口提货'){
businesstype = 'I';
}else if (businesstype == '出口送货'){
businesstype = 'E';
}else if (businesstype == '分拨业务'){
businesstype = 'I';
}else if (businesstype == '调拨业务'){
businesstype = 'E';
}
let _this = this;
var url = "http://tjfx.15miaoo.com:8003/orig/orig";
var xhr = new XMLHttpRequest();
// 访问nginx中的代理服务器
xhr.open('get', url+'?waybill='+this.filters.waybill+'&imp='+businesstype, true);
xhr.send();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
if(xhr.status ==200){
var data = JSON.parse(xhr.responseText);
_this.awbaList=data;
//console.log(data);
_this.commonLoading = false;
}
}
}
} else {
console.log('error submit!!');
return false;
}
});
}else {
this.$message({
message: '请在下列选择业务类型',
type: "error"
})
}
},
// 获取场站
getYardList(){
yartList().then((res) =>{
this.options = res.data.data;
}).catch((error) => {
if(null!= error.response && error.response!==undefined){
let status= error.response.status;
let msg = error.response.statusText;
alert(status+msg);
}else {
alert(error);
}
});
},
// 校验车牌号是否合格
trailerFrameNo(value){
let params = {
'trailerFrameNo': value,
}
trailerFrameNoSuccess(params).then((res) =>{
if (res.data.code == 200){
this.$message({
message: res.data.msg,
type: "success"
})
this.addForm.agentno = res.data.data.coCode;
this.addForm.trailerLicenseNo = res.data.data.veTargetNo;
this.addForm.agentname = res.data.data.proposer;
this.disabledStr = false;
}else if(res.data.code == 201) {
this.$message({
message: res.data.msg,
type: "warning"
})
this.disabledStr = true;
}else if (res.data.code == 202){
this.$message({
message: res.data.msg,
type: "warning"
})
this.addForm.agentno = res.data.data.coCode;
this.addForm.trailerLicenseNo = res.data.data.veTargetNo;
this.addForm.agentname = res.data.data.proposer;
this.addForm.veProperty = res.data.data.veProperty;
this.disabledStr = true;
}
}).catch((error) => {
if(null!= error.response && error.response!==undefined){
let status= error.response.status;
let msg = error.response.statusText;
alert(status+msg);
}else {
alert(error);
}
});
},
// 日期格式转换
flightDate: function (row, column) {
// 获取单元格数据
let data = row.flightDate
if(data == null) {
return null
}
let dt = new Date(data)
return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate();
},
formatDate: function (row, column) {
// 获取单元格数据
let data = row.createdate;
if(data == null) {
return null
}
let dt = new Date(data)
return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate()+ ' ' + dt.getHours() + ':' + dt.getMinutes() + ':' + dt.getSeconds();
},
// 添加主单号到主单列表
addWaybill: function(index, row){
this.addForm.masterList += row.waybillnomaster+','
},
addweight(businesstype){
let _this = this;
let addweight = "";
// 运单重量累加
this.addForm.masterList=this.addForm.masterList.substring(0,this.addForm.masterList.length-1);
var split = this.addForm.masterList.split(",");
split.forEach((item) =>{
var url = "http://tjfx.15miaoo.com:8003/orig/orig";
var xhr = new XMLHttpRequest();
// 访问nginx中的代理服务器
xhr.open('get', url+'?waybill='+item+'&imp='+businesstype, true);
xhr.send();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
if(xhr.status ==200){
var data = JSON.parse(xhr.responseText);
data.forEach((itmeData => {
addweight += itmeData.manifesttotalweight+",";
}));
}
}
}
});
return addweight;
},
addsubmit(){
let para = Object.assign({}, _this.addForm);
save(para).then((res) => {
if (res.data.code == 200){
this.$message({
message: '提交成功',
type: 'success'
});
this.$refs['addForm'].resetFields();
}else {
this.$message({
message: '提交失败',
type: 'error'
});
}
}).catch(error => alert(error));
},
// 申请添加
saveSubmit (){
let _this = this;
this.$refs.addForm.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
let businesstype = this.addForm.businesstype;
if (businesstype == '进口提货'){
businesstype = 'I';
}else if (businesstype == '出口送货'){
businesstype = 'E';
}else if (businesstype == '分拨业务'){
businesstype = 'I';
}else if (businesstype == '调拨业务'){
businesstype = 'E';
}
if (this.addForm.masterList.indexOf(",") !== -1){
_this.addForm.remark = _this.addweight(businesstype);
_this.nextTick(function(){
_this.addsubmit();
});
}else {
console.log("进入远程调用");
let sum = 0;
var url = "http://tjfx.15miaoo.com:8003/orig/orig";
var xhr = new XMLHttpRequest();
// 访问nginx中的代理服务器
xhr.open('get', url+'?waybill='+this.addForm.masterList+'&imp='+businesstype, true);
xhr.send();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
if(xhr.status ==200){
var data = JSON.parse(xhr.responseText);
data.forEach((itme => {
_this.addForm.remark += parseInt(itme.manifesttotalweight);
}));
}
}
}
}
console.log(_this.addForm.remark);
console.log(_this.addForm);
}).catch(() =>{
});
} else {
console.log('error submit!!');
return false;
}
});
}
},
mounted() {
this.getYardList();
}
}
</script>
<style scoped>
/*.father{*/
/* position: relative;*/
/*}*/
/*.sun{*/
/* position: absolute;*/
/* top:-220px;*/
/* right:80px*/
/*}*/
</style>