<!-- 表格组件 -->
<template>
  <div class="infoTable-container">
    <el-form v-if="Object.keys(obj).length > 0" class="infoTable-form" label-position="left">
      <template v-for="(item, index) in list">
        <el-form-item :style="item.span?{width: `${100/(24/item.span)}%`}:{}" :label="item.name" :label-width="labelWidth?labelWidth+'px':'130px'" :key="index" :class="[
            { 'infoTable-form-view': item.style },
            { 'infoTable-form-item': !item.style },
            { 'infoTable-form-row': item.rowstyle }
          ]">
          <div>
            <template v-if="item.slot === true">
              <slot :name="item.prop" :data="obj"></slot>
            </template>
            <span v-else> {{  obj[item.prop] ?obj[item.prop] !==""?item.formatter?item.formatter(obj[item.prop]):obj[item.prop]:'--' :'--' }}</span>
          </div>
        </el-form-item>
      </template>
    </el-form>
    <div v-else class="no-data">
      <div class="no-data-box" v-if="show">
        <img :src="noData" alt="暂时没有找到相关数据" />
        <span>暂时没有找到相关数据</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "InfoTable",
  components: {

  },
  props: {
    list: {
      type: Array,
      default: () => [],
    },
    obj: {
      type: Object,
      default: () => { }
    },
    labelWidth: {
      type: Number,
      default: null
    }
  },
  data() {
    return {
      show:false,
      // 当前移入单元格内容
      noData: require("@/assets/images/detail/noData.png")
    };
  },
  created() {
  },
  mounted(){
    this.show = true;
  },
  methods: {
  },
};
</script>

<style lang="scss" scoped>
.infoTable-container {
  .infoTable-form {
    display: flex;
    flex-wrap: wrap;
    border-left: 1px solid #e5e9f5;
    border-top: 1px solid #e5e9f5;
    border-collapse: collapse;
    .infoTable-form-item {
      width: 50%;
      flex: auto;
      margin-bottom: 0px;
      border-right: 1px solid #e5e9f5;
      border-bottom: 1px solid #e5e9f5;
      font-family: Microsoft YaHei-Regular, Microsoft YaHei;
      font-size: 12px;
    }
    .infoTable-form-view {
      width: 100%;
      flex: auto;
      margin-bottom: 0px;
      border-right: 1px solid #e5e9f5;
      border-bottom: 1px solid #e5e9f5;
      font-family: Microsoft YaHei-Regular, Microsoft YaHei;
      font-size: 12px;
    }
    .infoTable-form-row {
      width: 33%;
      flex: auto;
      margin-bottom: 0px;
      border-right: 1px solid #e5e9f5;
      border-bottom: 1px solid #e5e9f5;
      font-family: Microsoft YaHei-Regular, Microsoft YaHei;
      font-size: 12px;
    }
    ::v-deep .el-form-item__label {
      height: 100%;
      background-color: #F0F3FA;
      padding: 8px 12px 8px 12px;
      font-size: 12px;
      font-weight: normal;
      color: rgba(35,35,35,0.8);
      display: flex;
      align-items: center;
      line-height: normal;
    }
    ::v-deep .el-form-item__content {
      padding-left: 12px;
      font-size: 12px;
      color: #232323;
    }
    ::v-deep .el-form-item__content {
      border-left: 1px solid #e5e9f5;
      height: 100%;
      display: flex;
      align-items: center;
    }
    ::v-deep .el-col {
      border-bottom: 1px solid #e5e9f5;
    }
  }
  .no-data {
    font-size: 14px;
    font-family: Microsoft YaHei-Regular, Microsoft YaHei;
    font-weight: 400;
    color: #999999;
    text-shadow: 0px 0px 10px rgba(0, 37, 106, 0.10000000149011612);
    max-width: 1200px;
    height: 328px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    border-radius: 0px 0px 0px 0px;
    opacity: 1;
    border: 1px solid #eeeeee;
    .no-data-box {
      display: flex;
      flex-direction: column;
      align-items: center;
      img {
        width: 64px;
        height: 79px;
        margin-bottom: 16px;
      }
    }
  }
  ::v-deep .el-form-item__content {
    line-height: 22px;
    padding: 6px 4px;
  }
}
</style>
