mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 06:46:38 +00:00
fix: bulk delete collection field should not close modal (#4263)
This commit is contained in:
parent
080fc78c1a
commit
0214bb915e
@ -39,12 +39,18 @@ export const useDestroyActionAndRefreshCM = () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export const useBulkDestroyActionAndRefreshCM = () => {
|
|
||||||
|
/**
|
||||||
|
* 是否关闭弹窗
|
||||||
|
* @param flag
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const useBulkDestroyActionAndRefreshCM = (flag?) => {
|
||||||
const { run } = useBulkDestroyAction();
|
const { run } = useBulkDestroyAction();
|
||||||
const { refreshCM } = useCollectionManager_deprecated();
|
const { refreshCM } = useCollectionManager_deprecated();
|
||||||
return {
|
return {
|
||||||
async run() {
|
async run() {
|
||||||
await run();
|
await run(flag);
|
||||||
await refreshCM();
|
await refreshCM();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -71,7 +77,7 @@ export const useBulkDestroyAction = () => {
|
|||||||
const form = useForm();
|
const form = useForm();
|
||||||
const { cascade } = form?.values || {};
|
const { cascade } = form?.values || {};
|
||||||
return {
|
return {
|
||||||
async run() {
|
async run(flag?) {
|
||||||
if (!state?.selectedRowKeys?.length) {
|
if (!state?.selectedRowKeys?.length) {
|
||||||
return message.error(t('Please select the records you want to delete'));
|
return message.error(t('Please select the records you want to delete'));
|
||||||
}
|
}
|
||||||
@ -80,7 +86,7 @@ export const useBulkDestroyAction = () => {
|
|||||||
cascade,
|
cascade,
|
||||||
});
|
});
|
||||||
form.reset();
|
form.reset();
|
||||||
ctx?.setVisible?.(false);
|
!flag && ctx?.setVisible?.(false);
|
||||||
setState?.({ selectedRowKeys: [] });
|
setState?.({ selectedRowKeys: [] });
|
||||||
refresh();
|
refresh();
|
||||||
},
|
},
|
||||||
|
@ -413,7 +413,7 @@ const CollectionFieldsInternal = () => {
|
|||||||
|
|
||||||
const deleteProps = useMemo(
|
const deleteProps = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
useAction: useBulkDestroyActionAndRefreshCM,
|
useAction: () => useBulkDestroyActionAndRefreshCM(true),
|
||||||
title: t('Delete'),
|
title: t('Delete'),
|
||||||
icon: 'DeleteOutlined',
|
icon: 'DeleteOutlined',
|
||||||
disabled: targetTemplate?.forbidDeletion,
|
disabled: targetTemplate?.forbidDeletion,
|
||||||
|
Loading…
Reference in New Issue
Block a user