<template>
  <div class="edb-detail">
    <label>已选指标：</label>
    <el-table
      :data="tableData"
      style="box-shadow: 0px 3px 6px rgba(155, 170, 219, 0.2); margin-top: 10px"
      border
    >
      <el-table-column
        v-for="item in tableColums"
        :key="item.label"
        :label="item.label"
        :width="item.widthsty"
        :min-width="item.minwidthsty"
        align="center"
      >
        <template slot-scope="scope">
          <span>{{ scope.row[item.key] }}</span>
        </template>
      </el-table-column>
      <div slot="empty">
        <tableNoData text="暂无指标" size="mini" />
      </div>
    </el-table>
    <ul
      class="data-ul"
      ref="dataUl"
      v-if="tableData[0]&&tableData[0].DataList.length"
    >
      <li
        class="value-item"
        v-for="(item, index) in tableData[0].DataList"
        :key="item.EdbDataId"
      >
        <span class="value-label">
          <i class="new-tag" v-if="index === 0"></i>
          {{ item.DataTime }}
        </span>
        <span
          class="value-label"
          style="min-width: 200px; text-align: center"
          >{{ item.Value }}</span
        >
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  props: {
    tableData: {
      type: Array
    }
  },
  data() {
    return {
      tableColums:[
				{
					label: '指标ID',
					key: 'EdbCode',
				},
				{
					label: '指标名称',
					key: 'EdbName',
				},
				{
					label: '频度',
					key: 'Frequency',
				},
				{
					label: '单位',
					key: 'Unit',
				},
				{
					label: '起始时间',
					key: 'StartDate',
					minwidthsty: '100px'
				},
				{
					label: '更新时间',
					key: 'ModifyTime',
					minwidthsty: '110px'
				},
				{
					label: '来源',
					key: 'SourceName',
				},
			],
      dataList: []
    };
  },
  methods: {},
};
</script>
<style scoped lang="scss">
.edb-detail {
  .data-ul {
    margin-top: 5px;
    border-bottom: 1px solid #dcdfe6;
    max-height: 140px;
    overflow-y: auto;
    .value-item {
      /* width: 100%; */
      padding: 14px 0;
      border: 1px solid #dcdfe6;
      border-bottom: none;
      display: flex;
      justify-content: space-around;
      .value-label {
        position: relative;
        color: #666;
      }
      .new-tag {
        width: 6px;
        height: 6px;
        display: inline-block;
        position: absolute;
        left: -12px;
        top: 50%;
        transform: translateY(-50%);
        border-radius: 50%;
        background: #f00;
      }
    }
  }
}
</style>
