Skip to content

Commit

Permalink
fix: crud2条件查询表单重置失效 (#9706)
Browse files Browse the repository at this point in the history
  • Loading branch information
citywalki committed Mar 4, 2024
1 parent 1a4c46a commit 4590738
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 @@ -542,7 +542,7 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
}

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 @@ -1207,12 +1207,17 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
data: this.props.store.filterData,
onSubmit: (data: any) =>
this.handleSearch({query: data, resetPage: true}),
onReset: () =>
onReset: (data: any) => {
const resetQueries: any = {};
Object.keys(data!).forEach(key => (resetQueries[key] = ''));

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

0 comments on commit 4590738

Please sign in to comment.