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

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

  defineProps({
    data: {
      type: Object,
    },
  });
  const columns = [
    {
      title: '报告名称',
      dataIndex: 'gdclmc',
      key: 'gdclmc',
    },
    {
      title: '报告上传日期',
      dataIndex: 'gdsj',
      key: 'gdsj',
    },
    {
      title: '操作',
      dataIndex: 'action',
      key: 'action',
    },
  ];
  //   点击下载
  function down(record) {
    console.log(record, 'record');
    downloadFile(record?.gdcllj, record.gdclmc);
  }
</script>
