<template>
  <!-- 单据记录 现货仓单 挂牌记录 -->
  <mtp-table-scroll>
    <template #default="{ scroll }">
      <a-table :columns="columns" class="srcollYTable" :scroll="scroll" :pagination="false" :loading="loading" :customRow="Rowclick" :rowKey="(record, index) => index" :data-source="tableList">
        <!--  委托状态-->
        <template #wrtradeorderstatus="{ record }">
          <a>{{ getWrTradeOrderStatusName(record.wrtradeorderstatus) }}</a>
        </template>
        <!-- 挂牌类型 -->
        <template #wrtradetype="{ record }">
          <a>{{ getWrOrderTypeName(record.buyorsell, record.wrtradetype) }}</a>
        </template>
        <!-- 挂牌价格 -->
      </a-table>
    </template>
  </mtp-table-scroll>
</template>

<script lang="ts">
import MtpTableScroll from '@/common/components/tableScroll/index.vue';
import { queryTableList, defineComponent } from '@/common/export/commonTable';
import { queryWrOrderDetail } from '@/services/go/wrtrade';
import { QueryWrOrderDetailReq, WrOrderDetail } 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 { getWrOrderTypeName, getWrTradeOrderStatusName } from '@/common/constants/enumsName';
import { expandIcon } from '@/common/setup/table/clolumn';

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

    // 获取列表数据
    const queryTableAction = () => {
      const param: QueryWrOrderDetailReq = {
        haswr: 1,
      };
      queryTable(queryWrOrderDetail, param);
    }

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

    return {
      ...handleComposeOrderTable<WrOrderDetail>(param),
      loading,
      tableList,
      getWrTradeOrderStatusName,
      getWrOrderTypeName,
      expandIcon,
    }
  }
})
</script>