<!-- 报表查询-资金账户报表-仓单汇总表 -->
<template>
    <app-table :data="dataList" :columns="tableColumns">
        <template #footer>
            <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex" @change="run" />
        </template>
    </app-table>
</template>

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

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

const { dataList, total, pageSize, pageIndex, run } = useRequest(wrPositionQuery, {
    manual: true,
    params: props.params,
    onError: (err) => {
        ElMessage.error(err)
    }
})

const tableColumns = shallowRef<Model.TableColumn[]>([
    { field: 'deliverygoodsname', label: 'report.account.wrorder.deliverygoodsname' },
    { field: 'wrstandardname', label: 'report.account.wrorder.wrstandardname' },
    { field: 'startqty', label: 'report.account.wrorder.startqty' },
    { field: 'totalqty', label: 'report.account.wrorder.totalqty' },
    { field: 'usedqty', label: 'report.account.wrorder.usedqty' },
    { field: 'freezeqty', label: 'report.account.wrorder.freezeqty' },
    { field: 'increaseqty', label: 'report.account.wrorder.increaseqty' },
    { field: 'decreaseqty', label: 'report.account.wrorder.decreaseqty' },
])

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