Add 10/20/50/100 page-size pagination across treasury list pages.
EOF Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,7 +7,9 @@ import {
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import type { TreasuryPartyBalanceDto } from '@mento/shared';
|
||||
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
|
||||
import { toman } from '@/views/treasury/treasury-format';
|
||||
import { useTreasuryListPaging } from '@/views/treasury/useTreasuryListPaging';
|
||||
import { useTreasuryMobile } from '@/views/treasury/useTreasuryMobile';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -19,6 +21,16 @@ const isMobile = useTreasuryMobile();
|
||||
const { Text: ATypographyText } = Typography;
|
||||
const AListItem = AList.Item;
|
||||
|
||||
const {
|
||||
page,
|
||||
pageSize,
|
||||
pageSizeOptions,
|
||||
total,
|
||||
pagedRows,
|
||||
onPageSizeChange,
|
||||
showTotal,
|
||||
} = useTreasuryListPaging(() => props.rows, 'treasury.party-balances');
|
||||
|
||||
const kindLabel: Record<string, string> = {
|
||||
person: 'مشتری',
|
||||
company: 'شرکت',
|
||||
@@ -58,7 +70,7 @@ function kindOf(record: TreasuryPartyBalanceDto) {
|
||||
<template>
|
||||
<a-list
|
||||
v-if="isMobile"
|
||||
:data-source="rows"
|
||||
:data-source="pagedRows"
|
||||
:locale="{ emptyText: 'ماندهای نیست.' }"
|
||||
>
|
||||
<template #renderItem="{ item }">
|
||||
@@ -87,9 +99,17 @@ function kindOf(record: TreasuryPartyBalanceDto) {
|
||||
<a-table
|
||||
v-else
|
||||
:columns="columns"
|
||||
:data-source="rows"
|
||||
:data-source="pagedRows"
|
||||
:pagination="false"
|
||||
row-key="key"
|
||||
:locale="{ emptyText: 'ماندهای نیست.' }"
|
||||
/>
|
||||
<TreasuryListPagination
|
||||
v-model:page="page"
|
||||
:total="total"
|
||||
:page-size="pageSize"
|
||||
:page-size-options="pageSizeOptions"
|
||||
:show-total="showTotal"
|
||||
@update:page-size="onPageSizeChange"
|
||||
/>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user