<template>

  <div class="table-main">
    <el-table v-if="tableData.length > 0" :data="tableData" stripe border :header-cell-style="{ textAlign: 'center' } "
              :cell-style="{ textAlign: 'center' }" height="335px"
              style="width: 100%;">
      <el-table-column type="index" label="序号" width="70" fixed="left"/>
      <el-table-column prop="time" label="数据时间"/>
      <template v-if="phaseT === 0">
        <el-table-column prop="dataA" :label="`A（${unit}）`"/>
        <el-table-column prop="dataB" :label="`B（${unit}）`"/>
        <el-table-column prop="dataC" :label="`C（${unit}）`"/>
      </template>
      <template v-if="phaseT === 1">
        <el-table-column prop="dataT" :label="`T（${unit}）`"/>
      </template>
    </el-table>
  </div>

</template>

<script lang="tsx" setup>

import {CheckData} from "@/api/check/interface";

const {tableData} = defineProps<{
  tableData: CheckData.RawDataItem[]
}>()

const unit = computed(() => {
  return tableData.length > 0 ? tableData[0].unit : '';
})

const phaseT = computed(() => {
  return tableData[0].dataT == '/' ? 0 : 1
})


</script>

<style scoped>

</style>