<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="(record, index) => index" :data-source="tableList">
        <!-- 额外的展开行 -->
        <template #expandedRowRender="{ record }">
          <BtnList :btnList="btnList" :record="record" class="btn-list-sticky" @click="openComponent" />
        </template>
      </a-table>
    </template>
  </mtp-table-scroll>
  <component :is="componentId" v-if="componentId" :selectedRow="selectedRow" @cancel="closeComponent"></component>
</template>

<script lang="ts">
import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
import { queryTableList, BtnList, defineAsyncComponent, defineComponent } from '@/common/export/commonTable';
import { queryWrSpecialMatchOrder, 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 MtpTableScroll from '@/common/components/tableScroll/index.vue';
export default defineComponent({
  name: enumOrderComponents.spot_warrant_designated_deal,
  components: {
    BtnList,
    MtpTableScroll,
  },
  setup() {
    // 表格列表数据
    const { loading, tableList, queryTable } = queryTableList<WrSpecialMatchOrder>();
    // 获取列表数据
    const queryTableAction = () => {
      const param: QueryWrSpecialMatchOrderReq = {
        haswr: 1,
      };
      queryTable(queryWrSpecialMatchOrder, param);
    };
    // 表格通用逻辑
    const param: ComposeOrderTableParam = {
      queryFn: queryTableAction,
      tableName: 'table_pcweb_spot_trade_bottom_spot_warrant_designated_deal',
      recordList: getRecordItemTab(),
    };
    return {
      ...handleComposeOrderTable<WrSpecialMatchOrder>(param),
      loading,
      tableList,
      expandIcon,
    };
  },
});
</script>