<template>
  <a-table :dataSource="data" :columns="columns" :pagination="false" bordered size="middle">
    <template #bodyCell="{ column, record }">
      <template v-if="column.key === 'clyjfj'">
        <a-button type="primary" v-if="record.clyjfj" @click="down(record.clyjfj, '相关材料')">下载</a-button>
      </template>
    </template>
  </a-table>
</template>

<script setup lang="ts">
  import { downloadFile } from '/@/api/common/api';

  defineProps({
    data: {
      type: Object,
    },
  });
  const columns = [
    {
      title: '复核时间',
      dataIndex: 'clsj',
      key: 'clsj',
    },
    {
      title: '复核是否通过',
      dataIndex: 'clyj',
      key: 'clyj',
    },
    {
      title: '报告编制单位首次提交报告修改稿的时间',
      dataIndex: 'submitTsamp',
      key: 'submitTsamp',
    },
    {
      title: '相关材料',
      dataIndex: 'clyjfj',
      key: 'clyjfj',
    },
  ];
  function down(url, name) {
    let fileExtension = url.split('.').pop();
    downloadFile('/sys/common/static' + url, `${name}.${fileExtension}`);
  }
</script>
