<template>
  <!-- 资金流水-历史记录 -->
  <mtp-table-scroll>
    <template #default="{ scroll }">
      <a-table :columns="columns" class="srcollYTable" :scroll="scroll" :pagination="false" :loading="loading" :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" :expandIcon="expandIcon" :expandIconAsCell="false" rowKey="key" :data-source="tableList">
        <template #createtime="{ record }">
          <a>{{ formatTime(record.createtime) }}</a>
        </template>
      </a-table>
    </template>
  </mtp-table-scroll>
</template>

<script lang="ts">
import MtpTableScroll from '@/common/components/tableScroll/index.vue';
import { defineComponent, queryTableList } from '@/common/export/commonTable';
import { formatTime } from '@/common/methods';
import { getRecordItemTab } from '@/common/setup/order/orderData';
import { expandIcon } from '@/common/setup/table/clolumn';
import { handleComposeOrderTable } from '@/common/setup/table/compose';
import { ComposeOrderTableParam } from '@/common/setup/table/interface';
import { getSelectedAccountId } from '@/services/bus/account';
import { QueryHisAmountLog } from '@/services/go/TaAccount';
import { WrPerformancePlan } from '@/services/go/wrtrade/interface';
//import Filter from '@/views/search/search_document_records_commission_record_sub/components/filter/index.vue';
import { Moment } from 'moment';

export default defineComponent({
  components: {
    MtpTableScroll,
    //Filter,
  },
  setup() {
    // 表格列表数据
    const { loading, tableList, queryTable } = queryTableList<WrPerformancePlan>();

    // 查询数据
    const search = (value: Moment[]) => {
      const param = {
        endDate: value[1].format('YYYY-MM-DD'),
        startDate: value[0].format('YYYY-MM-DD'),
        accountID: getSelectedAccountId().toString(),
      };
      queryTable(QueryHisAmountLog, param);
    }

    // 表格通用逻辑
    const param: ComposeOrderTableParam = {
      queryFn: () => { },
      tableName: 'table_pcweb_spot_trade_bottom_funding_info_log',
      recordList: getRecordItemTab(),
    }

    return {
      ...handleComposeOrderTable<WrPerformancePlan>(param),
      search,
      loading,
      tableList,
      formatTime,
      expandIcon,
    }
  }
})
</script>