import { queryHisTradeDetail, queryTradeDetail } from '@/services/go/ermcp/order';
import { QueryTradeDetailRsp } from '@/services/go/ermcp/order/interface';
import { message } from 'ant-design-vue';
import { ref } from 'vue';


export function queryTableList() {
    // 加载状态
    const loading = ref<boolean>(false);
    // 表格数据
    const tableList = ref<QueryTradeDetailRsp[]>([]);
    function queryTable() {
        loading.value = true
        Promise.all([queryTradeDetail({}), queryHisTradeDetail({})]).then(res => {
            tableList.value = res[0]
            res[1].forEach(el => {
                tableList.value.push(el)
            })
        }).catch(err => {
            message.error('查询成交单失败：' + err)
        }).finally(() => loading.value = false)
    }
    return { loading, tableList, queryTable }
}