File tree Expand file tree Collapse file tree
chat2db-client/src/pages/main/team/universal-drawer Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments