审查视图

src/views/airtransport/outConfigure.vue 5.4 KB
小范 authored
1 2 3 4 5 6 7 8 9 10 11 12
<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="outConfigure" :rules="rules" ref="outConfigure" label-width="100%" class="demo-ruleForm">
                    <el-col :span="8">
                        <el-form-item label="航班号" prop="flightNo" label-width="120px">
小范 authored
13
                            <el-input v-model="outConfigure.flightNo" @input="e => outConfigure.flightNo=inputMe(e)"></el-input>
小范 authored
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="进出标识" prop="ietype" label-width="120px">
                            <el-select v-model="outConfigure.ietype" 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="24">
                        <el-form-item label="备注" prop="reamrk" label-width="120px">
                            <el-input v-model="outConfigure.reamrk"></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('outConfigure')">保 存</el-button>
                </el-col>
            </el-row>
小范 authored
35 36 37 38 39 40 41 42 43 44 45 46 47 48
            <!--对话提示框-->
            <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>
小范 authored
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
        </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
71
    import {addSchedule} from "../../api/transport";
72 73
    import loginUserInfo from '../../api/base'
小范 authored
74
小范 authored
75 76 77 78
    export default {
        data(){
            return{
                outConfigure:{
79
                    username:loginUserInfo.username,
小范 authored
80
                    flightNo:undefined,
81
                    ietype:'1',
小范 authored
82
                    reamrk:undefined,
83
                    // accessFlag:'2',
84 85
                    createBy:loginUserInfo.username,
                    updateBy:loginUserInfo.username,
小范 authored
86 87 88 89 90 91
                },
                rules: {
                    flightNo: [
                        {required: true, message: '请输入', trigger: 'blur'}
                    ],
                    ietype: [
小范 authored
92
                        {required: true, message: '请选择', trigger: 'change'}
小范 authored
93 94 95 96 97 98 99
                    ],
                },
                linesTypes:[
                    {value:'',label:'请选择'},
                    {value:'1',label:'进港'},
                    {value:'2',label:'出港'}
                ],
小范 authored
100 101 102
                tableData:[],
                msg:undefined,
                centerDialogVisible:false,
小范 authored
103 104 105
            }
        },
        methods:{
小范 authored
106
            //新增出港确报申报(保存按钮)
小范 authored
107 108 109
            submitForm(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
110 111 112
                        this.outConfigure.createBy=loginUserInfo.username
                        this.outConfigure.username=loginUserInfo.username
小范 authored
113 114 115 116 117 118 119 120 121 122
                        addSchedule(this.outConfigure).then(res=>{
                            let response=res.data;
                            if(response.code=='200'){
                                this.centerDialogVisible=true;
                                this.msg=response.msg;
                                this.$router.push({path:'/queryFlightConfigure',query:{flightNo:this.outConfigure.flightNo}});
                            }else{
                                this.msg=response.msg;
                            }
                        });
小范 authored
123 124 125 126 127 128
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
小范 authored
129 130 131
            //加载默认值
            defaultData(){
                if(this.$route.query!=null){
小范 authored
132
                    Object.assign(this.outConfigure, this.$route.query);
小范 authored
133
                }
小范 authored
134
            },
小范 authored
135 136 137 138
            // 过滤中英文
            inputMe(e){
                return e.replace(/[^a-zA-Z0-9.-]/g,'').toUpperCase();
            }
小范 authored
139 140 141
        },
        mounted(){
            this.defaultData();
小范 authored
142 143
        }
    }
小范 authored
144
</script>