diff --git a/packages/core/client/src/collection-manager/Configuration/CollectionFields.tsx b/packages/core/client/src/collection-manager/Configuration/CollectionFields.tsx index 350aed573..09d709132 100644 --- a/packages/core/client/src/collection-manager/Configuration/CollectionFields.tsx +++ b/packages/core/client/src/collection-manager/Configuration/CollectionFields.tsx @@ -64,7 +64,7 @@ const CurrentFields = (props) => { const { [targetKey]: filterByTk, titleField, template } = useRecord(); const [loadingRecord, setLoadingRecord] = React.useState(null); const { refreshCM, isTitleField, getTemplate } = useCollectionManager(); - + const targetTemplate = getTemplate(template); const columns: TableColumnProps[] = [ { dataIndex: ['uiSchema', 'rawTitle'], @@ -130,7 +130,7 @@ const CurrentFields = (props) => { content: t('Are you sure you want to delete it?'), }, useAction: useDestroyActionAndRefreshCM, - disabled: isDeleteButtonDisabled(record), + disabled: isDeleteButtonDisabled(record) || targetTemplate?.forbidDeletion, title: t('Delete'), }; @@ -405,6 +405,7 @@ export const CollectionFields = () => { useAction: useBulkDestroyActionAndRefreshCM, title: t('Delete'), icon: 'DeleteOutlined', + disabled: targetTemplate?.forbidDeletion, confirm: { title: t('Delete record'), content: t('Are you sure you want to delete it?'), diff --git a/packages/core/client/src/collection-manager/templates/types.ts b/packages/core/client/src/collection-manager/templates/types.ts index e197b2b55..c57c8e0e9 100644 --- a/packages/core/client/src/collection-manager/templates/types.ts +++ b/packages/core/client/src/collection-manager/templates/types.ts @@ -20,6 +20,8 @@ export interface ICollectionTemplate { description?: string; /**配置字段中的操作按钮 */ configureActions?: Record; + //是否禁止删除字段 + forbidDeletion?: boolean; } interface AvailableFieldInterfacesInclude {