diff --git a/packages/core/client/src/schema-component/antd/form/Form.tsx b/packages/core/client/src/schema-component/antd/form/Form.tsx index d3375b044..3f3c20469 100644 --- a/packages/core/client/src/schema-component/antd/form/Form.tsx +++ b/packages/core/client/src/schema-component/antd/form/Form.tsx @@ -101,6 +101,7 @@ export const Form: React.FC & { Designer?: any } = observer( async onSuccess(data) { await form.reset(); form.setValues(data?.data); + form.setInitialValues(data?.data); }, }, props, diff --git a/packages/plugins/@nocobase/plugin-acl/src/client/schemas/roles.ts b/packages/plugins/@nocobase/plugin-acl/src/client/schemas/roles.ts index 3d3643ceb..5e9321d22 100644 --- a/packages/plugins/@nocobase/plugin-acl/src/client/schemas/roles.ts +++ b/packages/plugins/@nocobase/plugin-acl/src/client/schemas/roles.ts @@ -43,6 +43,13 @@ export const roleEditSchema = { 'x-component': 'CollectionField', 'x-decorator': 'FormItem', 'x-content': '{{t("Default role")}}', + 'x-reactions': (field) => { + if (field.initialValue) { + field.disabled = true; + } else { + field.disabled = false; + } + }, }, footer: { type: 'void', diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/FileStorage.tsx b/packages/plugins/@nocobase/plugin-file-manager/src/client/FileStorage.tsx index 83ab7d0f9..850e50e54 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/FileStorage.tsx +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/FileStorage.tsx @@ -96,6 +96,15 @@ export const EditStorage = () => { onClick={() => { setVisible(true); const storageType = plugin.storageTypes.get(record.type); + if (storageType.properties['default']) { + storageType.properties['default']['x-reactions'] = (field) => { + if (field.initialValue) { + field.disabled = true; + } else { + field.disabled = false; + } + }; + } setSchema({ type: 'object', properties: {