<template>
  <!-- 拆单入仓记录 -->
  <el-dialog :title="$t('入仓记录')" :visible="show" :before-close="closeDialog" :close-on-click-modal="false" width="1000px" :append-to-body="appendToBody">
    <el-table :data="list">
      <el-table-column type="index" :label="$t('序号')" />
      <el-table-column :label="$t('箱数')" prop="num" />
      <el-table-column :label="$t('入仓类型')" prop="specificationType">
        <template slot-scope="{row}">
          <dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" :value="row.specificationType" />
        </template>
      </el-table-column>
      <el-table-column :label="$t('包装类型')" prop="unit">
        <template slot-scope="{row}">
          <dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" :value="row.unit" />
        </template>
      </el-table-column>
      <el-table-column :label="$t('长')" prop="boxGauge">
        <template slot-scope="{row}">
          {{row.boxGauge.split('*')[0]}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('宽')" prop="boxGauge" >
        <template slot-scope="{row}">
          {{row.boxGauge.split('*')[1]}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('高')" prop="boxGauge" >
        <template slot-scope="{row}">
          {{row.boxGauge.split('*')[2]}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('体积') + '(m³)'" prop="volume" />
      <el-table-column :label="$t('重量') + '(kg)'" prop="weight" />
      <el-table-column :label="$t('数量（个）')" prop="quantity" />
      <!--<el-table-column :label="$t('入仓快递单号')" prop="expressNo" />-->
      <!--<el-table-column :label="$t('首次入仓时间')" prop="inTime" >
        <template slot-scope="{row}">{{row.inTime|parseTime}}</template>
      </el-table-column>-->
      <el-table-column :label="$t('储位')" prop="orderLocationBackVOList" >
        <template slot-scope="{row}">
          <!--{{getLocationName(row.orderLocationList)}}-->
          <warehouse-area-select
            v-model="row.orderLocationList"
            readonly
            :warehouse-id="warehouseId"
            ></warehouse-area-select>
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
import WarehouseAreaSelect from "@/components/WarehouseAreaSelect/index.vue";

export default {
  name: "WarehouseRecord",
  components: {WarehouseAreaSelect},
  props:{
    list:{
      type: Array,
      default: []
    },
    warehouseId: Number,
    appendToBody: Boolean
  },
  data(){
    return {
      show: false
    }
  },
  mounted() {
    this.show = true
  },
  methods:{
    // 获取储位名称
    getLocationName(locationArr){
      if(!locationArr || !locationArr.length) return ''
      let arr = []
      locationArr.forEach(item => {
        arr.push(`${item.areaName}${item.locationName || ''}`)
      })
      return Array.from(new Set(arr)).join(",")
    },
    closeDialog(){
      this.show = false
      this.$emit('close');
    },
  }
}
</script>

<style scoped>

</style>
