ExitFlightDesc.vue
9.7 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
<template>
<el-container>
<el-main>
<el-row>
<el-col :span="24">
<div class="grid-content"><p>请输入航班信息:</p></div>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="grid-content"><h1>Please Enter The Flight Information:</h1></div>
</el-col>
</el-row>
<el-row type="flex" class="row-bg" justify="center">
<el-col :span="4" >
<el-input placeholder="必填" v-model="flightno">
<template slot="prepend">航班号</template>
</el-input>
</el-col>
<el-col :span="4" style="margin-left: 20px">
<el-date-picker
v-model="flight.flightdate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-col>
<el-col :span="4" style="margin-left: 55px">
<el-select
:remote-method="remoteMethodAirport"
:loading="listLoading"
v-model="originstation"
allow-create
default-first-option
filterable
remote
placeholder="请选择起始站" clearable>
<el-option
v-for="item in airportCode"
:key="item.airportid"
:label="item.airportid"
:value="item.airportid">
<span style="float: left">{{ item.airportdescchn }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.airportid }}</span>
</el-option>
</el-select>
</el-col>
<el-col :span="4" style="margin-left: 20px">
<el-select
:remote-method="remoteMethodAirport"
:loading="listLoading"
v-model="destinationstation"
allow-create
default-first-option
filterable
remote
placeholder="请选择目的站" clearable>
<el-option
v-for="item in airportCode"
:key="item.airportid"
:label="item.airportid"
:value="item.airportid">
<span style="float: left">{{ item.airportdescchn }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.airportid }}</span>
</el-option>
</el-select>
</el-col>
<!-- <el-col :span="4" style="margin-left: 20px">-->
<!-- <el-input placeholder="可为空" v-model="awba">-->
<!-- <template slot="prepend">主单号</template>-->
<!-- </el-input>-->
<!-- </el-col>-->
</el-row>
<el-row>
<el-col :span="4" :offset="10">
<div class="grid-content">
<el-button type="primary" @click="nstep">下一步</el-button>
</div>
</el-col>
</el-row>
</el-main>
</el-container>
</template>
<script>
import {Message} from "element-ui";
import {getCountry, getAirportCode} from "@/api/country";
export default {
name: 'ExitFlightDesc',
data() {
return {
flight: {
flightno: undefined,
flightdate: undefined,
originstation: undefined,
destinationstation: undefined,
awba: undefined,
messageType: undefined
},
btnStatus: true,
listLoading: false,
airportList: [],
airportResultCode: [],
airportCode: [],
};
},
created() {
if (this.$route.params.scopeRow !== undefined) {
if (this.$route.params.scopeRow.carrier === undefined) {
this.flight.flightno = this.$route.params.scopeRow.flightno
} else {
this.flight.flightno = this.$route.params.scopeRow.carrier + this.$route.params.scopeRow.flightno
}
this.flight.flightdate = this.$route.params.scopeRow.flightdate
this.flight.originstation = this.$route.params.scopeRow.originstation
this.flight.destinationstation = this.$route.params.scopeRow.destinationstation
this.flight.messageType = this.$route.params.scopeRow.messageType
if (this.$route.params.scopeRow.awba !== undefined && this.$route.params.scopeRow.awba != null) {
this.flight.awba = this.$route.params.scopeRow.awba.replace('-', '')
}
}
},
// mounted() {
// // 延迟加载,否则会出错
// setTimeout(() => {
// this.airportResultCode = this.airportCode.map(item =>{
// return {label: item.airportdescchn,value: item.airportid}
// })
// }, 6000)
// },
computed: {
flightno: {
get: function () {
return this.flight.flightno
},
set: function (val) {
this.flight.flightno = val.toUpperCase().trim()
}
},
originstation: {
get: function () {
return this.flight.originstation
},
set: function (val) {
this.flight.originstation = val.toUpperCase().trim()
}
},
destinationstation: {
get: function () {
return this.flight.destinationstation
},
set: function (val) {
this.flight.destinationstation = val.toUpperCase().trim()
}
},
awba: {
get: function () {
return this.flight.awba
},
set: function (val) {
this.flight.awba = val.trim()
}
}
},
methods: {
nstep() {
if (this.flight.flightno !== undefined && this.flight.flightno !== '' &&
this.flight.flightdate !== undefined && this.flight.flightdate !== '' &&
this.flight.destinationstation !== undefined && this.flight.destinationstation !== '' &&
this.flight.originstation !== undefined && this.flight.originstation !== '') {
if (this.flight.awba !== '' && this.flight.awba !== undefined) {
const manifest = this.flight.awba;
const reg = /^[0-9]{11}$/
if (!reg.test(manifest)) {
Message.error("主单号只支持数字并且最多11位")
return
}
const num = (manifest.substring(3, 10)) % 7
if (num !== eval(manifest.substring(10))) {
Message.error("主单号不符合模7校验")
return
}
} else {
this.flight.awba = undefined
}
if (this.flight.messageType === "MT5202") {
this.$router.push({name: '出港理货', params: {flightData: this.flight}});
}
if (this.flight.messageType === "MT4201") {
this.$router.push({name: '出港装载', params: {flightData: this.flight}});
}
if (this.flight.messageType === "MT3201") {
this.$router.push({name: '出港运抵', params: {flightData: this.flight}})
}
if (this.flight.messageType === "MT2201") {
this.$router.push({name: '出港预配舱单', params: {flightData: this.flight}})
}
} else {
Message.warning("请将航班信息填写完整")
}
},
remoteMethodAirport(query) {
this.airportCode = []
if (query !== '') {
this.listLoading = true
getAirportCode({airportid: query}).then(res => {
if(res !== null){
setTimeout(() => {
this.listLoading = false
this.airportCode = res.data.data
}, 200)
}
})
} else {
this.airportCode = []
}
}
}
};
</script>
<style scoped>
.el-container {
text-align: center
}
.el-main {
margin: 0 auto;
height: 400px;
}
flight
p {
font-size: 25px;
font-weight: bold;
}
</style>