@@ -24,21 +24,29 @@ const confirm = Modal.confirm;
2424@inject ( Stores . RoleStore )
2525@observer
2626class Role extends AppComponentBase < IRoleProps > {
27- formRef : any ;
27+ formRef : any ;
28+
29+ constructor ( props : any ) {
30+ super ( props ) ;
31+
32+ this . getAll = this . getAll . bind ( this ) ;
33+ this . handleChange = this . handleChange . bind ( this ) ;
34+ }
2835
2936 state = {
3037 modalVisible : false ,
3138 maxResultCount : 10 ,
3239 skipCount : 0 ,
3340 roleId : 0 ,
41+ filter : ''
3442 } ;
3543
3644 async componentDidMount ( ) {
3745 await this . getAll ( ) ;
3846 }
3947
4048 async getAll ( ) {
41- await this . props . roleStore . getAll ( { maxResultCount : this . state . maxResultCount , skipCount : this . state . skipCount } ) ;
49+ await this . props . roleStore . getAll ( { maxResultCount : this . state . maxResultCount , skipCount : this . state . skipCount , keyword : this . state . filter } ) ;
4250 }
4351
4452 handleTableChange = ( pagination : any ) => {
@@ -101,7 +109,12 @@ class Role extends AppComponentBase<IRoleProps> {
101109
102110 saveFormRef = ( formRef : any ) => {
103111 this . formRef = formRef ;
104- } ;
112+ } ;
113+
114+ handleChange ( event : any ) {
115+ this . state . filter = event . target . value ;
116+ this . setState ( { value : event . target . value } ) ;
117+ }
105118
106119 public render ( ) {
107120 const { allPermissions, roles } = this . props . roleStore ;
@@ -159,6 +172,15 @@ class Role extends AppComponentBase<IRoleProps> {
159172 >
160173 < Button type = "primary" shape = "circle" icon = "plus" onClick = { ( ) => this . createOrUpdateModalOpen ( { id : 0 } ) } />
161174 </ Col >
175+ </ Row >
176+ < Row >
177+ < Col sm = { { span : 5 , offset : 0 } } >
178+ < input className = "ant-input" type = "text" placeholder = "filter" value = { this . state . filter } onChange = { this . handleChange . bind ( this ) } />
179+ </ Col >
180+
181+ < Col sm = { { span : 4 , offset : 1 } } >
182+ < Button type = "primary" icon = "search" value = "Submit" onClick = { this . getAll } > { L ( 'Search' ) } </ Button >
183+ </ Col >
162184 </ Row >
163185 < Row style = { { marginTop : 20 } } >
164186 < Col
0 commit comments