fix: cannot display data when remove last page and the page only just one item (#1685)

* fix: cannot display data when remove last page and the page only just one item

* fix: hidden pagination when pageSize = totalSize
This commit is contained in:
Dunqing 2023-04-13 14:14:26 +08:00 committed by GitHub
parent 86de0733ad
commit ca88638edf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -718,7 +718,17 @@ export const useDestroyActionProps = () => {
await resource.destroy({
filterByTk,
});
service?.refresh?.();
const { count = 0, page = 0, pageSize = 0 } = service?.data?.meta || {};
if (count % pageSize === 1) {
service.run({
...service?.params?.[0],
page: page - 1,
});
} else {
service?.refresh?.();
}
if (block !== 'TableField') {
__parent?.service?.refresh?.();
setVisible?.(false);

View File

@ -131,7 +131,7 @@ const usePaginationProps = (pagination1, pagination2) => {
...pagination1,
...pagination2,
};
return result.total < result.pageSize ? false : result;
return result.total <= result.pageSize ? false : result;
};
const useValidator = (validator: (value: any) => string) => {