<template>
    <!-- 仓单贸易 浮动价挂牌-->
    <div class="warehouse_receipt_trade_floating_price topTableHeight">
        <a-table
            :columns="columns"
            class="srcollYTable"
            :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
            :pagination="false"
            :loading="loading"
            :expandedRowKeys="expandedRowKeys"
            :customRow="Rowclick"
            rowKey="key"
            :data-source="tableList"
        ></a-table>
        <!-- 右键 -->
        <contextMenu :contextMenu="contextMenu" @cancel="closeContext" :list="firstBtn"></contextMenu>
        <component
            :is="componentId"
            v-if="componentId"
            :selectedRow="selectedRow"
            @cancel="closeComponent"
        ></component>
    </div>
</template>

<script lang="ts">
import { EnumRouterName } from '@/common/constants/enumRouterName';
import { queryTableList, BtnList, contextMenu, defineAsyncComponent, defineComponent, ModalEnum, handleComposeTable, ComposeTableParam } from '@/common/export/commonTable';
import { queryAgreementConfig } from '@/services/go/ermcp/qhj';
import { QueryOrderQuoteReq, WrOrderQuote } from '@/services/go/wrtrade/interface';
import { queryOrderQuote } from '@/services/go/wrtrade';

export default defineComponent({
    name: EnumRouterName.warehouse_receipt_trade_floating_price,
    components: {
        contextMenu,
        [ModalEnum.warehouse_receipt_trade_floating_price_detail]: defineAsyncComponent(() => import('../../components/detail/index.vue')),
        [ModalEnum.warehouse_receipt_trade_floating_price_post_buying]: defineAsyncComponent(() => import('../../components/post_buying/index.vue')),
        [ModalEnum.warehouse_receipt_trade_floating_price_delisting]: defineAsyncComponent(() => import('../../components/buy-sell-market/index.vue')),
    },
    setup() {
        // 表格列表数据
        const { loading, tableList, queryTable } = queryTableList<WrOrderQuote>();
        // 获取列表数据
        const queryTableAction = () => {
            const param: QueryOrderQuoteReq = {
                wrpricetype: 2,
                haswr: 1,
            };
            // queryTable(queryOrderQuote, param);
            queryTable(queryAgreementConfig);
        };
        // 表格通用逻辑
        const param: ComposeTableParam = {
            queryFn: queryTableAction,
            menuType: EnumRouterName.warehouse_receipt_trade_floating_price,
            tableName: 'table_pcweb_agreement',
            tableFilterKey: [],
            isDetail: false,
        };
        return {
            ...handleComposeTable<WrOrderQuote>(param),
            loading,
            tableList,
        };
    },
});
</script>
<style lang="less">
</style>