<template>
  <!-- 履约查询 卖履约 -->
  <section>
    <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 #performancetype="{ record }">
        <a>{{ getPerformanceTypeName(record.performancetype) }}</a>
      </template>

      <!-- 付款方式 -->
      <template #paymenttype="{ record }">
        <a>{{ getPaymentTypeName(record.paymenttype) }}</a>
      </template>

      <!-- 履约状态 -->
      <template #performancestatus="{ record }">
        <a>{{ getPerformanceStatusName(record.performancestatus) }}</a>
      </template>

      <!-- 当前步骤 -->
      <template #curstepname="{ record }">
        <a>{{ record.curstepname }}</a>
      </template>
    </a-table>
  </section>
</template>

<script lang="ts">
import { queryTableList, defineComponent } from '@/common/export/commonTable';
import { QueryPerformancePlan } from '@/services/go/wrtrade';
import { QueryPerformancePlanReq, WrPerformancePlan } from '@/services/go/wrtrade/interface';
import { getRecordItemTab } from '@/common/setup/order/orderData';
import { handleComposeOrderTable } from '@/common/setup/table/compose';
import { expandIcon } from '@/common/setup/table/clolumn';
import { ComposeOrderTableParam } from '@/common/setup/table/interface';
import { BuyOrSell } from '@/common/constants/enumCommon';
import { getPaymentTypeName, getPerformanceStatusName, getPerformanceTypeName } from '@/common/constants/enumsName';
import { EnumRouterName } from '@/common/constants/enumRouterName';

export default defineComponent({
    name: EnumRouterName.search_performance_query_sell_performance,
    setup() {
        // 表格列表数据
        const { loading, tableList, queryTable } = queryTableList<WrPerformancePlan>();
        // 获取列表数据
        const queryTableAction = () => {
            const param: QueryPerformancePlanReq = {
                buyorsell: 1,
            };
            queryTable(QueryPerformancePlan, param);
        };
        // 表格通用逻辑
        const param: ComposeOrderTableParam = {
            queryFn: queryTableAction,
            tableName: 'table_pcweb_spot_trade_bottom_performance_info_sale',
            recordList: getRecordItemTab(),
        };
        return {
            ...handleComposeOrderTable<WrPerformancePlan>(param),
            loading,
            tableList,
            getPerformanceTypeName,
            getPaymentTypeName,
            getPerformanceStatusName,
            expandIcon,
            BuyOrSell,
        };
    },
});
</script>

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