审查视图

src/views/nmms/ExitTidy.vue 47.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<template>
    <!--<div class="app-container">-->
    <div>
        <div>
            <el-row class="row-bg">
                <el-col :span="24">
                    <div class="grid-content content">航班信息</div>
                </el-col>
                <el-col :span="24">
                    <div class="grid-content co">
                        <el-col :span="1">
                            <div class="grid-content"></div>
                        </el-col>
                        <el-col :span="20">
                            <div class="grid-content">
                                <span class="titleSpan">航班号:{{this.tidyQuery.carrier}}{{this.tidyQuery.flightno}}</span>
                                <span class="titleSpan">航班日期:{{this.tidyQuery.flightdate}}</span>
                                <span class="titleSpan">航段:{{this.tidyQuery.originstation}}-{{this.tidyQuery.destinationstation}}</span>
                            </div>
                        </el-col>
                    </div>
                </el-col>
                <el-col :span="24">
24
                    <div class="grid-content content">出港理货查询</div>
25 26 27 28 29 30 31 32 33 34
                </el-col>
                <el-col :span="24">
                    <div class="grid-content co">
                        <el-col :span="1">
                            <div class="grid-content"></div>
                        </el-col>
                        <el-col :span="22">
                            <div class="grid-content">
                                <el-col :span="4">
                                    <div class="grid-content">
35 36 37
                                        <el-input v-model="tidyQuery.awba" placeholder="请输入主单号" clearable>
                                            <template slot="prepend">主单号</template>
                                        </el-input>
38 39 40
                                    </div>
                                </el-col>
                                <div class="grid-content el-btn">
41
                                    <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSerach">查&emsp;&emsp;询</el-button>
42
                                    <el-button v-if="tidyQuery.flightno === undefined && tidyData.length <1"
43
                                               type="success" size="mini" icon="el-icon-plus"
44 45 46 47 48 49 50 51 52 53 54 55
                                               @click="handleAddTidy">新增理货
                                    </el-button>
                                </div>
                            </div>
                        </el-col>
                    </div>
                </el-col>
                <el-col :span="24">
                    <div class="grid-content content" style="margin-top: 6px">出港理货明细</div>
                </el-col>
            </el-row>
        </div>
56 57 58 59 60 61 62 63 64 65
        <el-table v-loading="listLoading" :data="tidyData" stripe
                  highlight-current-row
                  default-expand-all
                  row-key="uuid"
                  border
                  :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
                    style="font-size: 12px"  @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column label="运单号" width="150" align="center">
66
                <template slot-scope="scope">
67 68
                    <a type="text" style="color: #409eff;text-decoration: underline" class="tableInline" @click="handleEdit(scope.row)" v-if="scope.row.awbh !==''">{{scope.row.awbh}}</a>
                    <a type="text" style="color: #409eff;text-decoration: underline" class="tableInline" @click="handleEdit(scope.row)" v-else>{{scope.row.awba}}</a>
69 70
                </template>
            </el-table-column>
71 72 73 74 75 76
            <el-table-column label="理货件数" width="100" align="center">
                <template slot-scope="scope">
                    <span>{{scope.row.piece}}</span>
                </template>
            </el-table-column>
            <el-table-column label="理货重量" width="100" align="center">
77
                <template slot-scope="scope">
78
                    <span>{{scope.row.weight}}</span>
79 80
                </template>
            </el-table-column>
81
            <el-table-column label="装载开始时间" width="160" align="center">
82
                <template slot-scope="scope">
83 84 85 86 87 88
                    <span>{{scope.row.starttime}}</span>
                </template>
            </el-table-column>
            <el-table-column label="装载结束时间" width="160" align="center">
                <template slot-scope="scope">
                    <span>{{scope.row.endtime}}</span>
89 90
                </template>
            </el-table-column>
91
            <el-table-column label="状态" width="200" align="center">
92
                <template slot-scope="scope">
93
                    <span v-if="scope.row.status ==='01'">接受申报</span>
94 95
                    <span v-if="scope.row.status ==='02'">待人工审核</span>
                    <span v-if="scope.row.status ==='03'">退单</span>
96 97 98
                    <span v-if="scope.row.status ==='05'">舱单报退单</span>
                    <span v-if="scope.row.status ==='06'">舱单转人工</span>
                    <span v-if="scope.row.status ==='07'">舱单报申报成功</span>
99
                    <span v-if="scope.row.status ==='08'">已发舱单删除报</span>
100 101
                    <span v-if="scope.row.status ==='09'">舱单删除报退单</span>
                    <span v-if="scope.row.status ==='10'">舱单删除报转人工</span>
102 103 104
                    <span v-if="scope.row.status ==='11'">放行</span>
                    <span v-if="scope.row.status ==='12'">拒装</span>
                    <span v-if="scope.row.status ==='13'">禁卸</span>
105 106 107
                    <span v-if="scope.row.status ==='14'">舱单修改报转人工</span>
                    <span v-if="scope.row.status ==='15'">舱单修改报成功</span>
                    <span v-if="scope.row.status ==='16'">海关已存在</span>
108 109 110 111 112
                    <span v-if="scope.row.status ==='21'">可自动发送</span>
                    <span v-if="scope.row.status ==='22'">未发送</span>
                    <span v-if="scope.row.status ==='23'">已发送新增报</span>
                    <span v-if="scope.row.status ==='24'">已发送删除报</span>
                    <span v-if="scope.row.status ==='25'">已发送修改报</span>
113 114
                </template>
            </el-table-column>
115
            <el-table-column label="回执信息" show-overflow-tooltip width="300" align="center" show-overflow-tooltip>
116
                <template slot-scope="scope">
117 118 119 120 121 122 123 124 125 126 127 128
                    <el-tag v-if="scope.row.status=='01' || scope.row.status=='11'" type="success">
                        {{scope.row.ext5}}
                    </el-tag>
                    <el-tag v-else-if="scope.row.status=='02' || scope.row.status=='03'" type="warning">
                        {{scope.row.ext5}}
                    </el-tag>
                    <el-tag v-else-if="scope.row.status=='12' || scope.row.status=='13'" type="danger">
                        {{scope.row.ext5}}
                    </el-tag>
                    <el-tag v-else>
                        {{scope.row.ext5}}
                    </el-tag>
129 130
                </template>
            </el-table-column>
131
            <el-table-column prop="operation" label="操作" width="400px" align="center">
132
                <template slot-scope="scope">
133 134 135 136 137 138 139 140 141 142 143
                    <el-row type="flex" justify="space-between">
                        <el-button size="mini" icon="el-icon-view" @click="handleSend(scope.row)">收发明细</el-button>
                        <el-button size="mini" type="success" icon="el-icon-plus" v-if="scope.row.awbh ===''"
                                   @click="handleAddAwbh(scope.row)">新增分单</el-button>
                        <el-button size="mini" type="danger" icon="el-icon-delete" v-if="isAdmin" @click="handleAwbDelete(scope.row)">删除运单</el-button>
                    </el-row>
                    <el-row type="flex" justify="space-between">
                        <el-button size="mini" icon="el-icon-plus" type="primary" @click="handleAwbSend(scope.row)"
                                   :disabled="addStatus(scope.row.status)">理货申报</el-button>
                        <el-button size="mini" type="warning" icon="el-icon-edit" @click="handleAwbStatus(scope.row)"
                                   :disabled="scope.row.status ==='22'">更改状态</el-button>
144
145 146 147
                        <el-button size="mini" type="danger" icon="el-icon-delete" @click="handleSendDelete(scope.row)"
                                   :disabled="deleteStatus(scope.row.status)">删除申报</el-button>
                    </el-row>
148 149
                </template>
            </el-table-column>
150
        </el-table>
151 152
        <div class="btnFoot">
            <el-row>
153 154
                <el-button type="success" icon="el-icon-plus" size="mini" v-if="tidyQuery.flightno !== undefined || tidyData.length> 0"
                           @click="handelAddTidyInfo">新增理货
155
                </el-button>
156 157
                <el-button type="primary" icon="el-icon-back" size="mini" v-if="tidyQuery.flightno !== undefined || tidyData.length> 0"
                           @click="handelBackStep">返&emsp;&emsp;回
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
                </el-button>
            </el-row>
        </div>
        <pagination v-show="total>0" :total="total" :page.sync="tidyQuery.pageSize" :limit.sync="tidyQuery.limitSize"
                    @pagination="getList"/>
        <el-dialog :title="dialogMap[dialogStatus]" :visible.sync="dialogFormVisible" style="width: 110%">
            <el-form ref="tidyFormData" :model="tidyModel" :rules="tidyRoles" label-position="right"
                     label-width="120px">
                <el-row>
                    <div class="grid-content content">
                        <span>航班信息</span>
                    </div>
                </el-row>

                <el-row>
                    <el-col :span="7.5">
                        <el-form-item label="主单号" prop="awba">
                            <el-input v-model="tidyModel.awba" :disabled="dialogStatus === 'update'"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="7.5">
179 180
                        <el-form-item label="分单号" prop="awbh" v-if="fenStatus === 'addAwbh'">
                            <el-input v-model="awbh" clearable></el-input>
181 182 183 184
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
185 186 187 188 189
<!--                    <el-col :span="7.5">-->
<!--                        <el-form-item label="承运人" prop="carrier">-->
<!--                            <el-input v-model="carrier" :disabled="dialogStatus === 'update'"></el-input>-->
<!--                        </el-form-item>-->
<!--                    </el-col>-->
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
                    <el-col :span="7.5">
                        <el-form-item label="航班号" prop="flightno">
                            <el-input v-model="flightno" :disabled="dialogStatus === 'update'"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="7.5">
                        <el-form-item label="航班日期" prop="flightdate">
                            <el-date-picker v-model="tidyModel.flightdate" value-format="yyyy-MM-dd" type="date"
                                            placeholder="请输入" :disabled="dialogStatus === 'update'"></el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="7.5">
                        <el-form-item label="起始站" prop="originstation">
205
206 207
                            <el-select filterable clearable placeholder="请选择起始站" :remote-method="remoteMethodAirport"
                                       allow-create v-model="originstation" remote>
208 209 210 211 212 213 214
                                <el-option v-for="item in airportCode"
                                           :key="item.airportid" :label="item.airportid"
                                           :value="item.airportid" :disabled="dialogStatus === 'update'">
                                    <span style="float: left">{{ item.airportdescchn }}</span>
                                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.airportid }}</span>
                                </el-option>
                            </el-select>
215 216 217 218
                        </el-form-item>
                    </el-col>
                    <el-col :span="7.5">
                        <el-form-item label="目的站" prop="destinationstation">
219 220
                            <el-select filterable clearable placeholder="请选择起始站" :remote-method="remoteMethodAirport"
                                       allow-create v-model="destinationstation" remote>
221 222 223 224 225 226 227
                                <el-option v-for="item in airportCode"
                                           :key="item.airportid" :label="item.airportid"
                                           :value="item.airportid" :disabled="dialogStatus === 'update'">
                                    <span style="float: left">{{ item.airportdescchn }}</span>
                                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.airportid }}</span>
                                </el-option>
                            </el-select>
228 229 230 231 232 233 234 235 236 237
                        </el-form-item>
                    </el-col>

                </el-row>
                <div class="grid-content content">
                    <span>货物信息</span>
                </div>

                <el-row>
                    <el-col :span="7.5">
朱兆平 authored
238
                        <el-form-item label="运单件数" prop="awbprice">
zhangFan authored
239
                            <el-input v-model="tidyModel.awbprice"></el-input>
240 241 242
                        </el-form-item>
                    </el-col>
                    <el-col :span="7.5">
朱兆平 authored
243
                        <el-form-item label="运单重量" prop="awbweight">
zhangFan authored
244
                            <el-input v-model="tidyModel.awbweight"></el-input>
245 246 247 248
                        </el-form-item>
                    </el-col>
                    <el-col :span="7.5">
                        <el-col :span="7.5">
朱兆平 authored
249
                            <el-form-item label="装载开始时间" prop="starttime">
250 251 252 253 254 255 256 257 258
                                <el-date-picker v-model="tidyModel.starttime" value-format="yyyy-MM-dd HH:mm:ss"
                                                type="datetime"
                                                placeholder="请输入"></el-date-picker>
                            </el-form-item>
                        </el-col>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="7.5">
259
                        <el-form-item label="理货件数" prop="piece">
zhangFan authored
260
                            <el-input v-model="tidyModel.piece"></el-input>
261 262 263
                        </el-form-item>
                    </el-col>
                    <el-col :span="7.5">
264
                        <el-form-item label="理货重量" prop="weight">
zhangFan authored
265
                            <el-input v-model="tidyModel.weight"></el-input>
266 267
                        </el-form-item>
                    </el-col>
268 269 270 271 272 273 274
<!--                    <el-col :span="7.5">-->
<!--                        <el-form-item label="装载结束时间" prop="endtime">-->
<!--                            <el-date-picker v-model="tidyModel.endtime" value-format="yyyy-MM-dd HH:mm:ss"-->
<!--                                            type="datetime"-->
<!--                                            placeholder="请输入"></el-date-picker>-->
<!--                        </el-form-item>-->
<!--                    </el-col>-->
275 276 277 278 279 280 281 282 283
                </el-row>
                <el-row>
                    <el-col :span="7.5">
                        <el-form-item label="货物描述" prop="goodsname">
                            <el-input v-model="goodsname" placeholder="请输入"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="7.5">
                        <el-form-item label="海关关区" prop="customcode">
284
                            <el-select v-model="tidyModel.customcode"  placeholder="请选择关区代码"
朱兆平 authored
285 286
                                       allow-create
                                       default-first-option
287
                                       filterable clearable remote :remote-method="remoteMethodCustomCode" :loading="customLoading"
朱兆平 authored
288
                            >
289 290 291 292 293
                                <el-option v-for="item in customCodeList" :key="item.customcode" :label="item.customcode"
                                           :value="item.customcode">
                                    <span style="float: left">{{ item.customcode }}</span>
                                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.customname }}</span>
                                </el-option>
294 295 296 297 298 299 300 301 302 303 304 305
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取消</el-button>
                <el-button type="primary" @click="dialogStatus==='create'?createData():updateData()">保存</el-button>
            </div>
        </el-dialog>
        <el-dialog title="收发明细" :visible.sync="dialogTableVisible">
            <el-table :data="detailData" border>
306
                <el-table-column label="操作时间" width="180">
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
                    <template slot-scope="scope">
                        {{scope.row.busdate}}
                    </template>
                </el-table-column>
                <el-table-column label="航班号" width="80">
                    <template slot-scope="scope">
                        {{scope.row.carrier}}{{scope.row.flightno}}
                    </template>
                </el-table-column>
                <el-table-column label="航班日期" width="100">
                    <template slot-scope="scope">
                        {{scope.row.flightdate}}
                    </template>
                </el-table-column>
                <el-table-column label="件数" width="70">
                    <template slot-scope="scope">
                        {{scope.row.buspiece}}
                    </template>
                </el-table-column>
                <el-table-column label="重量" width="70">
                    <template slot-scope="scope">
                        {{scope.row.busweight}}
                    </template>
                </el-table-column>
                <el-table-column label="回执信息" width="">
                    <template slot-scope="scope">
                        {{scope.row.cusrestext}}
                    </template>
                </el-table-column>
336 337 338 339 340
                <el-table-column label="操作类型" width="100">
                    <template slot-scope="scope">
                        {{scope.row.opertype}}
                    </template>
                </el-table-column>
341 342
                <el-table-column label="操作人" width="100">
                    <template slot-scope="scope">
343
                        {{scope.row.operusername}}
344 345 346 347
                    </template>
                </el-table-column>
            </el-table>
        </el-dialog>
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
        <el-dialog title="删除原因" :visible.sync="dialogDeleteVisible" width="30%">
            <el-form ref="tidyDeleteForm" :model="respModel" :rules="tidyDeleteRules"
                     label-width="120px" style="margin-right: 50px">
                <el-form-item label="删除原因" prop="reason">
                    <el-input v-model="respModel.reason" placeholder="删除原因"></el-input>
                </el-form-item>
                <el-form-item label="删除操作人" prop="contactName">
                    <el-input v-model="respModel.contactName" placeholder="操作人姓名"></el-input>
                </el-form-item>
                <el-form-item label="操作人Tel" prop="contactTel">
                    <el-input v-model="respModel.contactTel" placeholder="删除操作人联系方式"></el-input>
                </el-form-item>
                <el-form-item label="备注">
                    <el-input v-model="respModel.content" type="textarea"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogDeleteVisible = false">取消</el-button>
                <el-button type="primary" @click="sendTidyDelete()">发送</el-button>
            </div>
        </el-dialog>
369 370 371 372 373 374 375
    </div>
</template>
<script>
    import treeTable from '@/components/TreeTable'
    import treeToArray from '@/utils/customEval'
    import Pagination from '@/components/Pagination'
376 377 378 379
    import {
        getMt520XListForParam, deleteByIsDelete,
        updateStatus, updateMt520X, addMt520X,
        sendCreateMt5202,sendRemoveMt5202 } from '@/api/exitTidy'
380 381
    import {Message} from "element-ui";
    import {getResponseForParam} from '@/api/responseDetail'
zhangFan authored
382
    import {validAwb, validAlphabets, validAlphabetsAndNum, validAlphabetsAndSpanceKey,validatorNum} from "@/utils/validate"
383
    import {getCustomCode,getAirportCode} from "@/api/country";
朱兆平 authored
384
    import util from "@/common/js/util.js";
385
    import {loginedUserInfo} from "../../api/user";
386 387 388 389 390 391 392 393 394 395 396 397 398

    export default {
        name: "ExitTidy",
        components: {treeTable, Pagination},
        inject: ['reload'],
        data() {
            const validatorAwb = (rule, value, callback) => {
                if (!validAwb(value)) {
                    callback("请正确书写主单号")
                }
                callback()
            }
            const validatorAwbh = (rule, value, callback) => {
朱兆平 authored
399
                if (value !=='' && value !== undefined && !validAlphabetsAndNum(value)) {
400
                    callback("只能输入字母和数字")
朱兆平 authored
401 402
                }else{
                    callback()
403
                }
朱兆平 authored
404
405 406 407 408 409 410 411 412 413 414 415 416 417
            }
            const validatorAlphabets = (rule, value, callback) => {
                if (!validAlphabets(value)) {
                    callback("只能输入字母")
                }
                callback()
            }
            const validAlphabetsSpanceKey = (rule, value, callback) => {
                if (!validAlphabetsAndSpanceKey(value)) {
                    callback("只能输入字母、数字、空格")
                }
                callback()
            }
zhangFan authored
418 419 420 421 422 423
            const validatorNums = (rule, value, callback) => {
                if (!validatorNum(value)) {
                    callback("只能输入数字,并且小数位最多两位")
                }
                callback()
            }
424 425 426
            return {
                func: treeToArray,
                total: 1,
zhangFan authored
427
                isAdmin:false,
428 429 430 431 432
                dialogMap: {
                    update: '编辑出港理货',
                    create: '添加出港理货',
                    addAwbh: '添加分单理货'
                },
433 434
                customCodeList: [],
                airportCode:[],
435 436
                tidyQuery: {
                    pageSize: 1,
437
                    limitSize: 10,
438 439 440 441 442 443
                    awba: undefined,
                    carrier: undefined,
                    flightno: undefined,
                    flightdate: undefined,
                    originstation: undefined,
                    destinationstation: undefined,
444
                    customcode: undefined,
朱兆平 authored
445
                    rcfdep: "5202"
446 447
                },
                tidyRoles: {
shenhailong authored
448
                    awba: [{required: true, message: "主单号不能为空"},{ trigger: 'blur', validator: validatorAwb}],
朱兆平 authored
449
                    awbh: [{trigger: 'blur', validator: validatorAwbh}],
shenhailong authored
450 451 452
                    goodsname: [{required: true, message: "货物描述不能为空"},{ trigger: 'blur', validator: validAlphabetsSpanceKey}],
                    carrier: [{required: true, message:"承运人不能为空"},{trigger: 'blur', validator: validatorAwbh}],
                    flightno: [{required: true, message:"航班号不能为空"}, { trigger: 'blur', validator: validatorAwbh}],
453
                    flightdate: [{required: true, trigger:'blur', message:"请选择航班日期"}],
shenhailong authored
454 455 456 457
                    originstation: [{required: true, message:"起始站不能为空"}, {trigger: 'blur', validator: validatorAlphabets}],
                    destinationstation: [{required: true, message:"目的站不能为空"}, { trigger: 'blur', validator: validatorAlphabets}],
                    weight: [{required: true, message:"重量不能为空"}, { trigger: 'change', validator: validatorNums}],
                    piece: [{required: true, message:"件数不能为空"}, { trigger: 'change', validator: validatorNums}],
458 459
                    customcode: [{required: true, message:"关区不能为空",trigger:'change'}],
                    starttime: [{required: true, message:"关区不能为空",trigger:'change'}],
shenhailong authored
460
461 462 463 464
                },
                tidyData: [],
                detailData: [],
                dialogTableVisible: false,
465
                dialogDeleteVisible: false,
466 467
                dialogStatus: undefined,
                disabledStatus: false,
468
                fenStatus: undefined,
469
                listLoading: false,
470
                customLoading:false,
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489
                dialogFormVisible: false,
                tidyModel: {
                    carrier: undefined,
                    flightno: undefined,
                    flightdate: undefined,
                    originstation: undefined,
                    destinationstation: undefined,
                    awba: undefined,
                    awbh: undefined,
                    piece: undefined,
                    weight: undefined,
                    goodsname: undefined,
                    customcode: undefined,
                    specialgoods: undefined,
                    starttime: undefined,
                    endtime: undefined,
                    awbpiece: undefined,
                    awbweight: undefined,
                    rcfdep: 'MT5202',
490
                    userinfo: {
491
                        username : loginedUserInfo().username
492
                    }
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
                },
                respModel : {
                    uuid: undefined,
                    reason: undefined,
                    contactName: undefined,
                    contactTel: undefined,
                    content: '',
                    flightNo: undefined,
                    awba: undefined,
                    customCode: undefined,
                    flightDate: undefined,
                    awbh: undefined,
                    rcfdep: 'MT5202',
                },
                tidyDeleteRules: {
508 509 510 511 512 513 514 515 516 517 518 519 520 521
                    reason:[{required:true,message:'原因不能为空',trigger:'blur'}],
                    contactName:[{required:true,message:'操作人不能为空',trigger:'blur'}],
                    contactTel:[
                        { required: true, message: '手机号不能为空', trigger: 'blur' },
                        { type: 'number', message: '手机号格式不正确', trigger: 'blur',
                            transform(value){
                                var phone = 11 && /^((13|14|15|16|17|18|19)[0-9]{1}\d{8})$/
                                if (!phone.test(value)){
                                    return false;
                                }else {
                                    return Number(value);
                                }
                            }}
                    ],
522
                },
523 524

                rows:{},
525 526
            }
        },
527
        activated() {
528 529 530 531 532 533 534 535 536 537
            if (this.$route.params.flightData !== undefined) {
                this.tidyQuery.carrier = this.$route.params.flightData.flightno.substring(0, 2)
                this.tidyQuery.flightno = this.$route.params.flightData.flightno.substring(2)
                this.tidyQuery.flightdate = this.$route.params.flightData.flightdate
                this.tidyQuery.originstation = this.$route.params.flightData.originstation
                this.tidyQuery.destinationstation = this.$route.params.flightData.destinationstation
                if (this.$route.params.flightData.awba !== undefined && this.$route.params.flightData.awba !== '') {
                    this.tidyQuery.awba = this.$route.params.flightData.awba.substring(0, 3) + "-" + this.$route.params.flightData.awba.substring(3)
                }
                this.getList()
538 539 540 541 542
            }else {
                this.tidyQuery = {
                    pageSize: 1,
                    limitSize: 10,
                    awba: undefined,
543
                    rcfdep: "MT5202"
544
                }
545
            }
546
            let username = loginedUserInfo().username
zhangFan authored
547 548 549
            if(username === 'admin'){
                this.isAdmin = true
            }
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
        },
        watch: {
            'tidyModel.endtime': function (newValue, oldValue) {
                let startData = new Date(this.tidyModel.starttime)
                let endDate = new Date(newValue)
                if (startData.getTime() > endDate.getTime()) {
                    this.tidyModel.endtime = undefined
                    Message.error("理货结束时间不得早于开始时间")
                }
            },
            'tidyModel.starttime': function (newValue, oldValue) {
                let startData = new Date(newValue)
                let endDate = new Date(this.tidyModel.endtime)
                if (startData.getTime() > endDate.getTime()) {
                    this.tidyModel.starttime = undefined
                    Message.error("理货开始时间不得晚于结束时间")
                }
            }
        },
        computed: {
            awbh: {
                get: function () {
                    return this.tidyModel.awbh
                },
                set: function (val) {
                    this.tidyModel.awbh = val.toUpperCase().trim()
                }
            },
            goodsname: {
                get: function () {
                    return this.tidyModel.goodsname
                },
                set: function (val) {
                    this.tidyModel.goodsname = val.toUpperCase()
                }
            },
            carrier: {
                get: function () {
                    return this.tidyModel.carrier
                },
                set: function (val) {
                    this.tidyModel.carrier = val.toUpperCase().trim()
                }
            },
            flightno: {
                get: function () {
                    return this.tidyModel.flightno
                },
                set: function (val) {
                    this.tidyModel.flightno = val.toUpperCase().trim()
                }
            },
            originstation: {
                get: function () {
                    return this.tidyModel.originstation
                },
                set: function (val) {
                    this.tidyModel.originstation = val.toUpperCase().trim()
                }
            },
            destinationstation: {
                get: function () {
                    return this.tidyModel.destinationstation
                },
                set: function (val) {
                    this.tidyModel.destinationstation = val.toUpperCase().trim()
                }
            },
        },
        methods: {
            // 查询出港理货列表
            getList() {
                this.listLoading = true
                //根据是否有主单号 来给查询条件赋值
624
                if (this.tidyQuery.awba !== undefined && this.tidyQuery.awba !== '') {
625
                    getMt520XListForParam(this.tidyQuery).then(res => {
626 627 628
                        this.tidyData = res.data.data.list;
                        this.total = res.data.data.total
                        if (res.data.data.list.length > 0) {
629 630 631 632 633 634 635 636 637 638 639 640 641
                            this.tidyQuery.carrier = this.tidyData[0].carrier
                            this.tidyQuery.flightno = this.tidyData[0].flightno
                            this.tidyQuery.flightdate = this.tidyData[0].flightdate
                            this.tidyQuery.originstation = this.tidyData[0].originstation
                            this.tidyQuery.destinationstation = this.tidyData[0].destinationstation
                            this.tidyQuery.customcode = this.tidyData[0].customcode
                        }
                        setTimeout(() => {
                            this.listLoading = false
                        }, 1500)
                    })
                } else {
                    getMt520XListForParam(this.tidyQuery).then(res => {
642 643
                        this.tidyData = res.data.data.list;
                        this.total = res.data.data.total;
644 645 646 647 648 649 650 651 652 653 654 655 656
                        setTimeout(() => {
                            this.listLoading = false
                        }, 1500)
                    })
                }

            },
            // 多选
            handleSelectionChange() {

            },
            // 搜索
            handleSerach() {
王勇 authored
657 658 659 660 661
                // this.tidyQuery.carrier = undefined
                // this.tidyQuery.flightno = undefined
                // this.tidyQuery.originstation = undefined
                // this.tidyQuery.flightdate = undefined
                // this.tidyQuery.destinationstation = undefined
662 663 664 665 666 667 668 669
                this.getList()
            },
            // 收发明细
            handleSend(row) {
                const resQuery = {
                    carrier: row.carrier,
                    flightNo: row.flightno,
                    flightDate: row.flightdate,
670
                    opertype: row.opertype,
671 672
                    awba: row.awba,
                    awbh: row.awbh,
朱兆平 authored
673
                    rcfdep: 'MT5202'
674 675 676 677 678 679 680 681
                }
                this.dialogTableVisible = true
                getResponseForParam(resQuery).then(res => {
                    this.detailData = res.data
                })
            },
            //发送舱单报
            handleAwbSend(row) {
682 683
                delete row.children
                delete row.parent
684
                this.rows = row;
685 686 687 688 689
                this.$confirm("是否发送", "确认消息", {
                    distinguishCancelAndClose: true,
                    confirmButtonText: '发送',
                    cancelButtonText: '取消'
                }).then(() => {
690
                    row.userinfo = {
691
                        username : loginedUserInfo().username
692
                    }
693 694 695
                    sendCreateMt5202(row).then(res => {
                        if (res.data.count > 0) {
                            Message.success(res.data.respMessage)
696 697 698
                            // this.getList()
                            this.rows.status="23";
                            this.rows.ext5="新增报发送成功";
699 700 701 702 703 704 705
                        }else {
                            Message.error(res.data.respMessage)
                        }
                    })
                }).catch(error =>{
                    Message.error(error.message)
                })
706
            },
707 708 709 710 711 712 713 714
            // 发送舱单报自灰
            addStatus(status){
                if(status=='23' || status=='24'||status=='25'){
                    return true;
                }else if(status=='22' ) {
                    return false;
                }
            },
715 716
            //新增分单理货
            handleAddAwbh(row) {
717 718

                this.fenStatus='addAwbh'
719 720 721
                // 清空from列表
                this.restModel();
722 723
                this.tidyModel.awba = row.awba
                this.tidyModel.flightdate = row.flightdate
724
                this.tidyModel.flightno = row.carrier + row.flightno
725 726 727
                this.tidyModel.originstation = row.originstation
                this.tidyModel.destinationstation = row.destinationstation
                this.tidyModel.customcode = row.customcode
728 729
                // this.dialogStatus = 'addAwbh'
                this.dialogStatus = 'create'
730 731 732 733 734
                this.dialogFormVisible = true
                this.$nextTick(() => {
                    this.$refs.tidyFormData.clearValidate()
                })
            },
735 736
            // 发删除报
            handleSendDelete(row){
737 738 739

                this.rows = row;
740
                this.respModel = {
741
                    carrier: undefined,
742 743 744 745 746 747 748 749 750 751
                    reason: undefined,
                    contactName: undefined,
                    contactTel: undefined,
                    content: '',
                    flightNo: undefined,
                    awba: undefined,
                    customCode: undefined,
                    flightDate: undefined,
                    awbh: undefined,
                    rcfdep: 'MT5202',
752
                    username: loginedUserInfo().username
753 754
                }
                this.dialogDeleteVisible = true
755 756
                this.respModel.carrier = row.carrier
                this.respModel.flightNo = row.flightno
757 758 759 760 761 762 763 764 765 766 767 768
                this.respModel.awba = row.awba
                this.respModel.customCode = row.customcode
                this.respModel.flightDate = row.flightdate
                if(row.awbh === null){
                    this.respModel.awbh = ''
                }else {
                    this.respModel.awbh = row.awbh
                }
                this.$nextTick(() => {
                    this.$refs.tidyDeleteForm.clearValidate()
                })
            },
769 770 771 772 773 774 775 776 777
            // 删除舱单报自灰
            deleteStatus(status){
                if(status=='23' || status=='24'||status=='25'){
                    return true;
                }else if(status=='22' ) {
                    return false;
                }
            },
            // 发送删除报
778 779 780 781 782 783 784
            sendTidyDelete(){
                this.$refs.tidyDeleteForm.validate(valid =>{
                    if(valid){
                        sendRemoveMt5202(this.respModel).then(res =>{
                            if(res.data.count >0){
                                Message.success(res.data.respMessage)
                                this.dialogDeleteVisible = false
785 786
                                this.rows.status="24";
                                this.rows.ext5="删除报发送成功";
787 788 789 790 791 792 793
                            }else {
                                Message.error(res.data.respMessage)
                            }
                        })
                    }
                })
            },
794 795 796 797 798 799 800 801 802
            // 删除当前运单
            handleAwbDelete(row) {
                delete row.parent
                delete row.children
                this.$confirm("是否删除", "确认消息", {
                    distinguishCancelAndClose: true,
                    confirmButtonText: '删除',
                    cancelButtonText: '取消'
                }).then(() => {
803 804 805
                    row.userinfo = {
                        username : loginedUserInfo().username
                    }
806
                    deleteByIsDelete(row).then(res => {
807 808
                        if (res.data.code == "200") {
                            Message.success(res.data.msg)
809 810
                            this.getList()
                        } else {
811
                            Message.success(res.data.msg)
812 813 814 815 816 817 818 819 820 821 822 823 824 825
                        }
                    })
                }).catch(action => {
                    this.$message({
                        type: 'info',
                        message: action === 'cancel'
                            ? '取消删除'
                            : '删除取消'
                    })
                })

            },
            // 更新运单为可发送状态
            handleAwbStatus(row) {
826
827 828 829 830 831
                this.$confirm("是否发送更改状态", "确认消息", {
                    distinguishCancelAndClose: true,
                    confirmButtonText: '确认更改',
                    cancelButtonText: '取消更改'
                }).then(() => {
832 833 834 835 836 837 838 839 840 841 842
                    if (row.status!==22){
                        row.status =22;
                    }
                    // updateStatus(row).then(res => {
                    //     if (res.data.count > 0) {
                    //         Message.success(res.data.respMessage)
                    //         this.getList()
                    //     } else {
                    //         Message.error(res.data.respMessage)
                    //     }
                    // })
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872
                }).catch(action => {
                    this.$message({
                        type: 'info',
                        message: action === 'cancel'
                            ? '取消状态更改'
                            : '取消状态更改'
                    })
                })

            },
            // 重置实体 并赋值refdep为出港理货MT5202
            restModel() {
                this.tidyModel = {
                    carrier: undefined,
                    flightno: undefined,
                    flightdate: undefined,
                    originstation: undefined,
                    destinationstation: undefined,
                    awba: undefined,
                    awbh: undefined,
                    piece: undefined,
                    weight: undefined,
                    goodsname: undefined,
                    customcode: undefined,
                    specialgoods: undefined,
                    starttime: undefined,
                    endtime: undefined,
                    awbpiece: undefined,
                    awbweight: undefined,
                    rcfdep: 'MT5202',
873
                    userinfo: {
874
                        username: loginedUserInfo().username
875
                    }
876 877 878 879
                }
            },
            // 新增出港理货弹框
            handelAddTidyInfo() {
880
                this.fenStatus=undefined;
881 882 883
                this.restModel()
                // 给model赋值,所使用数据是以单独单号查询数据所得
                this.tidyModel.flightdate = this.tidyQuery.flightdate
884 885 886
                if (this.tidyQuery.carrier != undefined){
                    this.tidyModel.flightno = this.tidyQuery.carrier+this.tidyQuery.flightno
                }
887 888 889 890 891 892 893 894 895 896 897 898 899
                this.tidyModel.originstation = this.tidyQuery.originstation
                this.tidyModel.destinationstation = this.tidyQuery.destinationstation
                this.tidyModel.customcode = this.tidyQuery.customcode
                this.dialogStatus = 'create'
                this.dialogFormVisible = true
                this.$nextTick(() => {
                    this.$refs.tidyFormData.clearValidate()
                })
            },
            // 新增出港理货请求
            createData() {
                this.$refs.tidyFormData.validate(valid => {
                    if (valid) {
900 901
                        this.tidyModel.carrier = this.tidyModel.flightno.substring(0,2);
                        this.tidyModel.flightno = this.tidyModel.flightno.substring(2);
902
                        addMt520X(this.tidyModel).then(res => {
903 904
                            if (res.data.code == "200") {
                                Message.success(res.data.msg);
905 906 907
                                this.dialogFormVisible = false
                                this.getList()
                            } else {
908
                                Message.error(res.data.msg);
909 910 911 912 913 914 915
                            }
                        })
                    }
                })
            },
            // 更新出港理货弹框
            handleEdit(row) {
916 917 918 919 920
                if(row.awbh !==''){
                    this.fenStatus='addAwbh'
                }else {
                    this.fenStatus=undefined
                }
921
                this.tidyModel = Object.assign({}, row)
922
                this.tidyModel.flightno = row.carrier+row.flightno
923 924 925 926 927 928 929 930
                this.dialogStatus = 'update'
                this.dialogFormVisible = true
                this.$nextTick(() => {
                    this.$refs.tidyFormData.clearValidate()
                })
            },
            // 更新出港理货请求
            updateData() {
931
                let _this = this;
932 933 934 935
                this.$refs.tidyFormData.validate(valid => {
                    if (valid) {
                        delete this.tidyModel.parent
                        delete this.tidyModel.children
936 937

                        _this.tidyModel.user= {
938
                            username : loginedUserInfo().username
939
                        }
940
                        this.tidyModel.userinfo = {
941
                            username : loginedUserInfo().username
942
                        }
943 944
                        this.tidyModel.carrier = this.tidyModel.flightno.substring(0,2);
                        this.tidyModel.flightno = this.tidyModel.flightno.substring(2);
945 946 947 948 949 950 951 952 953 954 955 956 957
                        updateMt520X(this.tidyModel).then(res => {
                            console.log(res.data)
                            if (res.data.count > 0) {
                                Message.success("出港理货更新成功")
                                this.dialogFormVisible = false
                                this.getList()
                            } else {
                                Message.error("出港理货更新失败,请检查数据")
                            }
                        })
                    }
                })
            },
958
            // 获取机场三字码
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973
            remoteMethodAirport(query){
                this.airportCode = []
                if (query !== '') {
                    this.listLoading = true
                    getAirportCode({airportid: query}).then(res => {
                        if(res !== null){
                            setTimeout(() => {
                                this.listLoading = false
                                this.airportCode = res.data.data
                            }, 200)
                        }
                    })
                } else {
                    this.airportCode = []
                }
974
            },
975
            // 关区代码
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990
            remoteMethodCustomCode(query){
                this.customCodeList = []
                if (query !== '') {
                    this.customLoading = true
                    getCustomCode({customcode: query}).then(res => {
                        if(res !== null){
                            setTimeout(() => {
                                this.customLoading = false
                                this.customCodeList = res.data.data
                            }, 200)
                        }
                    })
                } else {
                    this.airportCode = []
                }
991 992 993
            },
            // 新增理货弹框
            handleAddTidy() {
994
                const query = {
朱兆平 authored
995
                    'messageType': 'MT5202'
996
                }
997
                this.$router.push({name: '出港航班信息', params: {scopeRow: query}})
998 999 1000
            },
            // 返回
            handelBackStep() {
朱兆平 authored
1001
                this.tidyQuery.rcfdep = 'MT5202'
1002
                this.$router.push({name: '出港航班信息', params: {scopeRow: this.tidyQuery}})
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043
            }
        }
    }

</script>
<style scoped>
    .grid-content {
        height: 36px;
        line-height: 36px;
    }

    .content {
        border-left: 4px #409EFF solid;
        padding-left: 10px;
        background-color: #f9fafc;
        margin-bottom: 2px
    }

    .row-bg, .co {
        background-color: white;
    }

    .titleSpan {
        font-weight: bold;
        margin-right: 35px;
    }

    .el-btn {
        margin-left: 10px;
        display: inline-block;
    }

    .el-row {
        margin-top: 10px;
        margin-bottom: 0px;
    }

    .btnFoot {
        margin-top: 10px;
    }
</style>