1- import { Button , Card , Popconfirm , Table , Tag } from 'antd' ;
21import { Suspense , lazy } from 'react' ;
32import { fetchGetUserList } from '@/service/api' ;
43import { enableStatusRecord , userGenderRecord } from '@/constants/business' ;
@@ -22,7 +21,7 @@ export function Component() {
2221
2322 const { tableWrapperRef, scrollConfig } = useTableScroll ( ) ;
2423
25- const { columns , columnChecks, data, run , loading , pagination , reset , form , setColumnChecks } = useTable (
24+ const { columnChecks, data, reset , form , setColumnChecks , tableProps , run } = useTable (
2625 {
2726 apiFn : fetchGetUserList ,
2827 apiParams : {
@@ -65,7 +64,7 @@ export function Component() {
6564
6665 const label = t ( userGenderRecord [ record . userGender ] ) ;
6766
68- return < Tag color = { tagUserGenderMap [ record . userGender ] } > { label } </ Tag > ;
67+ return < ATag color = { tagUserGenderMap [ record . userGender ] } > { label } </ ATag > ;
6968 }
7069 } ,
7170 {
@@ -99,10 +98,8 @@ export function Component() {
9998 if ( record . status === null ) {
10099 return null ;
101100 }
102-
103101 const label = t ( enableStatusRecord [ record . status ] ) ;
104-
105- return < Tag color = { tagMap [ record . status ] } > { label } </ Tag > ;
102+ return < ATag color = { tagMap [ record . status ] } > { label } </ ATag > ;
106103 }
107104 } ,
108105 {
@@ -112,25 +109,25 @@ export function Component() {
112109 width : 130 ,
113110 render : ( _ , record ) => (
114111 < div className = "flex-center gap-8px" >
115- < Button
112+ < AButton
116113 type = "primary"
117114 ghost
118115 size = "small"
119116 onClick = { ( ) => edit ( record . id ) }
120117 >
121118 { t ( 'common.edit' ) }
122- </ Button >
123- < Popconfirm
119+ </ AButton >
120+ < APopconfirm
124121 title = { t ( 'common.confirmDelete' ) }
125122 onConfirm = { ( ) => handleDelete ( record . id ) }
126123 >
127- < Button
124+ < AButton
128125 danger
129126 size = "small"
130127 >
131128 { t ( 'common.delete' ) }
132- </ Button >
133- </ Popconfirm >
129+ </ AButton >
130+ </ APopconfirm >
134131 </ div >
135132 )
136133 }
@@ -175,7 +172,7 @@ export function Component() {
175172 reset = { reset }
176173 form = { form }
177174 />
178- < Card
175+ < ACard
179176 styles = { { body : { flex : 1 , overflow : 'hidden' } } }
180177 ref = { tableWrapperRef }
181178 bordered = { false }
@@ -184,7 +181,7 @@ export function Component() {
184181 onDelete = { handleBatchDelete }
185182 refresh = { run }
186183 add = { handleAdd }
187- loading = { loading }
184+ loading = { tableProps . loading }
188185 setColumnChecks = { setColumnChecks }
189186 disabledDelete = { checkedRowKeys . length === 0 }
190187 columns = { columnChecks }
@@ -193,15 +190,11 @@ export function Component() {
193190 title = { t ( 'page.manage.user.title' ) }
194191 className = "flex-col-stretch sm:flex-1-hidden card-wrapper"
195192 >
196- < Table
197- pagination = { pagination }
198- rowKey = "id"
193+ < ATable
199194 scroll = { scrollConfig }
200195 rowSelection = { rowSelection }
201196 size = "small"
202- loading = { loading }
203- dataSource = { data }
204- columns = { columns }
197+ { ...tableProps }
205198 />
206199 < Suspense >
207200 < UserOperateDrawer
@@ -212,7 +205,7 @@ export function Component() {
212205 closeDrawer = { closeDrawer }
213206 />
214207 </ Suspense >
215- </ Card >
208+ </ ACard >
216209 </ div >
217210 ) ;
218211}
0 commit comments