<!--
 * @Author: chris
 * @Date: 2025-08-08 16:17:54
 * @LastEditors: chris
 * @LastEditTime: 2025-09-19 17:34:55
-->
<template>
  <el-table
    v-loading="loading"
    :data="dataList"
    @selection-change="handleSelectionChange"
    row-key="orchardId"
    border
    highlight-current-row
    style="width: 100%"
  >
    <el-table-column type="selection" width="50" align="center" />
    <el-table-column label="参数名" align="center" prop="name" v-if="columns[0].visible"/>
    <el-table-column label="数值" align="center" prop="value" v-if="columns[1].visible" :show-overflow-tooltip="true" />
    <el-table-column label="单位" align="center" prop="unit" v-if="columns[2].visible" />
    <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[3].visible">
      <template #default="scope">
        <span>{{ parseTime(scope.row.createTime) }}</span>
      </template>
    </el-table-column>
  </el-table>
</template>

<script setup>
import { parseTime } from '@/utils/ruoyi'

const props = defineProps({
  dataList: { type: Array, required: true },
  loading: { type: Boolean, required: true },
  columns: { type: Array, required: true }
})

const emits = defineEmits(['selection-change'])

function handleSelectionChange(selection) {
  emits('selection-change', selection)
}
</script>