<script setup lang="tsx">
import { PropType, ref } from 'vue'
import { TableData } from '@/api/csck/CsckDataCheckImport/types'
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
import { STATUS_DICT_LIST } from '../constants';

const detailSchema = ref<DescriptionsSchema[]>([
  {
    field: 'orgCode',
    label: '机构编码'
  },
  {
    field: 'dataDate',
    label: '数据日期'
  },
  {
    field: 'systemCode',
    label: '系统编码'
  },
  {
    field: 'systemName',
    label: '系统名称'
  },
  {
    field: 'systemVersion',
    label: '系统版本号'
  },
  {
    field: 'modelReportId',
    label: '模型/报表ID'
  },
  {
    field: 'modelReportName',
    label: '模型/报表名称'
  },
  {
    field: 'status',
    label: '导入状态',
    slots: {
      default(row) {
        const status = STATUS_DICT_LIST.find((item) => item.value === row.status)
        if (status) {
          return <span>{status.label}</span>
        }
        return <span>{row.status ?? '-'}</span>
      }
    }
  },
  {
    field: 'reportType',
    label: '报表类型'
  },
  {
    field: 'updateTime',
    label: '更新时间'
  },
  {
    field: 'errorDesc',
    label: '错误信息'
  }
])

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

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