ExitFlightDesc.vue
6.9 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
<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">
<el-date-picker
v-model="flight.flightdate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-col>
<el-col :span="4">
<el-input placeholder="必填" v-model="originstation">
<template slot="prepend">始发站</template>
</el-input>
</el-col>
<el-col :span="4" style="margin-left: 20px">
<el-input placeholder="必填" v-model="destinationstation">
<template slot="prepend">目的站</template>
</el-input>
</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";
export default {
name: 'ExitFlightDesc',
data() {
return {
flight: {
flightno: undefined,
flightdate: undefined,
originstation: undefined,
destinationstation: undefined,
awba: undefined,
messageType:undefined
},
btnStatus: true
};
},
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.flight.awba = this.$route.params.scopeRow.awba.replace('-','')
}
}
},
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 ==="MT5201"){
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("请将航班信息填写完整")
}
}
}
};
</script>
<style scoped>
.el-container {
text-align: center
}
.el-main {
margin: 0 auto;
height: 400px;
}
p {
font-size: 25px;
font-weight: bold;
}
</style>