fix: bulk delete collection field should not close modal (#4263)

This commit is contained in:
katherinehhh 2024-05-07 09:44:55 +08:00 committed by GitHub
parent 080fc78c1a
commit 0214bb915e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 5 deletions

View File

@ -39,12 +39,18 @@ export const useDestroyActionAndRefreshCM = () => {
},
};
};
export const useBulkDestroyActionAndRefreshCM = () => {
/**
*
* @param flag
* @returns
*/
export const useBulkDestroyActionAndRefreshCM = (flag?) => {
const { run } = useBulkDestroyAction();
const { refreshCM } = useCollectionManager_deprecated();
return {
async run() {
await run();
await run(flag);
await refreshCM();
},
};
@ -71,7 +77,7 @@ export const useBulkDestroyAction = () => {
const form = useForm();
const { cascade } = form?.values || {};
return {
async run() {
async run(flag?) {
if (!state?.selectedRowKeys?.length) {
return message.error(t('Please select the records you want to delete'));
}
@ -80,7 +86,7 @@ export const useBulkDestroyAction = () => {
cascade,
});
form.reset();
ctx?.setVisible?.(false);
!flag && ctx?.setVisible?.(false);
setState?.({ selectedRowKeys: [] });
refresh();
},

View File

@ -413,7 +413,7 @@ const CollectionFieldsInternal = () => {
const deleteProps = useMemo(
() => ({
useAction: useBulkDestroyActionAndRefreshCM,
useAction: () => useBulkDestroyActionAndRefreshCM(true),
title: t('Delete'),
icon: 'DeleteOutlined',
disabled: targetTemplate?.forbidDeletion,