<template>
  <!-- 单据记录 现货仓单 成交记录 -->
  <div class="topTableHeight">
    <a-table :columns="columns"
             class="srcollYTable expandLeftTable"
             :scroll="{ x: '100%', y:'calc(100vh - 163px)'}"
             :pagination="false"
             :loading="loading"
             :expandedRowKeys="expandedRowKeys"
             :customRow="Rowclick"
             :expandIcon="expandIcon"
             :expandIconAsCell="false"
             rowKey="key"
             :data-source="tableList">

      <!-- 成交金额 -->
      <template #amount="{ record }">
        <a>{{ record.tradeqty * record.tradeprice }}</a>
      </template>

      <!-- 挂牌类型 -->
      <template #wrtradetype="{ record }">
        <a>{{ getWrOrderTypeName(record.buyorsell, record.wrtradetype) }}</a>
      </template>
    </a-table>
  </div>
</template>

<script lang="ts">
import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
import { queryTableList, BtnList, defineAsyncComponent, defineComponent } from '@/common/export/commonTable';
import { queryWrTradeDetail } from '@/services/go/wrtrade';
import { QueryWrSpecialMatchOrderReq, WrSpecialMatchOrder } from '@/services/go/wrtrade/interface';
import { getRecordItemTab } from '@/common/setup/order/orderData';
import { handleComposeOrderTable } from '@/common/setup/table/compose';
import { ComposeOrderTableParam } from '@/common/setup/table/interface';
import { expandIcon } from '@/common/setup/table/clolumn';
import { getWrOrderTypeName } from '@/common/constants/enumsName';
import { EnumRouterName } from '@/common/constants/enumRouterName';

export default defineComponent({
    name: EnumRouterName.search_spot_warrant_transaction_record,
    setup() {
        // 表格列表数据
        const { loading, tableList, queryTable } = queryTableList<WrSpecialMatchOrder>();
        // 获取列表数据
        const queryTableAction = () => {
            const param: QueryWrSpecialMatchOrderReq = {
                haswr: 1,
            };
            queryTable(queryWrTradeDetail, param);
        };
        // 表格通用逻辑
        const param: ComposeOrderTableParam = {
            queryFn: queryTableAction,
            tableName: 'table_pcweb_spot_trade_bottom_spot_warrant_deal',
            recordList: getRecordItemTab(),
        };
        return {
            ...handleComposeOrderTable<WrSpecialMatchOrder>(param),
            loading,
            tableList,
            expandIcon,
            getWrOrderTypeName,
        };
    },
});
</script>

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