index.vue 51.6 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 992 993 994 995 996 997 998 999 1000 1001 1002 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 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684
<template>
  <div>
    <el-form
      class="form-header"
      :model="queryParams"
      ref="queryForm"
      label-position="right"
      label-width="auto"
      size="small"
    >
      <el-row>
        <el-col :span="6">
          <el-form-item label="航班日期从" prop="fltDateStart">
            <el-date-picker
              class="formItem"
              value-format="yyyy-MM-dd"
              v-model="queryParams.fltDateStart"
              type="date"
              placeholder="选择日期"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="到" prop="fltDateEnd">
            <el-date-picker
              class="formItem"
              value-format="yyyy-MM-dd"
              v-model="queryParams.fltDateEnd"
              type="date"
              placeholder="选择日期"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="航班号" prop="fltNo">
            <el-input
              class="formItem"
              v-model="queryParams.fltNo"
              placeholder="请输入航班号"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="航班类型" prop="typeId">
            <el-select
              class="formItem"
              v-model="queryParams.typeId"
              placeholder="请选择航班类型"
              clearable
            >
              <el-option
                v-for="dict in selectOption.flightTypelist"
                :key="dict.id"
                :label="dict.chineseName"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="航班状态" prop="statusId">
            <el-select
              class="formItem"
              v-model="queryParams.statusId"
              placeholder="请选择航班状态"
              clearable
            >
              <el-option
                v-for="dict in selectOption.flightStatuslist"
                :key="dict.id"
                :label="dict.chineseName"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="航班种类" prop="flightKindId">
            <el-select
              class="formItem"
              v-model="queryParams.flightKindId"
              placeholder="请选择航班种类"
              clearable
            >
              <el-option
                v-for="dict in selectOption.flightKindlist"
                :key="dict.id"
                :label="dict.chineseName"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-button
        class="mt10"
        type="primary"
        icon="el-icon-search"
        size="mini"
        :loading="loading"
        @click="handleQuery"
        >搜索
      </el-button>
      <el-button
        class="mt10"
        icon="el-icon-refresh"
        size="mini"
        @click="resetQuery"
        >重置</el-button
      >
      <el-button
        class="mt10"
        type="primary"
        icon="el-icon-plus"
        size="mini"
        @click="handleAdd"
        v-hasPermi="['base:flightInfo:add']"
      >
        新增</el-button
      >
      <el-button
        class="mt10"
        type="primary"
        icon="el-icon-circle-check"
        size="mini"
        :disabled="ids.length == 0"
        @click="handleFlightStatus('flightStatus10')"
        v-hasPermi="['base:flightInfo:open']"
        >自动配舱开启</el-button
      >
      <el-button
        class="mt10"
        type="primary"
        icon="el-icon-circle-close"
        size="mini"
        :disabled="ids.length == 0"
        @click="handleFlightStatus('flightStatus80')"
        v-hasPermi="['base:flightInfo:close']"
        >自动配舱关闭</el-button
      >
      <el-button
        class="mt10"
        type="primary"
        icon="el-icon-circle-check"
        size="mini"
        :disabled="ids.length == 0"
        @click="autoPushBatch('open')"
        v-hasPermi="['base:flightInfo:autoPushOpen']"
        >自动推送开启</el-button
      >
      <el-button
        class="mt10"
        type="primary"
        icon="el-icon-circle-close"
        size="mini"
        :disabled="ids.length == 0"
        @click="autoPushBatch('close')"
        v-hasPermi="['base:flightInfo:autoPushClose']"
        >自动推送关闭</el-button
      >
      <el-button
        class="mt10"
        type="primary"
        icon="el-icon-circle-check"
        size="mini"
        :disabled="ids.length == 0"
        @click="whiteListSwitchStatus(1)"
        v-hasPermi="['base:flightInfo:whiteOpen']"
        >白名单自动配舱开启
      </el-button>
      <el-button
        class="mt10"
        type="primary"
        icon="el-icon-circle-close"
        size="mini"
        :disabled="ids.length == 0"
        @click="whiteListSwitchStatus(0)"
        v-hasPermi="['base:flightInfo:whiteClose']"
        >白名单自动配舱关闭
      </el-button>
      <el-button
        class="mt10"
        type="primary"
        icon="el-icon-circle-check"
        size="mini"
        :disabled="ids.length == 0"
        @click="BlackListSwitchStatus(1)"
        >黑名单自动配舱开启
      </el-button>
      <el-button
        class="mt10"
        type="primary"
        icon="el-icon-circle-close"
        size="mini"
        :disabled="ids.length == 0"
        @click="BlackListSwitchStatus(0)"
        >黑名单自动配舱关闭
      </el-button>
      <el-button
        class="mt10"
        type="danger"
        icon="el-icon-delete"
        size="mini"
        :disabled="ids.length == 0"
        @click="handleDelete"
        v-hasPermi="['base:flightInfo:delete']"
        >删除
      </el-button>
    </el-form>
    <Tables
      ref="flightInfoTable"
      ductName="FlightInformation"
      :data="findAllFltDatList"
      :headerData="tableHeader"
      :order="true"
      :selection="true"
      :totalCount="total"
      :loading="loading"
      :limitSize="queryParams.limitSize"
      :page="queryParams.pageNum"
      :shiftKey="shiftKey"
      :height="tableHeight"
      :pageSizes="[20, 30, 40, 50, 100]"
      @tableSelect="tableSelect"
      @tableSelectAll="tableSelectAll"
      @currentChange="currentChange"
      @sortChange="sortChange"
      @sizeChange="sizeChange"
    >
      <template slot="optionColumn">
        <el-table-column
          v-if="findAllFltDatList.length > 0"
          label="操作"
          align="center"
          class-name="small-padding fixed-width"
          :fixed="tableHeader.length > 10 ? 'right' : false"
          width="160"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['base:flightInfo:update']"
              >修改</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-link"
              @click="goFlightAllocConfig(scope.row)"
              >查看维度
            </el-button>
          </template>
        </el-table-column>
      </template>
    </Tables>
    <!-- 添加或修改对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="60%"
      :close-on-click-modal="false"
      :append-to-body="true"
      :show-close="false"
      @close="cancel"
    >
      <el-form
        ref="form"
        :model="form"
        :rules="rules"
        label-position="right"
        label-width="auto"
        size="small"
      >
        <el-row>
          <el-col :span="12">
            <el-form-item label="航班号" prop="fltNo">
              <el-input
                class="wid80"
                @blur="blurfltNo"
                :disabled="formdisabled.fltNo"
                v-model="form.fltNo"
                placeholder="请输入航班号"
                maxlength="20"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="该航班预审状态:">
              <el-tag
                v-if="preAudit"
                :type="preAudit == '开启' ? 'success' : 'info'"
                effect="dark"
                >{{ preAudit }}
              </el-tag>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="航班日期" prop="fltDate">
              <el-date-picker
                class="wid80"
                :disabled="formdisabled.fltDate"
                clearable
                size="small"
                v-model="form.fltDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="选择航班日期"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="航班种类" prop="kindId">
              <el-select
                class="wid80"
                v-model="form.kindId"
                :disabled="formdisabled.kindId"
                placeholder="请选择航班种类"
                @change="kindChange"
              >
                <el-option
                  v-for="item in selectOption.flightKindlist"
                  :key="item.id"
                  :label="item.chineseName"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="margin-bottom: 5px">
          <el-col :span="12">
            <el-form-item>
              <template slot="label">
                <div style="display: inline-block">
                  <span class="error-route">*</span>
                  航班路线
                  <el-tooltip
                    class="item"
                    effect="dark"
                    content="输入航班号后获取航线信息。航班种类为Purple Tail时可以进行多选,切换航班种类后需重新选择航线"
                    placement="top-start"
                  >
                    <span
                      class="el-icon-warning"
                      style="color: #1890ff; font-size: 16px"
                    ></span>
                  </el-tooltip>
                </div>
              </template>
              <el-select
                v-if="routeMultiple"
                ref="routeSelect"
                class="wid80"
                v-model="form.route"
                :disabled="formdisabled.route"
                placeholder="请选择航线"
                no-data-text="未查询到航线"
                @change="routeChange"
                @blur="blurRoute"
                :loading="routeLoading"
                :multiple="true"
              >
                <el-option
                  v-for="item in routeList"
                  :key="item.route"
                  :label="item.route"
                  :value="item.route"
                >
                  <span style="float: left">{{ item.route }}</span>
                  <span style="float: right; margin-right: 30px; color: #8492a6; font-size: 13px">{{
                    item.isEtesRoute == 'Y' ? '(ET86)' : ''
                  }}</span>
                </el-option>
              </el-select>
              <el-select
                v-if="routeMultiple == false"
                ref="routeSelect"
                class="wid80"
                v-model="form.route"
                :disabled="formdisabled.route"
                placeholder="请选择航线"
                no-data-text="未查询到航线"
                @change="routeChange"
                @blur="blurRoute"
                :loading="routeLoading"
                :multiple="false"
              >
                <el-option
                  v-for="item in routeList"
                  :key="item.id"
                  :label="item.route"
                  :value="item.route"
                >
                  <span style="float: left">{{ item.route }}</span>
                  <span style="float: right; margin-right: 30px; color: #8492a6; font-size: 13px">{{
                    item.isEtesRoute == 'Y' ? '(ET86)' : ''
                  }}</span>
                </el-option>
              </el-select>
              <span
                ref="errorRoute"
                class="el-form-item__error"
                v-show="routeError"
                >航班路线不能为空</span
              >
            </el-form-item>
            <div class="formTips" v-if="title == '修改航班信息'">
              注意!:移除航线,相对应日期级别航线维度会同时删除
            </div>
          </el-col>
          <el-col :span="12">
            <el-form-item label="航班类型" prop="typeId">
              <el-select
                class="wid80"
                v-model="form.typeId"
                placeholder="请选择航班类型"
              >
                <el-option
                  v-for="item in selectOption.flightTypelist"
                  :key="item.id"
                  :label="item.chineseName"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="航班状态" prop="statusId">
              <el-select
                class="wid80"
                :disabled="true"
                v-model="form.statusId"
                placeholder="请选择航班状态"
              >
                <el-option
                  v-for="item in selectOption.flightStatuslist"
                  :key="item.id"
                  :label="item.chineseName"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="原始重量(KG)" prop="originalWeight">
              <el-input-number
                class="wid80"
                @change="LowHighAvailable"
                :min="0"
                :precision="0"
                placeholder="请输入原始重量(KG)"
                v-model="form.originalWeight"
                v-input-filter
              ></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="额外增重百分比" prop="extraWeightPercent">
              <el-input-number
                class="wid80"
                @change="LowHighAvailable"
                :min="0"
                :precision="0"
                placeholder="请输入额外增重百分比"
                v-model="form.extraWeightPercent"
                v-input-filter
              ></el-input-number>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否开启高低价" prop="highLowPriceFlg">
              <el-switch
                class="wid80"
                @change="LowHighAvailable"
                v-model="form.highLowPriceFlg"
                :active-value="1"
                :inactive-value="0"
                active-color="#13ce66"
              >
              </el-switch>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="今日航班预审状态" prop="isNeedRequired">
              <el-select
                class="wid80"
                v-model="form.isNeedRequired"
                placeholder=""
              >
                <el-option label="未设置" :value="2"> </el-option>
                <el-option label="开启" :value="1"> </el-option>
                <el-option label="关闭" :value="0"> </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="高价百分比" prop="highPriceWeightPercent">
              <el-input-number
                class="wid80"
                :disabled="ishighPriceWeightPercent"
                @change="LowHighAvailable"
                placeholder="开启高低价后可修改"
                v-model="form.highPriceWeightPercent"
              ></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="低价百分比" prop="lowPriceWeightPercent">
              <el-input-number
                class="wid80"
                :disabled="true"
                placeholder="开启高低价后计算"
                v-model="form.lowPriceWeightPercent"
              ></el-input-number>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="高价可配重量" prop="highAvailableWeight">
              <el-input-number
                class="wid80"
                :disabled="true"
                placeholder="开启高低价后计算"
                v-model="form.highAvailableWeight"
                :precision="2"
              ></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="低价可配重量" prop="lowAvailableWeight">
              <el-input-number
                class="wid80"
                :disabled="true"
                placeholder="开启高低价后计算"
                v-model="form.lowAvailableWeight"
                :precision="2"
              ></el-input-number>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="高价已配重量" prop="highAllocatedWeight">
              <el-input-number
                class="wid80"
                :disabled="true"
                placeholder="请输入高价已配重量"
                v-model="form.highAllocatedWeight"
                :precision="2"
              ></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="低价已配重量" prop="lowAllocatedWeight">
              <el-input-number
                class="wid80"
                :disabled="true"
                placeholder="请输入低价已配重量"
                v-model="form.lowAllocatedWeight"
                :precision="2"
              ></el-input-number>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="已配总重量" prop="alloctedWeight">
              <el-input-number
                class="wid80"
                :disabled="true"
                placeholder="请输入已配总重量"
                v-model="form.alloctedWeight"
                :precision="2"
              ></el-input-number>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="特殊规则预留总重量" prop="accountTotalWeight">
              <el-input-number
                class="wid80"
                v-model="form.accountTotalWeight"
                disabled
                placeholder="配置特殊规则后计算"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="特殊规则已配重量"
              prop="accountAllocatedWeight"
            >
              <el-input-number
                class="wid80"
                v-model="form.accountAllocatedWeight"
                disabled
                placeholder="配置特殊规则后计算"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog
      title="未删除成功航班"
      width="40%"
      center
      :visible.sync="dialogTableVisible"
      :close-on-click-modal="false"
      :append-to-body="true"
      :close-on-press-escape="false"
    >
      <el-table :data="gridData">
        <el-table-column property="fltNo" label="航班号"></el-table-column>
        <el-table-column property="fltDate" label="航班日期"></el-table-column>
        <el-table-column
          property="alloctedWeight"
          label="已配重量"
        ></el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import {
  delFlight,
  findFltConditionDataApi,
  findAllFltDataApi,
  findFltById,
  saveOrUpdate,
  findFltCommonConf,
  updateStatusBatch,
  updateAutoPushBatch,
  updateWhiteListSwitchBatch,
  updateBlackListSwitchBatch,
} from "@/api/findAllFltData";
import { getpreAudit } from "@/api/system/preReview.js";
import { queryRouteByFltNo } from "@/api/destinationFlight.js";
import { queryRoute } from "@/api/system/dictionary.js";
export default {
  name: "FlightInformationMaintenance",
  data() {
    return {
      //查询参数
      queryParams: {
        limitStart: 0, //当前条数【代表第几条数据 +1开始】
        pageNum: 1,
        limitSize: 20, //一页显示多少条数据
        fltDateStart: undefined, //航班日期开始
        fltDateEnd: undefined, //航班日期结束
        typeId: undefined, //航班类型
        statusId: undefined, //航班状态
        flightKindId: undefined, //航班种类
        fltNo: undefined, //航班号,要大写
      },
      //表单参数
      form: {
        isNeedRequired: 2,
      },
      routeList: [],
      //表单校验
      rules: {
        fltNo: [
          {
            required: true,
            message: "航班号不能为空",
            trigger: "blur",
          },
        ],
        fltDate: [
          {
            required: true,
            message: "航班日期不能为空",
            trigger: "blur",
          },
        ],
        kindId: [
          {
            required: true,
            message: "航班种类不能为空",
            trigger: "change",
          },
        ],
        originalWeight: [
          {
            required: true,
            message: "原始重量(KG)不能为空",
            trigger: ["change", "blur"],
          },
        ],
      },
      //原航班规则数据
      findAllFltDatList: [],
      //表头
      tableHeader: this.tableHeaders["FlightInformation"],
      //删除失败数据
      gridData: [],
      //form属性禁用状态
      formdisabled: {
        //航班号
        fltNo: false,
        //航班日期
        fltDate: false,
        //航班种类
        kindId: false,
        //航班类型
        typeId: false,
        //航线
        route: false,
        //原始重量
        originalWeight: false,
      },
      //下拉框数据
      selectOption: {
        //航班种类
        flightKindlist: [],
        //航班状态
        flightStatuslist: [],
        //航班类型
        flightTypelist: [],
        //cutOffTime数据
        cutOffTime: [
          "00:00:00",
          "00:30:00",
          "01:00:00",
          "01:30:00",
          "02:00:00",
          "02:30:00",
          "03:00:00",
          "03:30:00",
          "04:00:00",
          "04:30:00",
          "05:00:00",
          "05:30:00",
          "06:00:00",
          "06:30:00",
          "07:00:00",
          "07:30:00",
          "08:00:00",
          "08:30:00",
          "09:00:00",
          "09:30:00",
          "10:00:00",
          "10:30:00",
          "11:00:00",
          "11:30:00",
          "12:00:00",
          "12:30:00",
          "13:00:00",
          "13:30:00",
          "14:00:00",
          "14:30:00",
          "15:00:00",
          "15:30:00",
          "16:00:00",
          "16:30:00",
          "17:00:00",
          "17:30:00",
          "18:00:00",
          "18:30:00",
          "19:00:00",
          "19:30:00",
          "20:00:00",
          "20:30:00",
          "21:00:00",
          "21:30:00",
          "22:00:00",
          "22:30:00",
          "23:00:00",
          "23:30:00",
        ],
      },
      //选中数组
      ids: [],
      //目的航班数据
      sourceFlightAndFlightDate: [],
      //航线数据
      routeList: [],
      //航线多选状态
      routeMultiple: false,
      //航班预审状态
      preAudit: null,
      //高价百分比是否打开
      ishighPriceWeightPercent: true,
      //遮罩层
      loading: false,
      routeLoading: false,
      //遮罩层
      loadingFlightDate: false,
      //删除失败弹框
      dialogTableVisible: false,
      //弹出层标题
      title: "",
      //总条数
      total: 0,
      //表格高度
      tableHeight: null,
      //新增修改查看规则弹出层
      open: false,
      //是否显示查看目的航班弹出层
      openFlightDate: false,
      //shift键状态
      shiftKey: false,
      routeError: false, // 请选择航线错误显示
    };
  },
  directives: {
    // 处理加减天数
    "input-filter": {
      bind: function (el, binding, { context }) {
        el.handler = function (event) {
          if (event.data == "E" || event.data == "e") {
            // 无理数时
            event.target.value = "";
          }
          if (event.target.value) {
            if (Number(event.target.value) < 0) {
              event.target.value = "";
            }
            event.target.dispatchEvent(new Event("input"));
          }
        };
        el.addEventListener("input", el.handler);
      },
      unbind: function (el) {
        el.removeEventListener("input", el.handler);
      },
    },
  },
  created() {
    //查询条件数据源
    this.queryParams.fltDateStart = this.nowDate();
    if (this.$store.state.tagsView.cachedViews.length == 0) {
      this.findFltConditionData();
      this.findAllFltData();
    }
    // this.$nextTick(()=>{
    //   let height = window.innerHeight - this.$refs.queryForm.$el.offsetHeight - 120;
    //   if(height < 300){
    //      this.tableHeight = 300;
    //    }else{
    //      this.tableHeight = height;
    //    }
    // })
  },
  activated() {
    this.ids = [];
    this.findFltConditionData();
    this.findAllFltData();
  },
  deactivated() {
    this.findAllFltDatList = [];
  },
  mounted() {
    window.addEventListener("keydown", (code) => {
      if (code.keyCode === 16 && code.shiftKey) {
        this.shiftKey = true;
      }
    });
    window.addEventListener("keyup", (code) => {
      if (code.keyCode === 16) {
        this.shiftKey = false;
      }
    });
    this.tableHeight =
      window.innerHeight - this.$refs.queryForm.$el.offsetHeight - 120;
  },
  methods: {
    //输入航班号后
    blurfltNo() {
      // this.routeList = []
      this.form.accountTotalWeight = 0;
      this.form.accountAllocatedWeight = 0;
      if (
        this.form.fltNo != null &&
        this.form.fltNo != undefined &&
        this.form.fltNo != ""
      ) {
        this.form.fltNo = this.form.fltNo.toUpperCase();
        this.perStatus(this.form.fltNo);
        findFltCommonConf(this.form).then((response) => {
          if (response.code == 200) {
            //额外增重百分比:根据已存在的相同航班号对应的最新值进行设置,如果无相同航班号,按照默认设置为0,不可编辑
            if (
              response.data != null &&
              response.data.extraWeightPercent != null &&
              response.data.extraWeightPercent != undefined
            ) {
              this.$set(
                this.form,
                "extraWeightPercent",
                response.data.extraWeightPercent
              );
              // this.form.extraWeightPercent=response.data.extraWeightPercent;
            } else {
              this.$set(this.form, "extraWeightPercent", 0);
              //this.form.extraWeightPercent=response.data.extraWeightPercent=0;
            }
            //是否开启高低价:根据已存在的相同航班号对应的最新值进行设置,如果无相同航班号,按照默认设置‘是否开启高低价’ 为是,不可编辑
            // if (
            //   response.data != null &&
            //   response.data.highLowPriceFlg != null &&
            //   response.data.highLowPriceFlg != undefined
            // ) {
            //   this.form.highLowPriceFlg = response.data.highLowPriceFlg;
            // } else {
            this.$set(this.form, "highLowPriceFlg", 0);
            //   //this.form.highLowPriceFlg = true;
            // }
            //高/低价百分比:根据已存在的相同航班号对应的最新值进行设置,如果无相同航班号,按照默认设置‘高价百分比’60%,‘低价百分比’40%,不可编辑
            if (
              response.data != null &&
              response.data.highPriceWeightPercent != null &&
              response.data.highPriceWeightPercent != undefined
            ) {
              this.form.highPriceWeightPercent =
                response.data.highPriceWeightPercent;
            } else {
              this.form.highPriceWeightPercent = 60;
            }
            if (
              response.data != null &&
              response.data.lowPriceWeightPercent != null &&
              response.data.lowPriceWeightPercent != undefined
            ) {
              this.form.lowPriceWeightPercent =
                response.data.lowPriceWeightPercent;
            } else {
              this.form.lowPriceWeightPercent = 40;
            }
            this.LowHighAvailable();
          } else {
            this.msgError(response.msg);
          }
        });
        this.routeLoading = true;
        //获取航线
        queryRouteByFltNo({ fltNo: this.form.fltNo })
          .then((res) => {
            this.routeLoading = false;
            if (res.code === 200) {
              if (res.data.list.length) {
                this.routeList = res.data.list;
              }
              if (res.data.list.length == 0) {
                this.form.route = "";
                this.routeList = [];
                this.msgError("该航班没有设置航线");
              }
            } else {
              this.msgWarning(res.msg);
            }
          })
          .catch((err) => {
            this.routeLoading = false;
            console.log(err);
          });
      } else {
        this.form.route = "";
        this.routeList = [];
      }
    },
    //航班种类修改
    kindChange(val) {
      this.selectOption.flightKindlist.forEach((item) => {
        if (item.id == val) {
          if (item.chineseName.indexOf("White") >= 0) {
            this.routeMultiple = false;
            this.form.route = "";
          } else if (item.chineseName.indexOf("Purple") >= 0) {
            this.routeMultiple = true;
            this.form.route = [];
          }
          this.routeError = true;
        }
      });
      // this.$refs.routeSelect.$forceUpdate()
    },
    //查询条件数据源
    findFltConditionData() {
      findFltConditionDataApi().then((response) => {
        if (response.code == 200) {
          //航班种类
          this.selectOption.flightKindlist = response.data.flightKind;
          //航班类型
          this.selectOption.flightTypelist = response.data.flightType;
          //航班状态
          this.selectOption.flightStatuslist = response.data.flightStatus;
        } else {
          this.msgError(response.msg);
        }
      });
    },
    //获取航班预审状态
    perStatus(val) {
      getpreAudit({ fltNo: val, page: 1, size: 20 })
        .then((res) => {
          if (res.code === 200) {
            this.preAudit =
              res.data.list.length == 0
                ? "关闭"
                : res.data.list[0].status == 0
                ? "关闭"
                : res.data.list[0].status == 1
                ? "开启"
                : "";
          } else {
            this.msgWarning(res.msg);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    /** 航班信息维护查询*/
    findAllFltData() {
      this.ids = [];
      this.loading = true;
      if (this.queryParams.pageNum > 1) {
        this.queryParams.limitStart =
          (this.queryParams.pageNum - 1) * this.queryParams.limitSize;
      } else {
        this.queryParams.limitStart = 0;
      }
      if (
        this.queryParams.fltNo != null &&
        this.queryParams.fltNo != undefined &&
        this.queryParams.fltNo != ""
      ) {
        this.queryParams.fltNo = this.queryParams.fltNo.toUpperCase();
      }
      findAllFltDataApi(this.queryParams).then((response) => {
        this.loading = false;
        if (response.code == 200) {
          this.findAllFltDatList = response.data.list;
          this.total = response.data.totalCount;
        } else {
          this.msgError(response.msg);
        }
      });
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.findFltConditionData();
      this.preAudit = null;
      this.open = true;
      this.title = "添加航班信息";
      this.form.id = null;
      this.form.statusId = this.selectOption.flightStatuslist[0].id;
      this.form.alloctedWeight = 0; //已配重量
      this.form.lowAllocatedWeight = 0; //低价已配重量
      this.form.highAllocatedWeight = 0; //高价已配重量
      //航班号
      this.formdisabled.fltNo = false;
      //航班日期
      this.formdisabled.fltDate = false;
      //航班种类
      this.formdisabled.kindId = false;
      //航线
      this.formdisabled.route = false;
      //航班类型
      this.formdisabled.typeId = false;
      //原始重量
      this.formdisabled.originalWeight = false;
      this.routeError = false;
      this.$nextTick(() => {
        this.$refs.form.clearValidate();
      });
    },
    //计算高低价可配
    LowHighAvailable() {
      //判断是否开启高低价
      if (this.form.highLowPriceFlg) {
        this.ishighPriceWeightPercent = false;
        let Weight = 0;
        //计算实际重量
        if (
          this.form.highPriceWeightPercent > 0 ||
          this.form.lowPriceWeightPercent > 0
        ) {
          Weight = this.Weightall();
        }
        //高价可配
        if (this.form.highPriceWeightPercent >= 0) {
          this.$set(
            this.form,
            "highAvailableWeight",
            (Weight -
              this.form.accountTotalWeight -
              (this.form.alloctedWeight - this.form.accountAllocatedWeight)) *
              (this.form.highPriceWeightPercent / 100)
          );
          this.$set(
            this.form,
            "lowPriceWeightPercent",
            100 - this.form.highPriceWeightPercent
          );
          // this.form.HighAvailableWeight = Weightall * (this.form.highPriceWeightPercent / 100)
        } else if (
          this.title == "修改航班信息" &&
          this.form.highPriceWeightPercent > 0
        ) {
          if (this.form.highAvailableWeight) {
            this.$set(
              this.form,
              "highAvailableWeight",
              this.form.highAvailableWeight
            );
          } else {
            this.$set(
              this.form,
              "highAvailableWeight",
              (Weight - this.form.alloctedWeight) *
                (this.form.highPriceWeightPercent / 100)
            );
          }
        } else {
          this.$set(this.form, "highAvailableWeight", 0);
          // this.form.HighAvailableWeight = 0;
        }
        //低价可配
        if (this.form.lowPriceWeightPercent > 0) {
          this.$set(
            this.form,
            "lowAvailableWeight",
            Weight -
              this.form.accountTotalWeight -
              (this.form.alloctedWeight - this.form.accountAllocatedWeight) -
              this.form.highAvailableWeight
          );
          //this.form.lowAvailableWeight = Weightall - this.form.HighAvailableWeight;
        } else if (
          this.title == "修改航班信息" &&
          this.form.lowPriceWeightPercent > 0
        ) {
          if (this.form.lowAvailableWeight) {
            this.$set(
              this.form,
              "lowAvailableWeight",
              this.form.lowAvailableWeight
            );
          } else {
            this.$set(
              this.form,
              "lowAvailableWeight",
              Weight - this.form.alloctedWeight - this.form.highAvailableWeight
            );
          }
        } else {
          this.$set(this.form, "lowAvailableWeight", 0);
          // this.form.lowAvailableWeight = 0;
        }
      } else {
        this.ishighPriceWeightPercent = true;
      }
    },
    //计算实际重量
    Weightall() {
      let Weight = 0;
      if (this.form.extraWeightPercent > 0) {
        Weight =
          this.form.originalWeight * (this.form.extraWeightPercent / 100) +
          this.form.originalWeight;
      } else {
        Weight = this.form.originalWeight;
      }
      return Weight;
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      if (row.statusName == "已删除") {
        this.msgError("已删除不可操作");
        return;
      }
      this.reset();
      this.findFltConditionData();
      this.perStatus(row.fltNo);
      this.open = true;
      this.title = "修改航班信息";
      //航班号
      this.formdisabled.fltNo = true;
      //航班日期
      this.formdisabled.fltDate = true;
      //航班种类
      this.formdisabled.kindId = true;

      //根据ID查item
      findFltById(row).then((response) => {
        if (response.code == 200) {
          this.form = response.data;
          this.form.route = this.form.route.split(";");
          //是否开启高低价
          // this.form.highLowPriceFlg = this.form.highLowPriceFlg === 1 ? true : false;
          //是否预审
          // this.form.isNeedRequired = this.form.isNeedRequired === 1 ? true : false;
          // 计算高低价可配
          // this.LowHighAvailable();

          //航线
          this.selectOption.flightKindlist.forEach((item) => {
            if (item.id == this.form.kindId) {
              if (item.chineseName.indexOf("White") >= 0) {
                this.formdisabled.route = true;
              } else if (item.chineseName.indexOf("Purple") >= 0) {
                this.formdisabled.route = false;
                this.routeMultiple = true;
                //获取航线
                queryRouteByFltNo({ fltNo: this.form.fltNo })
                  .then((res) => {
                    this.routeLoading = false;
                    if (res.code === 200) {
                      if (res.data.list.length) {
                        this.routeList = res.data.list;
                      } else {
                        this.routeList = [];
                      }
                    } else {
                      this.msgWarning(res.msg);
                    }
                  })
                  .catch((err) => {
                    this.routeLoading = false;
                    console.log(err);
                  });
              }
            }
          });
          this.ishighPriceWeightPercent =
            this.form.highLowPriceFlg === 1 ? false : true;
        } else {
          this.msgError(response.msg);
        }
      });
    },
    /*
       查看航班维度
       不仅分为航班种类又分当前航班航线是不是ET86,
       如果航班航种类是Purple Tail,遍历航班航线查询的是不是全都是ET86航线,如果全部是ET86航线,那么不做跳转。
       如果是White Tail也就是只差当前的一条航班航线,如果当前航班航线是ET86航线那么就不做跳转;
    */
    goFlightAllocConfig(row) {
      if (row.statusName == "已删除") {
        this.msgError("已删除不可操作");
        return;
      }
      let params = {
        fltNo: row.fltNo,
        page: 1,
        size: 20,
      };
      let routeInfo = {
        fltNo: "",
        isEtesRoute: false,
        fltRoute: "",
      };
      queryRoute(params)
        .then((res) => {
          const { code, data } = res;
          const et86RouteList = [];
          if (code == 200) {
            if (data.list.length) {
              // Purple Tail是不是全部是ET86航线
              routeInfo.isEtesRoute = data.list.every(
                (item) => item.isEtesRoute == "Y"
              );
              // 有没有ET86航线
              const isEtesRoute = data.list.filter(
                (item) => item.isEtesRoute == "Y"
              );
              // 处理alert提示语展示数据
              if (isEtesRoute.length) {
                isEtesRoute.map((item) => {
                  et86RouteList.push(item.route);
                });
                routeInfo.fltNo = row.fltNo;
                routeInfo.fltRoute = et86RouteList;
              }
              // White Tail 当前航线在航班航线中是否为ET86航线
              if (row.flightKindName == "White Tail") {
                if (isEtesRoute.length) {
                  let whiteEt86 = isEtesRoute.filter(
                    (item) => item.route == row.route
                  );
                  routeInfo.isEtesRoute = whiteEt86.length;
                }
              }
            } else {
              this.msgError("暂无当前航班航线");
            }
            if (routeInfo.isEtesRoute) {
              let msg = routeInfo.fltNo + ": " + routeInfo.fltRoute.join(";");
              this.$alert(
                `当前${msg}为ET86航线,不可操作该按钮。可在ET86规则界面维护。`,
                "提示",
                {
                  confirmButtonText: "关闭",
                  callback: (action) => {},
                }
              );
              return;
            }
            this.$router.push({
              path: "/routeInfo",
              query: {
                flightDate: row.fltDate,
                purposeOfFlightNo: row.fltNo,
                flightRouteListStr: row.route,
                status: row.status,
                flightKindName: row.flightKindName,
                pageName: "flightInformationMaintenance",
                disable: true,
              },
            });
          }
        })
        .catch(() => {});
    },
    // 航班状态
    flightState(multipleSelection, statusName) {
      let flightState = multipleSelection.some(
        (item) => item.statusName == statusName
      );
      if (flightState) {
        this.msgError(`勾选的航班,航班状态为${statusName},不可操作该按钮`);
      } else {
        flightState = false;
      }
      return flightState;
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      let fIds = [];
      this.ids.forEach((item) => {
        fIds.push(item.id);
      });
      // 航班状态
      if (this.flightState(this.ids, "已删除")) return;
      this.$confirm("是否确认删除所选数据?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return delFlight(fIds);
        })
        .then((response) => {
          this.findAllFltData();
          if (response.data.length > 0) {
            this.gridData = response.data;
            this.$confirm(response.msg, "提示", {
              confirmButtonText: "查看删除失败航班信息",
              cancelButtonText: "取消",
              type: "warning",
              center: true,
            })
              .then(() => {
                this.dialogTableVisible = true;
              })
              .catch(() => {});
          } else {
            this.msgSuccess(response.msg);
          }
        })
        .catch(() => {});
    },

    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate((valid) => {
        if (this.form.route == undefined) {
          this.routeError = true;
          return;
        }
        if (this.form.route.length || this.form.route !== undefined) {
          this.routeError = false;
        }

        if (this.form.route.length == 0) {
          this.routeError = true;
          return;
        }
        if (valid) {
          let formdata = JSON.parse(JSON.stringify(this.form));
          //高价百分比和低价百分比和不可以大于100
          if (
            this.form.highLowPriceFlg &&
            (formdata.highPriceWeightPercent > 100 ||
              formdata.highPriceWeightPercent < 0)
          ) {
            this.$message.warning("请正确填写高低价百分比");
            return;
          }
          //已删除的无法修改
          //拿到已删除的id
          let statusId = 0;
          this.selectOption.flightStatuslist.map((item) => {
            //  this.unitList 是你 select option遍历的集合 e 是选中的id
            if (item.chineseName === "已删除") {
              statusId = item.id;
              return;
            }
          });
          if (statusId === formdata.statusId) {
            this.$message.warning("已删除的航班无法修改");
            return;
          }
          //是否开启高低价
          // formdata.highLowPriceFlg = formdata.highLowPriceFlg ? 1 : 0;
          //是否预审
          // formdata.isNeedRequired = formdata.isNeedRequired ? 1 : 0;
          //总重量更新
          // formdata.totalWeight = this.Weightall()
          formdata.route = this.form.route.toString().replace(/,/g, ";");
          if (
            this.form.extraWeightPercent == undefined ||
            this.form.extraWeightPercent == null
          ) {
            formdata.extraWeightPercent = 0;
          }
          //处理数据
          saveOrUpdate(formdata).then((response) => {
            if (response.code === 200) {
              this.msgSuccess("保存成功");
              this.routeList = [];
              this.open = false;
              this.findAllFltData();
            } else {
              this.msgError(response.msg);
            }
          });
        }
      });
    },
    //表单重置
    reset() {
      this.form = { isNeedRequired: 2 };
      this.resetForm("form");
    },
    //取消按钮
    cancel() {
      this.routeError = false;
      this.routeList = [];
      this.ishighPriceWeightPercent = true;
      this.routeMultiple = false;
      this.routeLoading = false;
      this.open = false;
      this.findAllFltData();
      this.findFltConditionData();
      this.reset();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.queryParams.start = 0;
      this.findAllFltData();
    },
    //批量开启/关闭航班
    handleFlightStatus(status) {
      // 航班状态
      if (this.flightState(this.ids, "已删除")) return;
      let handle = status == "flightStatus80" ? "关闭" : "开启";
      let state = this.ids.some((item) => item.statusName == `已${handle}`);
      if (state) {
        this.msgError(`勾选的航班,航班状态为已${handle},不可操作该按钮`);
        return;
      }
      let data = {
        updateIds: [],
      };
      this.ids.map((item) => {
        data.status = status;
        if (status === "flightStatus80") {
          if (item.statusName === "已开启") {
            data.updateIds.push(item.id);
          }
        } else {
          if (item.statusName === "已关闭") {
            data.updateIds.push(item.id);
          }
        }
      });
      if (data.updateIds.length > 0) {
        updateStatusBatch(data).then((response) => {
          if (response.code === 200) {
            this.msgSuccess(handle + "成功");
            this.findAllFltData();
          } else {
            this.msgError(response.msg);
          }
        });
      }
    },
    //自动推送开关
    autoPushBatch(status) {
      // 航班状态
      if (this.flightState(this.ids, "已删除")) return;
      let msg = status == "open" ? "开启" : "关闭";
      let data = {
        updateIds: [],
      };
      this.ids.map((item) => {
        if (status === "open") {
          data.status = "1";
          if (item.pushDateSwitch != "1") {
            data.updateIds.push(item.id);
          }
        } else if (status === "close") {
          data.status = "2";
          if (item.pushDateSwitch != "2") {
            data.updateIds.push(item.id);
          }
        }
      });
      if (data.updateIds.length > 0) {
        updateAutoPushBatch(data)
          .then((res) => {
            if (res.code === 200) {
              this.msgSuccess(`自动推送${msg}成功`);
              this.findAllFltData();
            } else {
              this.msgError(res.msg);
            }
          })
          .catch((err) => {
            this.msgError(err);
          });
      } else {
        this.msgSuccess(`自动推送${msg}成功`);
        this.findAllFltData();
      }
    },
    //白名单配舱开关
    whiteListSwitchStatus(val) {
      // 航班状态
      if (this.flightState(this.ids, "已删除")) return;
      let obj = {
        updateIds: [],
      };
      obj.status = val;
      this.ids.forEach((item) => {
        obj.updateIds.push(item.id);
      });
      updateWhiteListSwitchBatch(obj)
        .then((res) => {
          if (res.code === 200) {
            this.msgSuccess(res.msg);
            this.findAllFltData();
          } else {
            this.msgWarning(res.msg);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    //黑名单配舱开关
    BlackListSwitchStatus(val) {
      // 航班状态
      if (this.flightState(this.ids, "已删除")) return;
      let obj = {
        updateIds: [],
      };
      obj.status = val;
      this.ids.forEach((item) => {
        obj.updateIds.push(item.id);
      });
      updateBlackListSwitchBatch(obj)
        .then((res) => {
          if (res.code === 200) {
            this.msgSuccess(res.msg);
            this.findAllFltData();
          } else {
            this.msgWarning(res.msg);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    //航线修改
    routeChange(val) {
      if (this.form.route.length) {
        this.routeError = false;
      } else {
        this.routeError = true;
      }
      this.$forceUpdate();
    },
    blurRoute() {
      if (this.form.route !== undefined && this.form.route.length) {
        this.routeError = false;
      } else {
        this.routeError = true;
      }
    },
    //多选框选中数据
    tableSelect(val) {
      this.ids = val.selection;
    },
    //全选
    tableSelectAll(val) {
      this.ids = val;
    },
    //分页
    currentChange(val) {
      this.queryParams.pageNum = val.page;
      this.findAllFltData();
    },
    //排序
    sortChange(val) {
      console.log(val);
    },
    //每页长度
    sizeChange(val) {
      this.queryParams.limitSize = val;
      this.queryParams.pageNum = 1;
      this.findAllFltData();
    },
    setClose() {
      this.tableHeader = this.tableHeaders["FlightInformation"];
    },
  },
  computed: {
    route: {
      get: function () {
        return this.form.route;
      },
      set: function (val) {
        this.form.route = this.upCase(val);
      },
    },
  },
};
</script>

<style>
.el-table--striped .el-table__body tr.el-table__row--striped.current-row td,
.el-table__body tr.current-row > td {
  background-color: #a0cfff;
}

.el-table--striped .el-table__body tr.hover-row.el-table__row--striped > td,
.el-table__body tr.hover-row > td {
  background-color: #d9ecff !important;
}

.formTips {
  width: 85%;
  color: #ff4949;
  text-align: right;
}
.error-route {
  color: #ff4949;
}
</style>