Skip to content

Commit

Permalink
fix: crud2条件查询表单重置失效 (baidu#9706)
Browse files Browse the repository at this point in the history
  • Loading branch information
citywalki authored and 2betop committed Mar 26, 2024
1 parent d1ba174 commit 88acd24
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/amis/src/renderers/CRUD2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
: query;

store.updateQuery(
resetQuery ? this.props.store.pristineQuery : query,
resetQuery ? {...query, ...this.props.store.pristineQuery} : query,
syncLocation && env && env.updateLocation
? (location: any) => env.updateLocation(location, true)
: undefined,
Expand Down Expand Up @@ -1086,11 +1086,16 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
key: index + 'filter',
data: this.props.store.filterData,
onSubmit: (data: any) => this.handleSearch({query: data}),
onReset: () =>
onReset: (data: any) => {
const resetQueries: any = {};
Object.keys(data!).forEach(key => (resetQueries[key] = ''));

this.handleSearch({
query: resetQueries,
resetQuery: true,
replaceQuery: true
})
});
}
})
);
}
Expand Down

0 comments on commit 88acd24

Please sign in to comment.