<script setup lang="tsx">
import { PropType, ref } from 'vue'
import { TableData } from '@/api/srdb/FieldMaintenance/FieldMaintenance/types'
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
import {IS_PROMARY_LIST} from "../constants"
const detailSchema = ref<DescriptionsSchema[]>([
  {
    field: 'tableCode',
    label: '表编码'
  },
  {
    field: 'tableNameEn',
    label: '表英文名'
  },
  {
    field: 'tableNameCn',
    label: '表中文名'
  },
  {
    field: 'fieldCode',
    label: '数据项代码'
  },
  {
    field: 'fieldNameEn',
    label: '数据项英文名称'
  },
  {
    field: 'fieldNameCn',
    label: '数据项代码中文名称'
  },
  {
    field: 'isPrimery',
    label: '是否主键字段',
    slots:{
      default:(data:any)=>{
        return <span>{IS_PROMARY_LIST[data.row.isPrimary]?.label}</span>
      }
    }
  },
  {
    field: 'collectingCode',
    label: '采集编号'
  },
  {
    field: 'regulationId',
    label: '制度编号'
  },
  {
    field: 'regulationName',
    label: '制度名称'
  },
  {
    field: 'regulationVersion',
    label: '制度版本'
  },
  {
    field: 'fieldType',
    label: '数据类型'
  },
  {
    field: 'fieldLength',
    label: '数据长度'
  },
  {
    field: 'metaNo',
    label: '元数据编号'
  },
  {
    field: 'metaName',
    label: '元数据名称'
  },
  {
    field: 'preMetaList',
    label: '关联元数据编号'
  },
  {
    field: 'isPartition',
    label: '是否分区字段'
  }
])

defineProps({
  currentRow: {
    type: Object as PropType<TableData>,
    default: () => {}
  }
})
</script>

<template>
  <Descriptions :schema="detailSchema" :data="currentRow || {}" />
</template>
