审查视图

src/views/airtransport/route.vue 15.4 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
<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="airline" :rules="rules" ref="airline" label-width="100px" class="demo-ruleForm">
                    <el-col :span="6">
                            <el-form-item label="出发港" prop="departurePort" label-width="120px">
                                <el-input v-model="airline.departurePort"></el-input>
                            </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="出发港关区" prop="departureCustomNo" label-width="120px">
                            <el-input v-model="airline.departureCustomNo"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="目的港" prop="arrivalPort" label-width="120px">
                            <el-input v-model="airline.arrivalPort"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="目的港关区" prop="arrivalCustomNo" label-width="120px">
                            <el-input v-model="airline.arrivalCustomNo"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="航线序号" prop="serialNo" label-width="120px">
                            <el-input v-model="airline.serialNo"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="备注内容" prop="meno" label-width="120px">
                            <el-input type="textarea" :rows="5" v-model="airline.meno"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24" style="margin-bottom: 20px">
                            <el-col :span="24">
                                <div class="grid-content content">长期飞行计划<el-button type="primary" size="mini" @click="dialogTableVisible = true" style="margin-left:25px">长期飞行计划查询</el-button></div>
                            </el-col>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="每周执行情况" prop="plan" label-width="120px">
                            <el-input v-model="airline.plan"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="长期离港时间" prop="std" label-width="120px">
                            <el-time-picker
                                    v-model="airline.std"
                                    :picker-options="{
                                    selectableRange: '00:00:00 - 23:59:59'
                                    }"
xudada authored
58
                                    format="HHmmss"
59 60 61 62 63 64 65 66 67 68 69 70
                                    style="width:100%"
                                    placeholder="任意时间点">
                            </el-time-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="长期抵港时间" prop="sta" label-width="120px">
                            <el-time-picker
                                    v-model="airline.sta"
                                    :picker-options="{
                                    selectableRange: '00:00:00 - 23:59:59'
                                    }"
xudada authored
71
                                    format="HHmmss"
72 73 74 75 76 77 78 79 80 81
                                    style="width:100%"
                                    placeholder="任意时间点">
                            </el-time-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="有效起始时间" prop="effStartdate" label-width="120px">
                            <el-date-picker
                                    v-model="airline.effStartdate"
                                    type="date"
xudada authored
82 83
                                    value-format="yyyyMMdd"
                                    format="yyyyMMdd"
84 85 86 87 88 89 90 91 92 93
                                    style="width:100%"
                                    placeholder="选择日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="有效结束时间" prop="effEnddate" label-width="120px">
                            <el-date-picker
                                    v-model="airline.effEnddate"
                                    type="date"
xudada authored
94 95
                                    value-format="yyyyMMdd"
                                    format="yyyyMMdd"
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
                                    style="width:100%"
                                    placeholder="选择日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="备注" prop="remark" label-width="120px">
                            <el-input v-model="airline.remark"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" style="margin-left: 120px">
                        <el-button type="primary" @click="submitForm('airline')">保 存</el-button>
                        <el-button type="success">保存并发送</el-button>
                    </el-col>
                </el-form>
            </el-row>
            <el-row>
                    <el-dialog title="长期飞行计划" :visible.sync="dialogTableVisible">
                        <el-table
                                :data="tableData"
                                border
                                style="width: 100%;margin-bottom: 10px">
                            <el-table-column
                                    fixed="left"
                                    label="选择"
                                    width="150">
                                <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
                                    fixed
                                    prop="std"
                                    label="长期离港时间"
                                    width="150">
                            </el-table-column>
                            <el-table-column
                                    fixed
                                    prop="sta"
                                    label="长期抵港时间"
                                    width="150">
                            </el-table-column>
                            <el-table-column
                                    fixed
                                    prop="effStartdate"
                                    label="有效起始日期"
                                    width="180">
                            </el-table-column>
                            <el-table-column
                                    fixed
                                    prop="effEnddate"
                                    label="有效结束日期"
                                    width="180">
                            </el-table-column>
                        </el-table>
                        <el-pagination
                                @size-change="handleSizeChange"
                                @current-change="handleCurrentChange"
                                :current-page="currentPage4"
                                :page-sizes="[10, 20, 30, 40]"
                                :page-size="100"
                                layout="total, sizes, prev, pager, next, jumper"
                                :total="100">
                        </el-pagination>
                    </el-dialog>
            </el-row>
xudada authored
165 166 167 168 169 170 171 172 173 174 175 176 177 178
            <!--对话提示框-->
            <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>
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
        </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>
xudada authored
201 202

    const fecha = require('fecha');
xudada authored
203
    import {addRoute} from '../../api/transport'
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
    export default {
        data(){
          return{
              airline:{
                  uuid:undefined,
                  serialNo:undefined,
                  departurePort:undefined,
                  arrivalPort:undefined,
                  departureCustomNo:undefined,
                  arrivalCustomNo:undefined,
                  cancelFlag:undefined,
                  meno:undefined,
                  planno:undefined,
                  std:undefined,
                  sta:undefined,
                  effStartdate:undefined,
                  effEnddate:undefined,
                  plan:undefined,
                  remark:undefined,
                  createTime:undefined,
                  createBy:undefined,
                  updateTime:undefined,
                  updateBy:undefined,
xudada authored
227
                  isDelete:undefined,
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
              },
              rules: {
                  departurePort: [
                      {required: true, message: '请输入(三字码)', trigger: 'blur'},
                      {min: 3, max: 3, message: '长度在 3 个字符', trigger: 'blur'}
                  ],
                  departureCustomNo: [
                      {required: true, message: '请输入关区代码', trigger: 'blur'}
                  ],
                  arrivalPort: [
                      {required: true, message: '请输入(三字码)', trigger: 'blur'},
                      {min: 3, max: 3, message: '长度在 3 个字符', trigger: 'blur'}
                  ],
                  arrivalCustomNo: [
                      {required: true, message: '请输入关区代码', trigger: 'blur'}
                  ],
xudada authored
244 245 246
                  serialNo:[
                      {required: true, message: '请输入航线序号', trigger: 'blur'}
                  ]
247 248
              },
              tableData: [{
xudada authored
249 250 251 252
                  std: '161146',
                  sta: '161146',
                  effStartdate: '20160502',
                  effEnddate: '20160503'
253 254
              }],
              dialogTableVisible:false,
xudada authored
255
              centerDialogVisible:false,
256
              currentPage4:4,
xudada authored
257
              msg:undefined
258 259 260
          }
        },
        methods:{
xudada authored
261
            //新增航线方法
262 263 264
            submitForm(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
xudada authored
265 266 267 268 269
                        addRoute(this.airline).then(res=>{
                            let response=res.data;
                            if(response.code=='200'){
                                this.centerDialogVisible=true;
                                this.msg=response.msg;
xudada authored
270 271
                                this.$router.push({path:'/queryRoute',query:{serialNo:JSON.stringify(this.airline.serialNo)}});
                                this.centerDialogVisible=false;
xudada authored
272 273 274 275 276
                            }else{
                                this.centerDialogVisible=true;
                                this.msg=response.msg;
                            }
                        });
277 278 279 280 281 282
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
xudada authored
283
            //分页方法
284 285 286 287 288
            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
xudada authored
289
            },
xudada authored
290
            //长期飞行计划选择功能
xudada authored
291 292 293 294 295 296
            handleEdit(index,row){
                this.airline.std=fecha.parse(row.std,'HHmmss');
                this.airline.sta=fecha.parse(row.sta,'HHmmss');
                this.airline.effStartdate=row.effStartdate;
                this.airline.effEnddate=row.effEnddate;
                this.dialogTableVisible=false;
xudada authored
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
            },
            //加载默认值
            defaultData(){
                if(this.$route.query!=null){
                    this.airline.uuid=JSON.parse(this.$route.query.uuid);
                    this.airline.serialNo=JSON.parse(this.$route.query.serialNo);
                    this.airline.departurePort=JSON.parse(this.$route.query.departurePort);
                    this.airline.arrivalPort=JSON.parse(this.$route.query.arrivalPort);
                    this.airline.departureCustomNo=JSON.parse(this.$route.query.departureCustomNo);
                    this.airline.arrivalCustomNo=JSON.parse(this.$route.query.arrivalCustomNo);
                    this.airline.cancelFlag=JSON.parse(this.$route.query.cancelFlag);
                    this.airline.meno=JSON.parse(this.$route.query.meno);
                    this.airline.planno=JSON.parse(this.$route.query.planno);
                    this.airline.std=fecha.parse(JSON.parse(this.$route.query.std),'HHmmss');
                    this.airline.sta=fecha.parse(JSON.parse(this.$route.query.sta),'HHmmss');
                    this.airline.effStartdate=JSON.parse(this.$route.query.effStartdate);
                    this.airline.effEnddate=JSON.parse(this.$route.query.effEnddate);
                    this.airline.plan=JSON.parse(this.$route.query.plan);
                    this.airline.remark=JSON.parse(this.$route.query.remark);
                    this.airline.createTime=JSON.parse(this.$route.query.createTime);
                    this.airline.createBy=JSON.parse(this.$route.query.createBy);
                    this.airline.updateTime=JSON.parse(this.$route.query.updateTime);
                    this.airline.updateBy=JSON.parse(this.$route.query.updateBy);
                    this.airline.isDelete=JSON.parse(this.$route.query.isDelete);
                }
322
            }
xudada authored
323
        },
xudada authored
324 325 326 327
        //渲染方法
        mounted(){
           this.defaultData();
        }
328 329
    }
</script>