flight.vue 24.2 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 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
<template>
    <el-container>
        <el-main>
            <el-row class="row-bg">
                <el-col :span="24">
                    <div class="grid-content content">航班备案</div>
                </el-col>
            </el-row>
            <el-row>
                <el-form :model="flight" :rules="rules" ref="flight" label-width="130px" class="demo-ruleForm">
                    <el-col :span="24">
                        <div class="grid-content content">申报单位</div>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="海关关区" prop="airwayCode" label-width="140px">
                            <el-input v-model="flight.airwayCode" @input="e => flight.airwayCode=inputMe(e)"></el-input>
                        </el-form-item>
                    </el-col><el-col :span="24">
                    <div class="grid-content content">航班信息</div>
                </el-col>
                    <el-col :span="6">
                        <el-form-item label="运营企业海关编码" prop="airwayCode" label-width="140px">
                            <el-input v-model="flight.airwayCode" @input="e => flight.airwayCode=inputMe(e)"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="航班号" prop="flightNo" label-width="120px">
                            <el-input v-model="flight.flightNo" @input="e => flight.flightNo=inputMe(e)"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="航空器传输代理人代码" prop="transportAgentCode" label-width="170px">
                            <el-input v-model="flight.transportAgentCode"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="航空器地面代理人代码" prop="groundAgentCode" label-width="170px">
                            <el-input v-model="flight.groundAgentCode"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="航空公司英文名称" prop="airwayNameEn" label-width="140px">
                            <el-input v-model="flight.airwayNameEn"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="航空公司中文名称" prop="airwayNameCn" label-width="170px">
                            <el-input v-model="flight.airwayNameCn"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="执行任务类型" prop="linesType" label-width="140px">
                            <el-select v-model="flight.linesType" placeholder="" style="display:inline">
                                <el-option v-for="item in linesTypes" :key="item.value" :label="item.label"
                                           :value="item.value"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="航班性质" prop="flightType" label-width="130px">
                            <el-select v-model="flight.flightType" placeholder="" style="display:inline">
                                <el-option v-for="item in flightTypes" :key="item.value" :label="item.label"
                                           :value="item.value"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="共享航班号" prop="shareFlightNo" label-width="170px">
                            <el-input v-model="flight.shareFlightNo" @input="e => flight.shareFlightNo=inputMe(e)"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <div class="grid-content content">备注信息</div>
                    </el-col>
                    <el-col :span="18">
                        <el-form-item label="备注" prop="remark" label-width="120px">
                            <el-input v-model="flight.remark"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24" style="margin-bottom: 20px">
                        <div class="grid-content content">航线信息<el-button type="primary" size="mini" @click="selectAirline()" style="margin-left:50px">航线信息查询</el-button></div>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="出发港" prop="departurePort" label-width="140px">
                            <el-input v-model="flight.departurePort" @input="e => flight.departurePort=inputMe(e)"
                                      maxLength='3' ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="目的港" prop="arrivalPort" label-width="130px">
                            <el-input v-model="flight.arrivalPort" @input="e => flight.arrivalPort=inputMe(e)"
                                      maxLength='3'></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="长期离港时间" prop="std" label-width="120px">
                            <el-time-picker
                                    v-model="flight.std"
                                    :picker-options="{
                                    selectableRange: '00:00:00 - 23:59:59'
                                    }"
                                    format="HHmmss"
                                    style="width:100%"
                                    placeholder="任意时间点">
                            </el-time-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="长期抵港时间" prop="sta" label-width="120px">
                            <el-time-picker
                                    v-model="flight.sta"
                                    :picker-options="{
                                    selectableRange: '00:00:00 - 23:59:59'
                                    }"
                                    format="HHmmss"
                                    style="width:100%"
                                    placeholder="任意时间点">
                            </el-time-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="有效期起始时间" prop="effStartdate" label-width="140px">
                            <el-date-picker
                                    v-model="flight.effStartdate"
                                    type="date"
                                    value-format="yyyyMMdd"
                                    format="yyyyMMdd"
                                    style="width:100%"
                                    placeholder="选择日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="有效期结束时间" prop="effEnddate" label-width="130px">
                            <el-date-picker
                                    v-model="flight.effEnddate"
                                    type="date"
                                    value-format="yyyyMMdd"
                                    format="yyyyMMdd"
                                    style="width:100%"
                                    placeholder="选择日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="每周执行情况" prop="plan" label-width="140px">
                            <el-input v-model="flight.plan"></el-input>
                        </el-form-item>
                    </el-col>



                    <el-col :span="6">
                        <el-form-item label="出发港关区代码" prop="departureCustomNo" label-width="140px">
                            <el-input v-model="flight.departureCustomNo" oninput="value=value.replace(/[^\d]/g,'')"
                                      maxLength='4'></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="目的港关区代码" prop="arrivalCustomNo" label-width="130px">
                            <el-input v-model="flight.arrivalCustomNo" oninput="value=value.replace(/[^\d]/g,'')"
                                      maxLength='4'></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="备注" prop="remark" label-width="120px">
                            <el-input v-model="flight.remark"></el-input>
                        </el-form-item>
                    </el-col>
                </el-form>
            </el-row>
            <el-row style="margin-left: 120px">
                <el-col :span="24">   <el-button type="primary" @click="submitForm('flight')">保 存</el-button>
                    <el-button type="success"  @click="sendForm('flight')">保存并发送</el-button></el-col>
            </el-row>
            <el-row>
                <el-dialog title="航线信息" :visible.sync="dialogTableVisible" width="90%">
                    <el-table
                    :data="tableData"
                    v-loading="tableloading"
                    border
                    style="width: 100%;margin-bottom: 10px">
                    <el-table-column
                            fixed="left"
                            label="操作"
                            width="100">
                        <template slot-scope="scope">
                            <el-button
                                    size="mini"
                                    type="primary"
                                    @click="handleEdit(scope.$index, scope.row)">选择</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column
                            prop="serialNo"
                            label="航线序号">
                    </el-table-column>
                    <el-table-column
                            prop="departurePort"
                            label="出发港">
                    </el-table-column>
                    <el-table-column
                            prop="departureCustomNo"
                            label="出发港关区代码">
                    </el-table-column>
                    <el-table-column
                            prop="arrivalPort"
                            label="目的港">
                    </el-table-column>
                    <el-table-column
                            prop="arrivalCustomNo"
                            label="目的港关区代码">
                    </el-table-column>
                    <el-table-column
                            prop="std"
                            label="长期离港时间">
                    </el-table-column>
                    <el-table-column
                            prop="sta"
                            label="长期抵港时间">
                    </el-table-column>
                        <el-table-column
                                prop="effStartdate"
                                label="有效期起始时间">
                        </el-table-column>
                        <el-table-column
                                prop="effEnddate"
                                label="有效期结束时间">
                        </el-table-column>
                        <el-table-column
                                prop="plan"
                                label="每周执行情况">
                        </el-table-column>
                        <el-table-column
                                prop="remark"
                                label="备注">
                        </el-table-column>
                    </el-table>
                    <el-row>
                        <div class="block">
                            <el-pagination
                                    @size-change="handleSizeChange"
                                    @current-change="handleCurrentChange"
                                    :current-page="currentPage"
                                    :page-sizes="[10, 20, 30, 40]"
                                    :page-size="pageSize"
                                    layout="total, sizes, prev, pager, next, jumper"
                                    :total="total">
                            </el-pagination>
                        </div>
                    </el-row>
                </el-dialog>
            </el-row>
            <el-row>
                <el-dialog
                        title="系统提示"
                        :visible.sync="centerDialogVisible"
                        width="30%"
                        center>
                    <span>{{msg}}</span>
                    <span slot="footer" class="dialog-footer">
                          <el-button @click="centerDialogVisible = false">取 消</el-button>
                        <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
                      </span>
                </el-dialog>
            </el-row>
        </el-main>
    </el-container>
</template>
<style scoped>
    .grid-content {
        height: 36px;
        line-height: 36px;
    }
    .el-dialog__body{text-align: center}
    .content {
        border-left: 4px #409EFF solid;
        padding-left: 10px;
        background-color: #f9fafc;
        margin-bottom: 2px
    }

    .row-bg{
        background-color: white;
    }
    .el-col{margin-right: 0px;}
</style>
<script>
    import {addFlight, selectRoute, sendFlight} from "../../api/transport";
    const fecha = require('fecha');
    import loginUserInfo from '../../api/base';
    export default {
        data(){
            return{
                flight:{
                    uuid:undefined,
                    airwayCode:undefined,
                    airwayNameEn:undefined,
                    airwayNameCn:undefined,
                    transportAgentCode:undefined,
                    groundAgentCode:undefined,
                    flightNo:undefined,
                    shareFlightNo:undefined,
                    linesType:'',
                    flightType:'',
                    cancelFlag:undefined,
                    departurePort:undefined,
                    arrivalPort:undefined,
                    departureCustomNo:undefined,
                    arrivalCustomNo:undefined,
                    std:undefined,
                    sta:undefined,
                    effStartdate:undefined,
                    effEnddate:undefined,
                    plan:undefined,
                    remark:undefined,
                    createTime:undefined,
                    createBy:undefined,
                    updateTime:undefined,
                    updateBy:undefined,
                    isDelete:undefined,
                    serialno:undefined,
                    status:undefined,
                    statusMsg:undefined,
                    messageid:undefined
                },
                rules: {
                    flightNo: [
                        {required: true, message: '请输入航班号', trigger: 'blur'}
                    ],
                    airwayCode: [
                        {required: true, message: '请输入', trigger: 'blur'}
                    ],
                    airwayNameEn: [
                        {required: true, message: '请输入', trigger: 'blur'}
                    ],
                    // airwayNameCn: [
                    //     {required: true, message: '请输入', trigger: 'blur'}
                    // ],
                    transportAgentCode: [
                        {required: true, message: '请输入', trigger: 'blur'}
                    ],
                    groundAgentCode: [
                        {required: true, message: '请输入', trigger: 'blur'}
                    ],
                    linesType: [
                        {required: true, message: '请输入', trigger: 'blur'}
                    ],
                    flightType: [
                        {required: true, message: '请输入', trigger: 'blur'}
                    ],
                    shareFlightNo: [
                        {required: true, message: '请输入', trigger: 'blur'}
                    ],
                    departurePort: [
                        //{ min: 3, max: 3, message: '长度在3个字符', trigger: 'blur'},
                        {required: true, message: '请输入(三字码)', trigger: 'blur'},
                    ],
                    // departureCustomNo: [
                    //     {required: true, message: '请输入四位(数字)关区代码', trigger: 'blur'}
                    // ],
                    arrivalPort: [
                        {required: true, message: '请输入(三字码)', trigger: 'blur'},
                    ],
                    // arrivalCustomNo: [
                    //     {required: true, message: '请输入四位(数字)关区代码', trigger: 'blur'}
                    // ],
                    plan: [
                        {required: true, message: '请输入', trigger: 'blur'},
                    ],
                    std: [
                        {required: true, message: '请选择时间', trigger: 'blur'}
                    ],
                    sta: [
                        {required: true, message: '请选择时间', trigger: 'blur'},
                    ],
                    effStartdate: [
                        {required: true, message: '请选择时间', trigger: 'blur'}
                    ],
                    effEnddate:[
                        {required: true, message: '请选择时间', trigger: 'blur'}
                    ]

                },
                airLine:{
                    createBy:loginUserInfo.username,
                    serialno:''
                },
                flightTypes:[
                    {value:'',label:'请选择'},
                    {value:'1',label:'来自关境外'},
                    {value:'2',label:'驶往关境外'},
                    {value:'3',label:'来自关境内'},
                    {value:'4',label:'驶往关境内'},
                    {value:'5',label:'国际转国际'}
                    ],
                linesTypes:[
                    {value:'',label:'请选择'},
                    {value:'1',label:'客运'},
                    {value:'2',label:'货运'},
                    {value:'3',label:'客货运'},
                    {value:'4',label:'公务机'},
                    {value:'5',label:'救援飞机'},
                    {value:'6',label:'专机'},
                    {value:'7',label:'客包机'},
                    {value:'8',label:'货包机'}
                ],
                dialogTableVisible:false,
                centerDialogVisible:false,
                currentPage: 1,
                pageSize:10,
                total:0,
                msg:undefined,
                tableData: [],
                tableloading:true,
            }
        },
        methods:{
            //航线信息查询
            selectAirline(){
                let params={currentPage:this.currentPage,pageSize:this.pageSize,aircraftNo:this.flight.aircraftNo,flightNo:this.flight.flightNo};
                this.dialogTableVisible=true;
                this.tableloading=true;
                selectRoute(params).then(res=>{
                    let response=res.data.data;
                    this.tableData=response.list;
                    this.tableloading=false;
                    this.total=response.total;
                });
            },
            //新增航班方法(保存按钮)
            submitForm(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        addFlight(this.flight).then(res=>{
                            let response=res.data;
                            if(response.code=='200'){
                                //this.centerDialogVisible=true;
                                //this.msg=response.msg;
                                this.$router.push({path:'/queryFlights',query:{flightNo:this.flight.flightNo,flightDate:this.flight.flightDate}});
                                //this.centerDialogVisible=false;
                                this.$message.success(response.msg)
                            }else{
                                //this.centerDialogVisible=true;
                                //this.msg=response.msg;
                                this.$message.error(response.msg)
                            }
                        });
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
            //新增航班方法(保存并发送按钮)
            sendForm(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        sendFlight(this.flight).then(res=>{
                            let response=res.data;
                            if(response.code=='200'){
                                //this.centerDialogVisible=true;
                                //this.msg=response.msg;
                                this.$router.push({path:'/queryFlights',query:{flightNo:this.flight.flightNo,flightDate:this.flight.flightDate}});
                                //this.centerDialogVisible=false;
                                this.$message.success(response.msg)
                            }else{
                                //this.centerDialogVisible=true;
                                //this.msg=response.msg;
                                this.$message.error(response.msg)
                            }
                        });
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
            //分页方法
            handleSizeChange(val) {
                this.pageSize=val;
            },
            handleCurrentChange(val) {
                this.currentPage=val;
                this.submitForm();
            },
            //航线信息查询选择功能
            handleEdit(index,row){
                this.flight.std=fecha.parse(row.std,'HHmmss');
                this.flight.sta=fecha.parse(row.sta,'HHmmss');
                this.flight.effStartdate=row.effStartdate;
                this.flight.effEnddate=row.effEnddate;
                this.flight.departurePort=row.departurePort;
                this.flight.arrivalPort=row.arrivalPort;
                this.flight.departureCustomNo=row.departureCustomNo;
                this.flight.arrivalCustomNo=row.arrivalCustomNo;
                this.flight.plan=row.plan;
                this.dialogTableVisible=false;
            },
            //加载默认值
            defaultData(){
                if(this.$route.query!=null){
                    Object.assign(this.flight, this.$route.query);
                }
            },
            // 过滤中英文
            inputMe(e){
                return e.replace(/[^a-zA-Z0-9.-]/g,'').toUpperCase();
            }
        },
        //渲染方法
        activated(){
            this.defaultData();
        }
    }
</script>