seaStepDetail.vue 3.65 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1
<template>
huhaiqing106's avatar
huhaiqing106 committed
2
  <div class="app-seaStepDetail">
3 4 5 6 7 8 9
    <el-scrollbar :vertical="true" viewClass="shipping-step">
      <template v-for="(step, index) in flatSeaStep">
        <div :key="index" v-if="shipmentObj[step.voName] && columnsMapping[step.voName]" class="step-table">
          <div class="step-title">{{step.title}}</div>
          <div v-for="(data, index) in columnsMapping[step.voName]" :key="index" class="step-content">
            <p>{{data.title}}</p>
            <p>{{getObjInfo(step.voName, data)}}</p>
huhaiqing106's avatar
huhaiqing106 committed
10
          </div>
11 12
        </div>
      </template>
huhaiqing106's avatar
huhaiqing106 committed
13 14
    </el-scrollbar>
  </div>
huhaiqing's avatar
huhaiqing committed
15 16 17
</template>

<script>
huhaiqing106's avatar
huhaiqing106 committed
18
import dayjs from "dayjs";
huhaiqing's avatar
huhaiqing committed
19
import * as _C from "./utils";
huhaiqing106's avatar
huhaiqing106 committed
20 21 22

export default {
  name: "seaStepDetail",
huhaiqing's avatar
huhaiqing committed
23
  inheritAttrs: false,
huhaiqing106's avatar
huhaiqing106 committed
24 25 26 27 28 29 30
  props: {
    shipmentObj: Object,
    seaBaseData: Array,
  },
  data() {
    return {
      flatSeaStep: this.seaBaseData.flat(),
31
      columnsMapping: _C.getColmnMapping(),
huhaiqing106's avatar
huhaiqing106 committed
32 33 34 35 36 37 38 39 40
    };
  },
  methods: {
    getObjInfo(voName, data) {
      const { key, type } = data;
      let val = this.shipmentObj[voName]?.[key] ?? "";
      if (val) {
        switch (type) {
          case "date":
huhaiqing's avatar
huhaiqing committed
41 42 43
          case "datetime":
            val = dayjs(val).format("YYYY-MM-DD HH:mm:ss");
            break;
huhaiqing106's avatar
huhaiqing106 committed
44 45 46 47 48 49
          case "supplier":
            val = this.getSupplier(Number(val));
            break;
          case "dock":
            val = this.getDock(Number(val));
            break;
huhaiqing's avatar
huhaiqing committed
50 51 52
          case "warehouse":
            val = this.getWarehouse(Number(val));
            break;
huhaiqing's avatar
huhaiqing committed
53
          case "shipping_dcCustoms_status":
huhaiqing's avatar
huhaiqing committed
54 55 56 57
          case "shipping_customs_type":
            val = this.getDict(type, String(val));
            break;
          case "saExmtStatus":
huhaiqing's avatar
huhaiqing committed
58 59 60
          case "bgExmtStatus":
          case "isFile":
          case "billingMethod":
huhaiqing's avatar
huhaiqing committed
61 62
            val = this.getConstant(type, String(val));
            break;
huhaiqing's avatar
huhaiqing committed
63 64 65
          case "user":
            val = this.getUser(val);
            break;
huhaiqing106's avatar
huhaiqing106 committed
66 67
        }
      }
huhaiqing's avatar
huhaiqing committed
68 69

      return val === 0 ? "" : val;
huhaiqing106's avatar
huhaiqing106 committed
70 71 72
    },
    getSupplier(id) {
      return (
73
        this.$l(this.$attrs.allSupplier.find((item) => item.id === id), 'company') // ?? id
huhaiqing106's avatar
huhaiqing106 committed
74 75 76
      );
    },
    getDock(id) {
77
      return this.$l(this.$attrs.allDocks.find((item) => item.id === id), 'title') ?? id;
huhaiqing106's avatar
huhaiqing106 committed
78
    },
huhaiqing's avatar
huhaiqing committed
79 80
    getWarehouse(id) {
      return (
81
        this.$l(this.$attrs.warehouseList.find((item) => item.id === id), 'title') ?? id
huhaiqing's avatar
huhaiqing committed
82 83
      );
    },
huhaiqing's avatar
huhaiqing committed
84 85 86 87 88
    getUser(id) {
      return (
        this.$attrs.allUsers.find((item) => item.id === id)?.nickname ?? id
      );
    },
huhaiqing's avatar
huhaiqing committed
89 90
    getDict(code, id) {
      return (
91
        this.$l(this.getDictDatas(code).find((item) => item.value === id), 'label') ?? id
huhaiqing's avatar
huhaiqing committed
92 93 94 95 96 97 98
      );
    },
    getConstant(code, id) {
      return (
        _C.constantDict[code].find((item) => item.value === id)?.label ?? id
      );
    },
huhaiqing106's avatar
huhaiqing106 committed
99 100
  },
};
huhaiqing's avatar
huhaiqing committed
101 102
</script>

huhaiqing106's avatar
huhaiqing106 committed
103 104 105 106 107 108 109 110
<style lang="scss">
.app-seaStepDetail {
  .shipping-step {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
huhaiqing's avatar
huhaiqing committed
111
    height: 550px;
112 113
    min-width: 1300px;
    padding: 10px 10px;
huhaiqing106's avatar
huhaiqing106 committed
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

    p {
      margin: 0;
    }
    .step-table {
      width: 200px;
      border: 1px solid gray;
      margin-bottom: 15px;
      margin-right: 15px;

      .step-title {
        font-size: 16px;
        font-weight: bolder;
        background-color: #c6c8ce;
        line-height: 30px;
        text-align: center;
      }
      .step-content {
        display: grid;
        border-top: 1px solid gray;
        font-size: 14px;
        line-height: 25px;
        grid-template-columns: repeat(2, 1fr);
        > p:first-child {
          border-right: 1px solid gray;
        }
        > p {
          padding: 0 5px;
        }
      }
    }
  }
}
huhaiqing's avatar
huhaiqing committed
147
</style>