<!-- 报表查询-资金账户报表-履约汇总表 -->
<template>
    <app-table :data="dataList" :columns="tableColumns" />
</template>

<script lang="ts" setup>
import { shallowRef, PropType } from 'vue'
import { ElMessage } from 'element-plus'
import { useRequest } from '@/hooks/request'
import { accountppQuery } from '@/services/api/report'
import AppTable from '@pc/components/base/table/index.vue'

const props = defineProps({
    params: {
        type: Object as PropType<Model.TaaccountReportReq>,
        required: true
    }
})

const { dataList, run } = useRequest(accountppQuery, {
    manual: true,
    params: props.params,
    onSuccess: (res) => {
        dataList.value = [res.data]
    },
    onError: (err) => {
        ElMessage.error(err)
    }
})

const tableColumns = shallowRef<Model.TableColumn[]>([
    { field: 'amount', label: 'report.account.performance.amount' },
    { field: 'buypaidamount', label: 'report.account.performance.buypaidamount' },
    { field: 'sellreceivedamount', label: 'report.account.performance.sellreceivedamount' },
    { field: 'buytodayamount', label: 'report.account.performance.buytodayamount' },
    { field: 'selltodayamount', label: 'report.account.performance.selltodayamount' },
])

defineExpose({
    query: () => run()
})
</script>