审查视图

src/views/airtransport/configure.vue 6.8 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="configure" :rules="rules" ref="configure" 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="configure.flightNo"  @input="e => configure.flightNo=inputMe(e)"></el-input>
小范 authored
14 15 16 17 18 19 20 21 22 23
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="进出标识" prop="ietype" label-width="120px">
                            <el-select v-model="configure.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>
24 25 26 27 28 29 30 31 32 33
<!--                    <el-col :span="8">-->
<!--                        <el-form-item label="国籍" prop="country" label-width="120px">-->
<!--                            <Nationality v-on:tellFarther="fromCountry"></Nationality>-->
<!--                        </el-form-item>-->
<!--                    </el-col>-->
<!--                    <el-col :span="8">-->
<!--                        <el-form-item label="证件" prop="certType" label-width="120px">-->
<!--                            <Document v-on:tellFa="fromDocument"></Document>-->
<!--                        </el-form-item>-->
<!--                    </el-col>-->
小范 authored
34 35 36 37 38 39 40 41
                    <el-col :span="24">
                        <el-form-item label="备注" prop="reamrk" label-width="120px">
                            <el-input v-model="configure.reamrk"></el-input>
                        </el-form-item>
                    </el-col>
                </el-form>
            </el-row>
            <el-row style="margin-left: 120px">
小范 authored
42
                <el-col :span="24">   <el-button type="primary" @click="submitForm('configure')">保 存</el-button>
小范 authored
43 44
                </el-col>
            </el-row>
小范 authored
45 46 47 48 49 50 51 52 53 54 55 56 57 58
            <!--对话提示框-->
            <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
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
        </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
81
    import { addSchedule} from "../../api/transport";
82 83 84
    import loginUserInfo from '../../api/base';
    import Nationality from './Nationality'
    import Document from './Document'
85
小范 authored
86
    export default {
87 88
        components: { Nationality, Document },
小范 authored
89 90
        data(){
            return{
91 92
                //国籍数据
                // countryOptions:[],
小范 authored
93
                configure:{
94
                    username:loginUserInfo.username,
小范 authored
95
                    flightNo:undefined,
96
                    ietype:'0',
小范 authored
97
                    reamrk:undefined,
98 99 100
                    // accessFlag:'1',
                    country:'',
                    certType:'',
101 102
                    createBy:loginUserInfo.username,
                    updateBy:loginUserInfo.username,
小范 authored
103
                },
小范 authored
104
                LoginUserInfo: loginUserInfo,
小范 authored
105 106 107 108 109 110 111 112 113 114 115 116 117
                rules: {
                    flightNo: [
                        {required: true, message: '请输入', trigger: 'blur'}
                    ],
                    ietype: [
                        {required: true, message: '请输入', trigger: 'change'}
                    ],
                },
                linesTypes:[
                    {value:'',label:'请选择'},
                    {value:'1',label:'进港'},
                    {value:'2',label:'出港'}
                ],
小范 authored
118 119 120
                tableData:[],
                msg:undefined,
                centerDialogVisible:false,
小范 authored
121 122 123
            }
        },
        methods:{
124 125 126 127 128 129 130 131 132 133
            //从子组件获取国籍数据
            fromCountry:function(val){
                console.log("来自子组件的值:"+val)
                this.configure.country = val;
            },
            //从子组件获取证件数据
            fromDocument:function(val){
                console.log("来自子组件的值:"+val)
                this.configure.certType = val;
            },
小范 authored
134
            //新增进港确报申报(保存按钮)
小范 authored
135
            submitForm(formName) {
小范 authored
136
                let _this = this;
小范 authored
137 138
                this.$refs[formName].validate((valid) => {
                    if (valid) {
139 140
                        this.configure.createBy=loginUserInfo.username
                        this.configure.username=loginUserInfo.username
小范 authored
141
                        console.log(this.configure.flightNo)
小范 authored
142 143
                        addSchedule(this.configure).then(res=>{
                            let response=res.data;
小范 authored
144
                            console.log(response)
小范 authored
145 146 147
                            if(response.code=='200'){
                                this.centerDialogVisible=true;
                                this.msg=response.msg;
小范 authored
148
                                this.$router.push({path:'/queryConfigure',query:{flightNo:this.configure.flightNo}});
小范 authored
149 150 151 152
                            }else{
                                this.msg=response.msg;
                            }
                        });
小范 authored
153 154 155 156 157 158
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
小范 authored
159 160 161
            //加载默认值
            defaultData(){
                if(this.$route.query!=null){
小范 authored
162
                    Object.assign(this.configure, this.$route.query);
小范 authored
163
                }
小范 authored
164
            },
小范 authored
165 166 167 168
            // 过滤中英文
            inputMe(e){
                return e.replace(/[^a-zA-Z0-9.-]/g,'').toUpperCase();
            }
小范 authored
169 170 171
        },
        mounted(){
            this.defaultData();
小范 authored
172 173
        }
    }
小范 authored
174
</script>