fix: pageSize 200 & not a function (#1299)

This commit is contained in:
anuoua 2022-12-30 16:24:17 +08:00 committed by GitHub
parent 7bfd8ea05b
commit 07a01fc507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 15 deletions

View File

@ -17,10 +17,21 @@ export type SharedFilterContextValue = {
getFilterParams: (filterStore?: SharedFilterStore) => any;
};
export const getFilterParams = (filterStore?: SharedFilterStore) => {
const newAssociationFilterList = Object.entries(filterStore).map(([key, filter]) => filter);
const newAssociationFilter = newAssociationFilterList.length
? {
$and: newAssociationFilterList,
}
: {};
return newAssociationFilter;
};
export const SharedFilterContext = createContext<SharedFilterContextValue>({
sharedFilterStore: {},
setSharedFilterStore: undefined!,
getFilterParams: undefined!,
setSharedFilterStore: () => {},
getFilterParams,
});
export const concatFilter = (f1: SharedFilter, f2: SharedFilter): SharedFilter => {
@ -39,23 +50,14 @@ export const SharedFilterProvider: FC<{ params?: any }> = (props) => {
setSharedFilterStoreUnwrap(associationFilter);
};
const getFilterParams = (filterStore?: SharedFilterStore) => {
const newAssociationFilterList = Object.entries(filterStore ?? sharedFilterStore).map(([key, filter]) => filter);
const newAssociationFilter = newAssociationFilterList.length
? {
$and: newAssociationFilterList,
}
: {};
return newAssociationFilter;
};
const getFilterParamsWrap = (filterStore?: SharedFilterStore) => getFilterParams(filterStore ?? sharedFilterStore);
return (
<SharedFilterContext.Provider
value={{
sharedFilterStore,
setSharedFilterStore,
getFilterParams,
getFilterParams: getFilterParamsWrap,
}}
>
{props.children}

View File

@ -43,6 +43,8 @@ export const AssociationFilterItem = (props) => {
action: 'list',
params: {
fields: [labelKey, valueKey],
pageSize: 200,
page: 1,
},
},
{
@ -89,7 +91,7 @@ export const AssociationFilterItem = (props) => {
const paramFilter = getFilterParams(newAssociationFilterStore);
service.run({ ...service.params?.[0], page: 1, filter: paramFilter });
service.run({ ...service.params?.[0], pageSize: 200, page: 1, filter: paramFilter });
};
const handleSearchToggle = (e: MouseEvent) => {
@ -179,7 +181,7 @@ export const AssociationFilterItem = (props) => {
className={css`
& .ant-collapse-content-box {
padding: 0 8px !important;
max-height: 200px;
max-height: 400px;
overflow: auto;
}
& .ant-collapse-header {