Skip to content

Commit a18e790

Browse files
committed
fix: Home connection cannot switch pages
1 parent 6c805f8 commit a18e790

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

  • chat2db-client/src/pages/main/team/universal-drawer

chat2db-client/src/pages/main/team/universal-drawer/index.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function UniversalDrawer(props: IProps) {
7272
showSizeChanger: true,
7373
showQuickJumper: true,
7474
});
75+
const [total, setTotal] = useState(0);
7576

7677
const managementMap: Record<AffiliationType, IAffiliationDetail> = useMemo(
7778
() => ({
@@ -322,6 +323,7 @@ function UniversalDrawer(props: IProps) {
322323
showSizeChanger: true,
323324
showQuickJumper: true,
324325
});
326+
setTotal(0);
325327
setModalInfo({
326328
open: false,
327329
type: managementDataByType?.searchType,
@@ -346,6 +348,7 @@ function UniversalDrawer(props: IProps) {
346348
});
347349
if (res) {
348350
setDataSource(res?.data ?? []);
351+
setTotal(res?.total ?? 0);
349352
}
350353
};
351354

@@ -356,6 +359,13 @@ function UniversalDrawer(props: IProps) {
356359
});
357360
};
358361

362+
const handleTableChange = (p: any) => {
363+
setPagination({
364+
...pagination,
365+
...p,
366+
});
367+
};
368+
359369
if (!managementDataByType) {
360370
return;
361371
}
@@ -385,7 +395,16 @@ function UniversalDrawer(props: IProps) {
385395
{i18n('common.button.add')}
386396
</Button>
387397
</div>
388-
<Table rowKey={'id'} columns={managementDataByType?.columns} dataSource={dataSource} />
398+
<Table
399+
rowKey={'id'}
400+
pagination={{
401+
...pagination,
402+
total,
403+
}}
404+
columns={managementDataByType?.columns}
405+
dataSource={dataSource}
406+
onChange={handleTableChange}
407+
/>
389408

390409
<UniversalAddModal
391410
{...modalInfo}

0 commit comments

Comments
 (0)