<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 #financetype="{ record }">
        <a>{{ getFinanceTypeName(record.financetype) }}</a>
      </template>

      <!-- 状态 -->
      <template #scfcontractstatus="{ text }">
        <a>{{ getContractName(text) }}</a>
      </template>
      <template #createtime="{ record }">
        <a>{{ formatTime(record.createtime) }}</a>
      </template>
      <template #scfcontracttype="{ record }">
        <a>{{ getScfContractTypeName(record.scfcontracttype) }}</a>
      </template>

    </a-table>
  </section>
</template>

<script lang="ts">
import { queryTableList, defineComponent } from '@/common/export/commonTable';
import { queryWrScfContract } from '@/services/go/wrtrade';
import { WrScfContract } 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 { formatTime } from '@/common/methods';
import { expandIcon } from '@/common/setup/table/clolumn';
import { getContractName, getFinanceTypeName, getScfContractTypeName } from '@/common/constants/enumsName';
import { EnumRouterName } from '@/common/constants/enumRouterName';

export default defineComponent({
    name: EnumRouterName.search_financing_inquiry_contract,
    setup() {
        // 表格列表数据
        const { loading, tableList, queryTable } = queryTableList<WrScfContract>();
        // 获取列表数据
        const queryTableAction = () => {
            queryTable(queryWrScfContract);
        };
        // 表格通用逻辑
        const param: ComposeOrderTableParam = {
            queryFn: queryTableAction,
            tableName: 'table_pcweb_financing_manage_bottom_contract',
            recordList: getRecordItemTab(),
        };
        return {
            ...handleComposeOrderTable<WrScfContract>(param),
            loading,
            tableList,
            formatTime,
            expandIcon,
            getContractName,
            getFinanceTypeName,
            getScfContractTypeName,
        };
    },
});
</script>

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