<!-- 报表查询-资金账户报表-资金信息 -->
<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 { taaccountReportQuery } 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(taaccountReportQuery, {
    manual: true,
    params: props.params,
    onSuccess: (res) => {
        dataList.value = [res.data]
    },
    onError: (err) => {
        ElMessage.error(err)
    }
})

const tableColumns = shallowRef<Model.TableColumn[]>([
    { field: 'balance', label: 'report.account.bank.balance' },
    { field: 'currentbalance', label: 'report.account.bank.currentbalance' },
    { field: 'inamount', label: 'report.account.bank.inamount' },
    { field: 'outamount', label: 'report.account.bank.outamount' },
    { field: 'otherincome', label: 'report.account.bank.otherincome' },
    { field: 'otherpay', label: 'report.account.bank.otherpay' },
    { field: 'closepl', label: 'report.account.bank.closepl' },
    { field: 'reckonpl', label: 'report.account.bank.reckonpl' },
    { field: 'usedmargin', label: 'report.account.bank.usedmargin' },
    { field: 'freezemargin', label: 'report.account.bank.freezemargin' },
    { field: 'otherfreezemargin', label: 'report.account.bank.otherfreezemargin' },
    { field: 'paycharge', label: 'report.account.bank.paycharge' },
    { field: 'tradecharge', label: 'report.account.bank.tradecharge' },
    { field: 'deliverycharge', label: 'report.account.bank.deliverycharge' },
])

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