routeInfo.vue 21.7 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
<template>
  <div ref="routeInfo" class="route-container">
    <el-collapse
      value="1"
      accordion
      v-model="activeNames"
      @change="collapseChange"
    >
      <el-collapse-item
        v-for="(item, index) in routesInfo"
        :key="item.route"
        :name="index"
      >
        <!-- 航线名 -->
        <template slot="title">
          <strong>{{ item.route }}</strong>
        </template>
        <!-- 航线设置信息 -->
        <div class="route-info info-item">
          <el-card class="route-info-card">
            <!-- 有数据时 -->
            <section v-if="item.config">
              <div slot="header" class="route-config-header">
                <el-button
                  type="primary"
                  size="mini"
                  :disabled="item.status == '3' || status"
                  :loading="item.loading"
                  >保 存</el-button
                >
                <el-button
                  v-if="showBtnRule(item)"
                  type="primary"
                  size="mini"
                  icon="el-icon-video-pause"
                  :loading="item.loading"
                  :disabled="status"
                  >{{ item.status | statusBtn }}</el-button
                >
                <el-button
                  v-if="showBtnRule(item)"
                  type="danger"
                  size="mini"
                  icon="el-icon-delete"
                  :disabled="item.status !== '3' || status"
                  :loading="item.loading"
                  >删 除</el-button
                >
                <span class="flight-route-title">
                  {{ item.ruleDate ? "日期级别规则" : "普通规则" }}</span
                >
              </div>
              <el-divider></el-divider>
              <div class="route-config-info">
                <el-form label-position="right" label-width="120px">
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="始发站">
                        <el-col :span="2">
                          <el-radio-group
                            v-model="item.isLocation"
                            @change="changeLocation"
                            :disabled="status"
                          >
                            <el-radio label="1">包含始发站</el-radio>
                            <el-radio label="2">不包含始发站</el-radio>
                          </el-radio-group>
                        </el-col>
                        <el-col :span="10">
                          <el-input
                            v-if="item.isLocation == '1'"
                            :disabled="status"
                            type="textarea"
                            v-model="item.location"
                            :rows="4"
                            placeholder="始发站之间用回车符分隔"
                            style="width: 500px"
                          >
                          </el-input>
                          <el-input
                            v-else
                            :disabled="status"
                            type="textarea"
                            v-model="item.notLocation"
                            :rows="4"
                            placeholder="始发站之间用回车符分隔"
                            style="width: 500px"
                          >
                          </el-input>
                        </el-col>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="目的站">
                        <el-col :span="2">
                          <el-radio-group
                            :disabled="status"
                            v-model="item.isDestinationSite"
                            @change="changeDestinationSite"
                          >
                            <el-radio label="1">包含目的站</el-radio>
                            <el-radio label="2">不包含目的站</el-radio>
                          </el-radio-group>
                        </el-col>
                        <el-col :span="10">
                          <el-input
                            v-if="item.isDestinationSite == '1'"
                            :disabled="status"
                            type="textarea"
                            v-model="item.destinationSite"
                            :rows="4"
                            placeholder="目的站之间用回车符分隔"
                            style="width: 500px"
                          >
                          </el-input>
                          <el-input
                            v-else
                            :disabled="status"
                            type="textarea"
                            v-model="item.notDestinationSite"
                            :rows="4"
                            placeholder="目的站之间用回车符分隔"
                            style="width: 500px"
                          >
                          </el-input>
                        </el-col>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-col :span="10">
                        <el-form-item label="URSA包含">
                          <el-input
                            :disabled="status"
                            type="textarea"
                            v-model="item.includeUrsa"
                            :rows="4"
                            placeholder="URSA之间用分号分隔,例:F2;F3;P_"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="10">
                        <el-form-item label="URSA不包含">
                          <el-input
                            :disabled="status"
                            type="textarea"
                            v-model="item.notIncludeUrsa"
                            :rows="4"
                            placeholder="URSA之间用分号分隔,例:F2;F3;P_"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                    </el-col>
                    <el-col :span="24">
                      <el-col :span="9">
                        <el-form-item label="件数">
                          <el-col :span="10">
                            <el-input
                              :disabled="status"
                              class="numberInput"
                              v-model.trim="item.minNumOfPieces"
                            >
                            </el-input>
                            <span
                              ref="minNumOfPieces"
                              class="el-form-item__error"
                            ></span>
                          </el-col>
                          <el-col style="text-align: center" :span="1"
                            >-</el-col
                          >
                          <el-col :span="10">
                            <el-input
                              :disabled="status"
                              class="numberInput"
                              v-model.trim="item.maxNumOfPieces"
                            >
                            </el-input>
                          </el-col>
                        </el-form-item>
                      </el-col>
                      <el-col :span="9">
                        <el-form-item label="重量(KG)">
                          <el-col :span="10">
                            <el-input
                              :disabled="status"
                              class="numberInput"
                              v-model.trim="item.minWeight"
                            >
                            </el-input>
                            <span
                              ref="minWeight"
                              class="el-form-item__error"
                            ></span>
                          </el-col>
                          <el-col style="text-align: center" :span="1"
                            >-</el-col
                          >
                          <el-col :span="10">
                            <el-input
                              :disabled="status"
                              class="numberInput"
                              v-model.trim="item.maxWeight"
                            >
                            </el-input>
                          </el-col>
                        </el-form-item>
                      </el-col>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="申报类别">
                        <el-card shadow="never" style="width: 95%">
                          <el-checkbox-group
                            :disabled="status"
                            v-model="item.typeOfGoods"
                            @change="changeCargoType"
                          >
                            <el-row>
                              <el-col
                                v-for="item in cargoType"
                                :span="2"
                                :key="item.id"
                              >
                                <el-checkbox
                                  :label="item.chineseName"
                                  :name="item.chineseName"
                                  :key="item.code"
                                >
                                  <Tooltips
                                    :content="item.chineseName"
                                    :refName="item.code"
                                  >
                                  </Tooltips>
                                </el-checkbox>
                              </el-col>
                            </el-row>
                          </el-checkbox-group>
                        </el-card>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="货物类型">
                        <el-card shadow="never" style="width: 95%">
                          <el-checkbox-group
                            :disabled="status"
                            v-model="item.cargoType"
                            @change="changeCargoStatus"
                          >
                            <el-row>
                              <el-col
                                :span="3"
                                v-for="item in cargoStatus"
                                :key="item.id"
                              >
                                <el-checkbox
                                  :label="item.chineseName"
                                  :name="item.chineseName"
                                  :key="item.code"
                                  disabled
                                >
                                  <Tooltips
                                    :content="item.chineseName"
                                    :refName="item.code"
                                  >
                                  </Tooltips>
                                </el-checkbox>
                              </el-col>
                            </el-row>
                          </el-checkbox-group>
                        </el-card>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="取件扫描号">
                        <el-card shadow="never" style="width: 95%">
                          <el-checkbox-group
                            :disabled="status"
                            v-model="item.puporpuxCode"
                            @change="changePuporpux"
                          >
                            <el-row>
                              <el-col
                                :span="2"
                                v-for="item in puporpux"
                                :key="item.id"
                              >
                                <el-checkbox
                                  :label="item.chineseName"
                                  :name="item.chineseName"
                                  :key="item.code"
                                >
                                  <Tooltips
                                    :content="item.chineseName"
                                    :refName="item.code"
                                  >
                                  </Tooltips>
                                </el-checkbox>
                              </el-col>
                            </el-row>
                          </el-checkbox-group>
                        </el-card>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="Service Code">
                        <el-card shadow="never" style="width: 95%">
                          <el-checkbox-group
                            :disabled="status"
                            v-model="item.serviceCode"
                            @change="changeServiceCode"
                          >
                            <el-row>
                              <el-col
                                :span="2"
                                v-for="item in serviceCode"
                                :key="item.id"
                              >
                                <el-checkbox
                                  :label="item.chineseName"
                                  :name="item.chineseName"
                                  :key="item.code"
                                >
                                  <Tooltips
                                    :content="item.chineseName"
                                    :refName="item.code"
                                  >
                                  </Tooltips>
                                </el-checkbox>
                              </el-col>
                            </el-row>
                          </el-checkbox-group>
                        </el-card>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="Handling Code">
                        <el-card shadow="never" style="width: 95%">
                          <el-checkbox-group
                            :disabled="status"
                            v-model="item.handlingCode"
                            @change="changeHandlingCode"
                          >
                            <el-row>
                              <el-col
                                :span="2"
                                v-for="item in handlingCode"
                                :key="item.id"
                              >
                                <el-checkbox
                                  :label="item.chineseName"
                                  :name="item.chineseName"
                                  :key="item.code"
                                >
                                  <Tooltips
                                    :content="item.chineseName"
                                    :refName="item.code"
                                  >
                                  </Tooltips>
                                </el-checkbox>
                              </el-col>
                            </el-row>
                          </el-checkbox-group>
                        </el-card>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="Sub Category">
                        <el-card shadow="never" style="width: 95%">
                          <el-checkbox-group
                            :disabled="status"
                            v-model="item.subCategory"
                            @change="changeSubCategory"
                          >
                            <el-row>
                              <el-col
                                :span="2"
                                v-for="item in subCategory"
                                :key="item.id"
                              >
                                <el-checkbox
                                  :label="item.chineseName"
                                  :name="item.chineseName"
                                  :key="item.code"
                                >
                                  <Tooltips
                                    :content="item.chineseName"
                                    :refName="item.code"
                                  >
                                  </Tooltips>
                                </el-checkbox>
                              </el-col>
                            </el-row>
                          </el-checkbox-group>
                        </el-card>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-form>
              </div>
            </section>
            <!-- 没有数据时 -->
            <div class="no-data" v-else>
              <el-empty description="未设置规则!">
                <el-button
                  type="primary"
                  size="small"
                  @click="addRouteRule(index)"
                  >新增规则</el-button
                >
              </el-empty>
            </div>
          </el-card>
        </div>
      </el-collapse-item>
    </el-collapse>
  </div>
</template>
<script>
export default {
  name: "routeInfo",
  props: {
    routesInfo: {
      // 航线规则信息
      type: Array,
      default: () => [],
    },
    cargoType: {
      // 申报类别
      type: Array,
      default: () => [],
    },
    cargoStatus: {
      // 货物类型
      type: Array,
      default: () => [],
    },
    puporpux: {
      // 取件扫描号
      type: Array,
      default: () => [],
    },
    serviceCode: {
      // Service Code
      type: Array,
      default: () => [],
    },
    handlingCode: {
      // Handling Code
      type: Array,
      default: () => [],
    },
    subCategory: {
      // Sub Category
      type: Array,
      default: () => [],
    },
    status: {
      // 标识是详情还是编辑
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      activeNames: [0], // 展开指定项
    };
  },
  computed: {},
  filters: {
    // 状态:0 无效,1 有效   2 配置中   3 停用
    statusBtn(status) {
      //  console.log(this)
      if (status == "0") {
        return "无 效";
      } else if (status == "1") {
        return "停 用";
      } else if (status == "3") {
        return "开 启";
      } else {
        return "保 存";
      }
    },
  },
  mounted() {},
  methods: {
    showBtnRule(item) {
      /*
       展示保存按钮、开启按钮/停用按钮、删除按钮逻辑如下:
       1:当status状态等于3的时候展示:保存按钮、开启按钮/停用按钮、删除按钮;
       2:当status状态等于1并且ruleDate字段有值的时候展示:保存按钮、开启按钮/停用按钮、删除按钮;
       3:当从航班配置设置不查询日期的时候“查看&修改”的时候,
       有效的航线也就是status状态等于1的时候也要展示:保存按钮、开启按钮/停用按钮、删除按钮;
       4:那么问题来了当从航班配置设置不查询日期的时候状态为1的时候也要展示:保存按钮、开启按钮/停用按钮、删除按钮;
       那么要么跳转的时候传过来一个参数;
       5:如果是从【航班顺位】和【DM数据处理】跳转过来,那么航班航线设置维度只作为详情查看,禁用所有的操作。
       所以展示不展示保存按钮、开启按钮/停用按钮、删除按钮毫无意义
      */
      if (item.status == "3" || (item.status == "1" && item.ruleDate)) {
        return true;
      } else if (item.status == "1" && this.$route.query.querySpecifyData) {
        // 航班配舱设置非日期级别情况下
        return true;
      } else if (item.status == "2") {
        return true;
      } else {
        return false;
      }
    },
    // 当前激活面板改变时触发
    collapseChange(name) {
      this.$emit("collapse", name);
    },
    // 始发站
    changeLocation(val) {
      this.$emit("location", val);
    },
    // 目的站
    changeDestinationSite(val) {
      this.$emit("destinationSite", val);
    },
    // 申报类别
    changeCargoType(arr) {
      this.$emit("cargoType", arr);
    },
    // 货物类型
    changeCargoStatus(arr) {
      this.$emit("cargoStatus", arr);
    },
    // 取件扫描号
    changePuporpux(arr) {
      this.$emit("puporpux", arr);
    },
    // Service Code
    changeServiceCode(arr) {
      this.$emit("serviceCode", arr);
    },
    // Handling Code
    changeHandlingCode(arr) {
      this.$emit("handlingCode", arr);
    },
    // Sub Category
    changeSubCategory(arr) {
      this.$emit("subCategory", arr);
    },
    // 新增规则
    addRouteRule(index) {
      this.$emit("addRlue", index);
    },
  },
};
</script>
<style lang="scss">
.el-collapse-item__header {
  background-color: #d9ecff !important;
  border-bottom: 1px solid #ccc;
  padding-left: 40px;
}

.route-container {
  strong {
    font-size: 14px;
  }

  .route-info {
    .route-info-card {
      section {
        padding: 12px 70px;

        .route-config-header {
          .flight-route-title {
            margin-left: 8px;
          }
        }
      }

      .route-config-info {
      }
    }
  }
}
</style>