<template>
  <div class="structure-tab">
    <el-table 
      :data="tableData" 
      border 
      style="width: 100%"
      :header-cell-style="{ background: '#f5f7fa', color: '#333' }"
      :row-style="{ height: '40px' }"
      :cell-style="{ padding: '8px 0', textAlign: 'center' }"
    >
      <el-table-column prop="pk" label="主键" width="120" fixed/>
      <el-table-column prop="fieldName" label="字段名" width="180" />
      <el-table-column prop="comment" label="注释" min-width="200" />
      <el-table-column prop="fieldType" label="类型" width="120" />
      <el-table-column prop="length" label="长度" width="120" />
      <el-table-column prop="precision" label="精度" width="120" />
    </el-table>
  </div>
</template>

<script setup>
const props = defineProps({
  tableData: {
    type: Array,
    required: true,
    default: () => [
      { pk: '', fieldName: 'business_name', comment: '生成业务名', fieldType: 'VARCHAR', length: '30', precision: '' },
      { pk: '', fieldName: 'business_name_...', comment: '', fieldType: 'TEXT', length: '65535', precision: '' },
      { pk: '', fieldName: 'class_name', comment: '实体类名称', fieldType: 'VARCHAR', length: '100', precision: '' },
      { pk: '', fieldName: 'create_by', comment: '创建者', fieldType: 'VARCHAR', length: '64', precision: '' },
      { pk: '', fieldName: 'create_time', comment: '创建时间', fieldType: 'DATETIME', length: '19', precision: '' },
      { pk: '', fieldName: 'function_author', comment: '生成功能作者', fieldType: 'VARCHAR', length: '50', precision: '' },
      { pk: '', fieldName: 'function_name', comment: '生成功能名', fieldType: 'VARCHAR', length: '50', precision: '' },
      { pk: '', fieldName: 'gen_path', comment: '生成路径（不填...', fieldType: 'VARCHAR', length: '200', precision: '' },
      { pk: '', fieldName: 'gen_type', comment: '生成代码方式（0...', fieldType: 'CHAR', length: '1', precision: '' },
      { pk: '', fieldName: 'module_name', comment: '生成模块名', fieldType: 'VARCHAR', length: '30', precision: '' }
    ]
  }
})
</script>

<style scoped>
.structure-tab {
  padding: 10px;
  background-color: white;
}

:deep(.el-table) {
  font-size: 14px;
}

:deep(.el-table--striped .el-table__body tr.el-table__row--striped td) {
  background-color: #fafafa;
}
</style>