审查视图

src/views/airtransport/flightplan.vue 14.4 KB
1 2 3 4 5 6 7 8 9 10
<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="100px" class="demo-ruleForm">
11 12
                    <el-col :span="24">
                        <div class="grid-content content">申报单位</div>
13
                    </el-col>
14 15
                    <el-row>
                        <el-col :span="6">
16 17
                            <el-form-item label="海关关区" prop="customcode" label-width="120px">
                                <el-input v-model="flight.customcode" @input="e => flight.customcode=inputMe(e)"></el-input>
18 19 20 21 22
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-col :span="24">
                        <div class="grid-content content">当日飞行计划备案信息</div>
23
                    </el-col>
24 25 26 27 28 29 30 31 32 33 34 35 36 37
                    <el-row>
                        <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="flightDate" label-width="140px">
                                <el-date-picker
                                        v-model="flight.flightDate"
                                        type="date"
                                        value-format="yyyyMMdd"
                                        format="yyyyMMdd"
                                        style="width:100%"
38 39
                                        placeholder="选择日期"
                                        :picker-options="pickerOptions">
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
                                </el-date-picker>
                            </el-form-item>
                        </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="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="arrivalPort" label-width="120px">
                                <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="arrivalCustomNo" label-width="140px">
                                <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="currentTakeoffTime" label-width="140px">
                                <el-date-picker
                                        v-model="flight.currentTakeoffTime"
                                        type="date"
                                        format="yyyyMMddHHmm"
                                        value-format="yyyyMMddHHmm"
                                        style="width:100%"
                                        placeholder="任意时间点">
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="计划抵港时间" prop="currentLandingTime" label-width="140px">
                                <el-date-picker
                                        v-model="flight.currentLandingTime"
                                        type="date"
                                        format="yyyyMMddHHmm"
                                        value-format="yyyyMMddHHmm"
                                        style="width:100%"
                                        placeholder="任意时间点">
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="执行任务类型" prop="linesType" label-width="120px">
                                <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-row>
                    <el-col :span="24">
                        <div class="grid-content content">备注信息</div>
102
                    </el-col>
103 104 105 106 107 108 109
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="备注" prop="meno" label-width="120px">
                                <el-input v-model="flight.meno"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
110 111 112 113
                </el-form>
            </el-row>
            <el-row style="margin-left: 120px">
                    <el-col :span="24">   <el-button type="primary" @click="submitForm('flight')">保 存</el-button>
小范 authored
114
                            <el-button type="success" @click="sendForm('flight')">保存并发送</el-button></el-col>
小范 authored
115 116 117 118 119 120 121 122 123 124 125 126 127 128
            </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>
129
            </el-row>
小范 authored
130 131 132 133 134 135 136 137 138 139 140 141 142 143
            <!--对话提示框-->
            <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>
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
        </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>
小范 authored
166
    const fecha = require('fecha');
小范 authored
167
    import {addFlightPlan, sendFlightPlan} from "../../api/transport";
168 169
    import loginUserInfo from '@/api/base.js'
170 171 172
    export default {
        data(){
            return{
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
                pickerOptions: {
                    disabledDate(time) {
                        return time.getTime() > Date.now();
                    },
                    shortcuts: [{
                        text: '今天',
                        onClick(picker) {
                            picker.$emit('pick', new Date());
                        }
                    }, {
                        text: '昨天',
                        onClick(picker) {
                            const date = new Date();
                            date.setTime(date.getTime() - 3600 * 1000 * 24);
                            picker.$emit('pick', date);
                        }
                    }, {
                        text: '明天',
                        onClick(picker) {
                            const date = new Date();
                            date.setTime(date.getTime() + 3600 * 1000 * 24);
                            picker.$emit('pick', date);
                        }
                    }]
                },
198
                flight:{
199
                    customcode:'4604',
200 201 202 203 204 205 206 207 208
                    flightNo:undefined,
                    flightDate:undefined,
                    departurePort:undefined,
                    departureCustomNo:undefined,
                    arrivalPort:undefined,
                    arrivalCustomNo:undefined,
                    currentTakeoffTime:undefined,
                    currentLandingTime:undefined,
                    linesType:'2',
209 210 211
                    meno:undefined,
                    createBy:loginUserInfo.username,
                    updateBy:''
212 213
                },
                rules:{
小范 authored
214 215 216 217 218 219 220 221 222 223
                    flightNo: [
                        {required: true, message: '请输入航班号', trigger: 'blur'}
                    ],
                    flightDate: [
                        {required: true, message: '请选择航班日期', trigger: 'blur'}
                    ],
                    departurePort: [
                        //{ min: 3, max: 3, message: '长度在3个字符', trigger: 'blur'},
                        {required: true, message: '请输入(三字码)', trigger: 'blur'},
                    ],
224 225 226
                    // departureCustomNo: [
                    //     {required: true, message: '请输入四位(数字)关区代码', trigger: 'blur'}
                    // ],
小范 authored
227 228 229
                    arrivalPort: [
                        {required: true, message: '请输入(三字码)', trigger: 'blur'},
                    ],
230 231 232
                    customcode: [
                        {required: true, message: '请输入四位(数字)关区代码', trigger: 'blur'}
                    ],
小范 authored
233 234 235 236 237 238 239 240 241
                    currentTakeoffTime: [
                        {required: true, message: '请选择日期', trigger: 'blur'}
                    ],
                    currentLandingTime: [
                        {required: true, message: '请选择日期', trigger: 'blur'}
                    ],
                    linesType: [
                        {required: true, message: '请选择', trigger: 'blur'}
                    ],
242 243 244 245 246 247
                },
                linesTypes:[
                    {value:'',label:'请选择'},
                    {value:'1',label:'客运'},
                    {value:'2',label:'货运'}
                ],
小范 authored
248 249
                centerDialogVisible:false,
                msg:undefined
250 251
            }
        },
小范 authored
252
        methods:{
小范 authored
253
            //新增当日飞行计划(保存按钮)
小范 authored
254 255 256 257 258 259 260 261
            submitForm(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        addFlightPlan(this.flight).then(res=>{
                            let response=res.data;
                            if(response.code=='200'){
                                this.centerDialogVisible=true;
                                this.msg=response.msg;
xudada authored
262
                                this.$router.push({path:'/queryFlightplan',query:{flightNo:this.flight.flightNo,flightDate:this.flight.flightDate,aircraftNo:this.flight.aircraftNo}});
小范 authored
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
                            }else{
                                this.msg=response.msg;
                            }
                        });
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
            //保存并发送
            sendForm(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        sendFlightPlan(this.flight).then(res=>{
                            let response=res.data;
                            if(response.code=='200'){
                                this.centerDialogVisible=true;
                                this.msg=response.msg;
                                this.$router.push({path:'/queryFlightplan',query:{flightNo:this.flight.flightNo,flightDate:this.flight.flightDate,aircraftNo:this.flight.aircraftNo}});
小范 authored
283 284 285 286 287 288 289 290 291 292
                            }else{
                                this.msg=response.msg;
                            }
                        });
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
小范 authored
293 294
            //加载默认值
            defaultData(){
xudada authored
295
                if(this.$route.query.uuid!=null){
小范 authored
296
                   Object.assign(this.flight, this.$route.query);
xudada authored
297 298
                    /*this.flight.currentLandingTime=fecha.parse(ob.currentLandingTime,'yyyyMMddHHmm');
                    this.flight.currentTakeoffTime=fecha.parse(ob.currentTakeoffTime,'yyyyMMddHHmm');*/
小范 authored
299 300
                }
            },
小范 authored
301 302 303 304
            // 过滤中英文
            inputMe(e){
                return e.replace(/[^a-zA-Z0-9.-]/g,'').toUpperCase();
            },
小范 authored
305
        },
小范 authored
306
小范 authored
307 308 309
        mounted(){
            this.defaultData();
        }
310 311
    }
</script>