danzheng.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 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 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 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 165 166 167 168 169 170 171 172 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 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 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 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 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 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 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991
<template>
    <div>
        <el-row :gutter="10">
            <el-col :span="4">
                <el-input
                        placeholder="航空器注册编号"
                        v-model="query.aircraftNo"
                        size="medium"
                        clearable>
                </el-input>
            </el-col>
            <el-col :span="4">
                <el-input
                        placeholder="进出境(港)航班号"
                        v-model="query.flightNo"
                        size="medium"
                        clearable>
                </el-input>
            </el-col>
            <el-col :span="8">
                <div class="block">
                    <el-date-picker
                            v-model="flightdate"
                            type="daterange"
                            :picker-options="pickerOptions"
                            range-separator="至"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            value-format="yyyy-MM-dd"
                            size="medium"
                            align="right">
                    </el-date-picker>
                </div>
            </el-col>
            <el-col :span="2">
                <el-button size="medium" type="primary" @click="selectList" plain>查询</el-button>
            </el-col>
            <el-col :span="2">
                <el-button size="medium" type="success" @click="addForm()" plain>新增</el-button>
            </el-col>
            <el-col :span="2">
                <el-upload
                        class="upload-demo"
                        action=""
                        :before-upload="beforeUpload"
                        :http-request="uploadFile"
                        :show-file-list="false">
                    <el-button size="medium" type="success" plain>导入</el-button>
                </el-upload>
            </el-col>
        </el-row>
        <el-row :gutter="10">
            <el-table
                    :data="tableData"
                    style="width: 100%"
                    row-key="uuid"
                    :expand-row-keys="expandedRowKeys"
                    border
                    stripe>
                <el-table-column
                        align="center"
                        fixed="left"
                        label="信息操作"
                        width="80">
                    <template slot-scope="scope">
                        <el-button @click="ediForm(scope.row)" type="text" size="small">编辑</el-button>
                    </template>
                </el-table-column>
                <el-table-column type="expand" label="详细信息">
                    <template v-slot:default="{ row }">
                        <el-table
                                :data="row.billpersonList"
                                style="width: 70%;margin-left: 75px;margin-top: 10px"
                                row-key="autoId"
                                stripe
                                border
                        >
                            <el-table-column prop="name" label="姓名" />
                            <el-table-column width="80" prop="gender" label="性别">
                            <template slot-scope="scope">
                                {{ scope.row.gender === 'M' ? '男' : '女' }}
                            </template>
                            </el-table-column>
                            <el-table-column width="80" prop="nationality" label="国籍" />
                            <el-table-column label="职务">
                                <template slot-scope="scope">
                                    {{ {
                                    '1': '航线机长',
                                    '2': '副驾驶',
                                    '3': '乘务长',
                                    '4': '安全员',
                                    '5': '乘务员',
                                    '6': '机械师',
                                    '7': '随行人员',
                                    '8': '工程师',
                                    '9': '装载员',
                                    '10': '押运员',
                                    '11': '其它随机人员'
                                    }[scope.row.gareer] || scope.row.gareer }}
                                </template>
                            </el-table-column>
                            <el-table-column prop="certType" :formatter="formatType" label="证件类型" />
                            <el-table-column prop="ceterNo" label="证件号" />
                        </el-table>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="messageid"
                        label="编号"
                        width="320">
                </el-table-column>

                <el-table-column
                        prop="aircraftNo"
                        label="航空器注册编号"
                        width="100">
                </el-table-column>
                <el-table-column
                        prop="arrivalno"
                        label="海关关区"
                        width="100">
                </el-table-column>
                <el-table-column
                        prop="flightNo"
                        label="进境(港)航班号"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="flightDate"
                        label="航班日期"
                        width="100">
                </el-table-column>
                <el-table-column
                        label="进出类型"
                        width="100">
                    <template slot-scope="scope">
                        {{ scope.row.accessFlag === 'D' ? '出港' : '进港' }}
                    </template>
                </el-table-column>
                <el-table-column
                        prop="arrivaldatetime"
                        label="出入(境)时间"
                        width="140">
                </el-table-column>
                <el-table-column
                        prop="statusMsg"
                        label="海关状态"
                        width="120">
                </el-table-column>
                <el-table-column
                        fixed="right"
                        label="操作"
                        width="200">
                    <template slot-scope="scope">
                        <el-button @click="returnlist(scope.row)" type="text" size="small">查看</el-button>
                        <el-button @click="sendstying(scope.row,2)" type="text" size="small">申报</el-button>
                        <el-button @click="sendstying(scope.row,5)" type="text" size="small">修改</el-button>
                        <el-button @click="sendstying(scope.row,3)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-row>
        <el-row :gutter="10">
            <div class="block">
                <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="query.pageNum"
                        :page-sizes="[100, 200, 300, 400]"
                        :page-size="query.pageSize"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="total">
                </el-pagination>
            </div>
        </el-row>
        <el-row :gutter="10">
            <el-dialog
                    title="回执列表"
                    :visible.sync="returnVisible"
                    width="55%"
                    :before-close="handleClose">
                <el-table :data="gridData">
                    <el-table-column property="sendtime" label="操作时间" ></el-table-column>
                    <el-table-column property="createBy" label="操作人" ></el-table-column>
                    <el-table-column property="flightNo" label="航班号"></el-table-column>
                    <el-table-column property="flightDate" label="航班日期" ></el-table-column>
                    <el-table-column property="receiptContent" label="回执内容" ></el-table-column>
                </el-table>
            </el-dialog>
        </el-row>
        <el-row :gutter="10">
            <el-dialog
                    :title="'单证信息'+textMap[dialogStatus]"
                    :visible.sync="dialogVisible"
                    width="80%"
                    center>
                <el-form :model="form" :rules="rules" ref="form" label-width="130px">
                    <el-row :gutter="10">
                        <el-col :span="6">
                            <el-form-item label="航空注册器编号" prop="aircraftNo">
                                <el-input v-model="form.aircraftNo"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="航班号" prop="flightNo">
                                <el-input v-model="form.flightNo"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="航班日期" prop="flightDate" style="width: 100%;">
                                <div class="block">
                                    <el-date-picker
                                            v-model="form.flightDate"
                                            type="datetime"
                                            value-format="yyyy-MM-dd"
                                            placeholder="yyyy-MM-dd"
                                            style="width: 100%;">
                                    </el-date-picker>
                                </div>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="进出标识" prop="accessFlag">
                                <el-select v-model="form.accessFlag">
                                    <el-option label="进港" value="A"></el-option>
                                    <el-option label="出港" value="D"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row :gutter="10">
                        <el-col :span="6">
                            <el-form-item label="进出港口" prop="arrivalAirport">
                                <el-select v-model="form.arrivalAirport"
                                           filterable
                                           allow-create
                                           default-first-option
                                           remote
                                           :remote-method="getAirportCode"
                                           :loading="loading" placeholder="请选择">
                                    <el-option
                                            v-for="item in airportcodes"
                                            :key="item.airportid"
                                            :label="item.airportid"
                                            :value="item.airportid">
                                        <span style="float: left">{{ item.airportid }}</span>
                                        <span style="float: right; color: #8492a6; font-size: 13px">-{{ item.airportname}}</span>
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="海关关区" prop="arrivalno">
                                <el-select v-model="form.arrivalno"
                                           filterable
                                           allow-create
                                           default-first-option
                                           remote
                                           :remote-method="getCustomCode"
                                           :loading="loading" placeholder="请选择">
                                    <el-option
                                            v-for="item in customcodes"
                                            :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>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="进出境时间" prop="arrivaldatetime" style="width: 100%;">
                                    <el-date-picker
                                            v-model="form.arrivaldatetime"
                                            type="datetime"
                                            value-format="yyyy-MM-dd HH:mm:ss"
                                            placeholder="yyyy-MM-dd HH:mm:ss"
                                            style="width: 100%;">
                                    </el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="机组人数" prop="aircrewSum">
                                <el-input v-model="form.aircrewSum"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row :guter="10">
                        <el-col :span="6">
                            <el-form-item label="国际旅客人数" prop="interPassengerSum">
                                <el-input v-model="form.interPassengerSum"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="国际行李件数" prop="interBaggageNum">
                                <el-input v-model="form.interBaggageNum"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="货邮件数" prop="goodsNum">
                                <el-input v-model="form.goodsNum"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="货邮重量(千克)" prop="goodsQuantity">
                                <el-input v-model="form.goodsQuantity"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row :guter="10">
                        <el-col :span="6">
                            <el-form-item label="是否有健康异常" prop="remark">
                                <el-select v-model="form.remark">
                                    <el-option label="是" value="T"></el-option>
                                    <el-option label="否" value="F"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="是否发现病媒生物" prop="remark1">
                                <el-select v-model="form.remark2">
                                    <el-option label="是" value="T"></el-option>
                                    <el-option label="否" value="F"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="是否发现外来有害生物" prop="remark2">
                                <el-select v-model="form.remark2">
                                    <el-option label="是" value="T"></el-option>
                                    <el-option label="否" value="F"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="是否有有效灭蚊证明" prop="remark3">
                                <el-select v-model="form.remark3">
                                    <el-option label="是" value="T"></el-option>
                                    <el-option label="否" value="F"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row :guter="10">
                        <el-col :span="18">
                            <el-form-item label="备注">
                                <el-input v-model="form.meno"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="">
                                <el-button @click="dialogVisible=false">取消</el-button>
                                <el-button type="primary" @click="dialogStatus==='create'?createData('form'):updateData('form')">暂存</el-button>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                <el-divider content-position="left"><span style="color: #1d8ce0">机组人员信息</span>
                    <el-divider direction="vertical"></el-divider>
                        <el-button type="primary" @click="addBillperson">新增机组人员</el-button>
                    <el-divider direction="vertical"></el-divider></el-divider>

                    <el-table
                            :data="tableChldren"
                            style="width: 80%;margin-left: 75px;margin-top: 10px"
                            row-key="autoId"
                            stripe
                            border>
                        <el-table-column prop="name" label="姓名" />
                        <el-table-column width="80" prop="gender" label="性别">
                            <template slot-scope="scope">
                                {{ scope.row.gender === 'M' ? '男' : '女' }}
                            </template>
                        </el-table-column>
                        <el-table-column width="80" prop="nationality" label="国籍" />
                        <el-table-column label="职务">
                            <template slot-scope="scope">
                                {{ {
                                '1': '航线机长',
                                '2': '副驾驶',
                                '3': '乘务长',
                                '4': '安全员',
                                '5': '乘务员',
                                '6': '机械师',
                                '7': '随行人员',
                                '8': '工程师',
                                '9': '装载员',
                                '10': '押运员',
                                '11': '其它随机人员'
                                }[scope.row.gareer] || scope.row.gareer }}
                            </template>
                        </el-table-column>
                        <el-table-column prop="certType" :formatter="formatType" label="证件类型" />
                        <el-table-column prop="ceterNo" label="证件号" />
                        <el-table-column
                                fixed="right"
                                label="操作"
                                width="50">
                            <template slot-scope="scope">
                                <el-button @click.native.prevent="deleteRow(scope.$index, tableChldren)" type="text" size="small">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
            </el-dialog>
            <el-dialog title="机组人员添加" :visible.sync="dialogFormVisible" width="70%"
                       center>
                <el-form :model="billperson" :rules="rules" ref="billperson" label-width="100px">
                    <el-row :gutter="10">
                        <el-col :span="6">
                            <el-form-item label="姓名" prop="name">
                                <el-input v-model="billperson.name"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="性别" prop="gender">
                                <el-select v-model="billperson.gender">
                                    <el-option label="男" value="M"></el-option>
                                    <el-option label="女" value="F"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="国籍" prop="nationality">
                                <el-select v-model="billperson.nationality"
                                           filterable
                                           @click.native="getCountry"
                                           @change="selectChange"
                                           default-first-option
                                           :loading="loading" placeholder="请选择"
                                           style="text-transform:uppercase">
                                    <el-option
                                            v-for="item in countryOptions"
                                            :key="item.countryid"
                                            :label="item.countryid+'-'+item.countrydescchn"
                                            :value="item.countryid">
                                        <span style="float: left">{{ item.countryid }}</span>
                                        <span style="float: right; color: #8492a6; font-size: 13px">{{ item.countrydescchn }}</span>
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="职务" prop="gareer">
                                <el-select v-model="billperson.gareer" placeholder="请选择">
                                    <el-option label="1-航线机长" value="1"></el-option>
                                    <el-option label="2-副驾驶" value="2"></el-option>
                                    <el-option label="3-乘务长" value="3"></el-option>
                                    <el-option label="4-安全员" value="4"></el-option>
                                    <el-option label="5-乘务员" value="5"></el-option>
                                    <el-option label="6-机械师" value="6"></el-option>
                                    <el-option label="7-随行人员" value="7"></el-option>
                                    <el-option label="8-工程师" value="8"></el-option>
                                    <el-option label="9-装载员" value="9"></el-option>
                                    <el-option label="10-押运员" value="10"></el-option>
                                    <el-option label="11-其它随机人员" value="11"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="证件类型" prop="certType">
                                <el-select v-model="billperson.certType"
                                           filterable
                                           @click.native="getCreden"
                                           :loading="loading" placeholder="请选择">
                                    <el-option
                                            v-for="item in certOptions"
                                            :key="item.serialno"
                                            :label="item.serialno+'-'+item.credenname"
                                            :value="item.serialno">
                                        <span style="float: left">{{ item.serialno }}</span>
                                        <span style="float: right; color: #8492a6; font-size: 13px">{{ item.credenname }}</span>
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="证件号码" prop="ceterNo">
                                <el-input v-model="billperson.ceterNo" placeholder="请输入"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="备注" prop="meno">
                                <el-input v-model="billperson.meno" placeholder="请输入"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item>
                                <el-button type="primary" @click="addRow('billperson')">添加</el-button>
                            </el-form-item>
                        </el-col>
                    </el-row>

                </el-form>
            </el-dialog>
        </el-row>
    </div>
</template>
<script>
    import {
        insertSelectiveBill,
        selectBillLists,
        selectByairportcode,
        selectBycustomcode,
        selectReturnMsgList, sendBillSdeclare, updateByPrimaryKeySelectiveBill,batchJZImport
    } from "../../api/transport/transport2.0";
    import {selectCountry, selectCreden} from "../../api/transport";
    import {importExcel} from "../../api/consigner/exportOrder";

    export default{
        data(){
            return{
                certOptions:[],
                countryOptions:[],
                countryid:'',
                dialogFormVisible:false,
                tableChldren:[],
                dialogVisible: false,
                dialogStatus:'',
                textMap:{
                    update: '编辑',
                    create: '新增'
                },
                tableData:[],
                expandedRowKeys: [],
                query:{
                    aircraftNo:'',
                    flightNo:'',
                    starttime:'',
                    endtime:'',
                    pageNum:0,
                    pageSize:10,
                },
                form: {
                    uuid: '',
                    aircraftNo: '',
                    flightNo: '',
                    flightDate: '', // Use JavaScript Date object
                    accessFlag: 'A',
                    departureAirport: '',
                    departuredatetime: '', // Use JavaScript Date object
                    departureno: '',
                    arrivalAirport: '',
                    arrivaldatetime: '', // Use JavaScript Date object
                    arrivalno: '',
                    aircrewSum: 0,
                    interPassengerSum: 0,
                    localePassengerSum: 0,
                    interBaggageNum: 0,
                    localeBaggageNum: 0,
                    goodsNum: 0,
                    goodsQuantity: 0,
                    cargoBillNum: 0,
                    passengerPage: 0,
                    aircrewBillNum: 0,
                    aircrewCargoBillNum: 0,
                    arrivalPosition: '',
                    bussinessType: '',
                    messageid: '',
                    status: '',
                    statusMsg: '',
                    meno: '',
                    createTime: '', // Use JavaScript Date object
                    createBy: '',
                    updateTime: '', // Use JavaScript Date object
                    updateBy: '',
                    isDelete: '',
                    remark: 'F',
                    remark1: 'F',
                    remark2: 'F',
                    remark3: 'T',
                    billpersonList: [] // Array of objects that represent the AIR_BILLPERSON model
                },
                billperson: {
                    autoId: '',
                    name: '',
                    gender: '',
                    gareer: '', // Note: This might be a typo in the original Java class. It should probably be "career".
                    nationality: '',
                    certType: '',
                    ceterNo: '', // Note: This might also be a typo. It should probably be "centerNo" or "certNo".
                    createTime: '', // Use JavaScript Date object
                    createBy: '',
                    updateTime: '', // Use JavaScript Date object
                    updateBy: '',
                    meno: '',
                    isDelete: '0',
                    billsId: ''
                },
                flightdate:['2021-11-17', '2024-12-24'],
                pickerOptions: {
                    shortcuts: [{
                        text: '最近一周',
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近一个月',
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近三个月',
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                            picker.$emit('pick', [start, end]);
                        }
                    }]
                },
                total:0,
                returnVisible:false,
                gridData:[],
                customcodes:[],
                airportcodes:[],
                loading:false,
                rules: {
                    aircraftNo: [
                        { required: true, message: '航空注册器编号不可为空', trigger: 'blur' }
                    ],
                    flightNo: [
                        { required: true, message: '航班号不可为空', trigger: 'blur' }
                    ],
                    flightDate: [
                        { required: true, message: '航班日期不可为空', trigger: 'blur' }
                    ],
                    arrivalAirport: [
                        { required: true, message: '进出港口不可为空', trigger: 'blur' }
                    ],
                    arrivalno: [
                        { required: true, message: '海关关区不可为空', trigger: 'blur' }
                    ],
                    arrivaldatetime: [
                        { required: true, message: '进出境时间不可为空', trigger: 'blur' }
                    ],
                    aircrewSum: [
                        { required: true, message: '机组人数不可为空', trigger: 'blur' }
                    ],
                    interPassengerSum: [
                        { required: true, message: '国际旅客不可为空', trigger: 'blur' }
                    ],
                    interBaggageNum: [
                        { required: true, message: '国际行李件数不可为空', trigger: 'blur' }
                    ],
                    name: [
                        { required: true, message: '机组人员姓名不可为空', trigger: 'blur' }
                    ],
                    nationality: [
                        { required: true, message: '机组人员国籍不可为空', trigger: 'blur' }
                    ],
                    gender: [
                        { required: true, message: '机组人员性别不可为空', trigger: 'blur' }
                    ],
                    gareer: [
                        { required: true, message: '机组人员职务不可为空', trigger: 'blur' }
                    ],
                    certType: [
                        { required: true, message: '机组人员类型不可为空', trigger: 'blur' }
                    ],
                    ceterNo: [
                        { required: true, message: '机组人员证件号不可为空', trigger: 'blur' }
                    ],
                },
            }
        },
        methods:{
            //导入订单excel
            beforeUpload(file) {
                // 检查文件类型
                const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || file.type === 'application/vnd.ms-excel';
                if (!isExcel) {
                    this.$message.error('上传文件只能是 Excel 格式!');
                    return false; // 取消文件上传
                }
                return true; // 允许上传

            },
            uploadFile({ file, onSuccess, onError }){
                // 生成 FormData 对象
                const formData = new FormData();
                formData.append('file', file);
                batchJZImport(formData).then((response) => {
                    const res = response.data
                    if (res.code !== '200') {
                        return this.$message.error(res.msg);
                    }
                    this.$message.success(res.msg);
                    this.selectList();
                    onSuccess(response.data); // 调用 onSuccess 回调通知上传成功
                }).catch(error => {
                    // 关闭加载
                    this.$message.error(error.toString())
                    onError(error); // 调用 onError 回调通知上传失败
                })
            },
            addBillperson(){
                this.dialogFormVisible = true;
            },
            addRow(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        const newMember = {
                            autoId: this.tableChldren.length > 0 ? this.tableChldren[this.tableChldren.length - 1].autoId + 1 : 1,
                            name: this.billperson.name,
                            gender: this.billperson.gender,
                            nationality: this.billperson.nationality,
                            gareer: this.billperson.gareer,
                            certType: this.billperson.certType,
                            ceterNo: this.billperson.ceterNo,
                            meno:this.billperson.meno,
                            createTime: '', // Use JavaScript Date object
                            createBy: '',
                            updateTime: '', // Use JavaScript Date object
                            updateBy: '',
                            isDelete: '0',
                            billsId: ''
                        };
                        this.tableChldren.push(newMember);
                        this.resetForm();
                        this.dialogFormVisible = false;
                    } else {
                        return false;
                    }
                });
            },
            resetForm() {
                this.billperson.name = '';
                this.billperson.gender = '';
                this.billperson.nationality = '';
                this.billperson.gareer = '';
                this.billperson.certType = '';
                this.billperson.ceterNo = '';
            },
            deleteRow(index, rows) {
                rows.splice(index, 1);
            },
            //暂存新增
            createData(formName){
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        this.form.departuredatetime=this.form.arrivaldatetime;
                        this.form.departureAirport=this.form.arrivalAirport;
                        insertSelectiveBill(this.form).then(res =>{
                            let response=res.data;
                            if(response.code=='200'){
                                this.dialogVisible=false;
                                this.$message.success(response.msg);
                                this.getList();
                            }else{
                                this.$message.error(response.msg)
                            }
                        });
                    } else {
                        return false;
                    }
                });
            },
            //暂存更新
            updateData(formName){
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        this.form.departuredatetime=this.form.arrivaldatetime;
                        this.form.departureAirport=this.form.arrivalAirport;
                        updateByPrimaryKeySelectiveBill(this.form).then(res =>{
                            let response=res.data;
                            if(response.code=='200'){
                                this.dialogVisible=false;
                                Object.assign(this.$data, this.$options.data());
                                this.$message.success(response.msg);
                                this.getList();
                            }else{
                                this.$message.error(response.msg)
                            }
                        });
                    } else {
                        return false;
                    }
                });
            },
            selectList(){
                if(this.flightdate !== null && this.flightdate !== ""){
                    this.query.starttime = this.flightdate[0];
                    this.query.endtime = this.flightdate[1];
                }else{
                    return this.$message.error('请选取时间区间')
                }
                selectBillLists(this.query).then((response) => {
                    const res = response.data
                    if (res.code !== '200') {
                        this.loading = false;
                        return this.$message.error('获取消息收发记录,失败!')
                    }
                    // 获取列表数据
                    this.tableData = res.data.list
                    //this.expandedRowKeys = this.tableData.map(item => item.uuid);
                    // 获取列表的总记录数
                    this.total = res.data.total
                    this.loading = false;
                    this.$message.success('获取消息收发记录,成功!');
                }).catch(error => {
                    // 关闭加载
                    this.$message.error(error.toString())
                })
            },
            addForm(){
                this.dialogVisible=true;
                this.dialogStatus='create';
                this.form={
                    uuid: '',
                    aircraftNo: '',
                    flightNo: '',
                    flightDate: '', // Use JavaScript Date object
                    accessFlag: 'A',
                    departureAirport: '',
                    departuredatetime: '', // Use JavaScript Date object
                    departureno: '',
                    arrivalAirport: '',
                    arrivaldatetime: '', // Use JavaScript Date object
                    arrivalno: '',
                    aircrewSum: 0,
                    interPassengerSum: 0,
                    localePassengerSum: 0,
                    interBaggageNum: 0,
                    localeBaggageNum: 0,
                    goodsNum: 0,
                    goodsQuantity: 0,
                    cargoBillNum: 0,
                    passengerPage: 0,
                    aircrewBillNum: 0,
                    aircrewCargoBillNum: 0,
                    arrivalPosition: '',
                    bussinessType: '',
                    messageid: '',
                    status: '',
                    statusMsg: '',
                    meno: '',
                    createTime: '', // Use JavaScript Date object
                    createBy: '',
                    updateTime: '', // Use JavaScript Date object
                    updateBy: '',
                    isDelete: '',
                    remark: 'F',
                    remark1: 'F',
                    remark2: 'F',
                    remark3: 'F',
                    billpersonList: [] // Array of objects that represent the AIR_BILLPERSON model
                };
                this.tableChldren=this.form.billpersonList;
            },
            ediForm(row){
                this.dialogVisible=true;
                this.dialogStatus='update';
                this.form=row;
                this.tableChldren=row.billpersonList;
            },
            sendstying(row,FunctionCode){
                const params = {
                    row: row,
                    FunctionCode: FunctionCode
                };
                sendBillSdeclare(params).then(res =>{
                    let response=res.data;
                    if(response.code=='200'){
                        this.selectList();
                        this.$message.success(response.msg)
                    }else{
                        this.$message.error(response.msg)
                    }
                });
            },
            formatType: function(row,column){
                return row.certType=='06'?'一次有效台湾居民来往大陆通行证':row.certType=='11'?'外交护照':row.certType=='12'?'公务护照'
                    :row.certType=='13'?'因公普通护照':row.certType=='14'?'普通护照':row.certType=='15'?'中华人民共和国旅行证'
                        :row.certType=='16'?'五年有效台湾居民往来大陆通行证':row.certType=='17'?'海员证':row.certType=='20'?'中华人民共和国出入境通行证'
                            :row.certType=='21'?'前往港澳通行证(16页,多次有效)':row.certType=='22'?'前往港澳通行证(8页,一次有效)'
                                :row.certType=='23'?'前往港澳通行证':row.certType=='24'?'港澳同胞回乡证或港澳居民来往内地通行证'
                                    :row.certType=='25'?'大陆居民来往台湾通行证':row.certType=='30'?'外国人出入境通行证':row.certType=='38'?'中华人民共和国回国证明'
                                        :row.certType=='70'?'香港特别行政区护照':row.certType=='71'?'澳门特别行政区护照'
                                            :row.certType=='72'?'因公往来香港澳门特别行政区通行证(官员)'
                                                :row.certType=='73'?'因公往来香港澳门特别行政区通行证(普通)':row.certType=='74'?'中华人民共和国居民身份证':row.certType=='75'?'其他证件'
                                                    :row.certType=='98'?'其他因私证件(包括联合国通行证等)'
                                                        :row.certType=='99'?'其他因私证件(包括难民证等)':'';
            },
            handleSizeChange(val) {
                this.query.pageSize=val;
                this.selectList();
            },
            handleCurrentChange(val) {
                this.query.pageNum=val;
                this.selectList();
            },
            //查询回执列表
            returnlist(row){
                this.gridData=[];
                let params={messageid:row.messageid};
                selectReturnMsgList(params).then(res=>{
                    let response=res.data.data;
                    this.gridData=response;
                });
                this.returnVisible=true;
            },
            handleClose() {
                this.returnVisible=false;
            },
            //获取关区代码
            getCustomCode:function(query){
                this.customcodes=[];
                let params={customcode:query};
                this.loading = true;
                selectBycustomcode(params).then(res =>{
                    if (res !== '') {
                        setTimeout(() => {
                            this.loading = false;
                            this.customcodes=res.data.data;
                        }, 200);
                    } else {
                        this.customcodes = [];
                    }

                });
            },
            //获取机场代码
            getAirportCode:function(query){
                this.airportcodes=[];
                let params={airportid:query};
                this.loading = true;
                selectByairportcode(params).then(res =>{
                    if (res !== '') {
                        setTimeout(() => {
                            this.loading = false;
                            this.airportcodes=res.data.data;
                        }, 200);
                    } else {
                        this.airportcodes = [];
                    }

                });
            },
            /*获取国籍*/
            getCountry:function(query){
                this.countryOptions=[];
                let params={countryid:query};
                this.loading = true;
                selectCountry(params).then(res =>{
                    if (res!=null) {
                        console.log(res.data.data)
                        setTimeout(() => {
                            this.loading = false;
                            this.countryOptions=res.data.data;
                        }, 200);
                    } else {
                        this.countryOptions = [];
                    }

                });
            },
            selectChange:function(val){
                console.log(val)
                this.$emit('tellFarther',val);
            },
            /*获取证件*/
            getCreden:function(query){
                this.certOptions=[];
                let params={serialno:query};
                this.loading = true;
                selectCreden(params).then(res =>{
                    if (res!=null) {
                        console.log(res.data.data)
                        setTimeout(() => {
                            this.loading = false;
                            this.certOptions=res.data.data;
                        }, 200);
                    } else {
                        this.certOptions = [];
                    }

                });
            },
        },
        mounted() {
            this.expandedRowKeys = this.tableData.map(item => item.uuid);
        }
    }
</script>