<template>
  <div>
    <n-card :bordered="false" class="proCard">
      <BasicTable
        :columns="columns"
        :request="loadDataTable"
        :row-key="(row) => row.id"
        ref="actionRef"
        @update:checked-row-keys="onCheckedRow"
        :scroll-x="1090"
        :flex-height="false"
        :pagination="{ pageSize: 10 }"
        :resizeHeightOffset="-500"
      />
    </n-card>
  </div>
</template>

<script lang="ts" setup>
  import { ref } from 'vue';
  import { BasicTable } from '@/components/Table';
  import { ChatLogInfo } from '@/api/chatLog/chatLog';
  import { columns } from './columns';

  interface Props {
    infoParams?: any;
  }
  const props = withDefaults(defineProps<Props>(), { infoParams: {} });

  const actionRef = ref();
  const dataSource = ref({});

  const loadDataTable = async (res) => {
    dataSource.value = await ChatLogInfo({
       ...res, 
       ...{ 
        openId: props.infoParams.openId ,
        time: props.infoParams.time,
      } 
      });
    return dataSource.value;
  };

  function onCheckedRow(rowKeys) {
    console.log(rowKeys);
  }

  function reloadTable() {
    actionRef.value.reload();
  }
</script>

<style lang="less" scoped></style>
