<template>

    <a-table :columns="columns" :data="data" :pagination="pagination">
      <template #url="{ record }"  >
        <a :href="record.url" target="_blank">查看处方</a>
      </template>
      <template #code="{record,rowIndex}" >
            <div>{{(rowIndex+1)}}</div>
      </template>
      <template #relation="{record}" >
            <div>{{formatRelation(record.relation)}}</div>
      </template>
      <template #action="{ record }">
        <a-space>
          <a-button  type="text"
            @click="handleDetail(record)"><icon-book />详情</a-button>
        </a-space>
      </template>
    </a-table>
  </template>
<script setup>
import {toRefs } from 'vue';
import {formatRelation} from "@/utils/format"
const props = defineProps({
  // 数组名称
  data: {
    type: Array,
  },
  pagination:{
    type: Boolean,
    default:true
  },
  columns:{
    type: Array
  }
});

const { data,columns,pagination} = toRefs(props);
const emits = defineEmits(['handleFamilyDetail']);
 const handleDetail=(record)=>{
    emits('handleFamilyDetail',record.family_id)
 }
</script>