diff --git a/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts b/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts index 630567cee..9bad5f096 100644 --- a/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts +++ b/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts @@ -260,13 +260,13 @@ function loadChildren({ node, traverseAssociations, traverseFields, systemKeys, const activeNode = findNode(fields.dataSource || fields.componentProps.treeData, node); let children = []; // 多对多和多对一只展示关系字段 - if (['belongsTo', 'belongsToMany'].includes(node.field.type)) { + if (['belongsTo', 'belongsToMany'].includes(node.field.type) && node?.type === 'reference') { children = traverseAssociations(node.field.target, { exclude: systemKeys, prefix: node.key, maxDepth: 1, }); - } else if (['hasOne', 'hasMany'].includes(node.field.type)) { + } else if (['hasOne', 'hasMany'].includes(node.field.type) || node?.type === 'duplicate') { children = traverseFields(node.field.target, { exclude: ['id', ...systemKeys], prefix: node.key, diff --git a/packages/core/client/src/schema-settings/DataTemplates/utils.tsx b/packages/core/client/src/schema-settings/DataTemplates/utils.tsx index 57cdedad9..fa4e63ceb 100644 --- a/packages/core/client/src/schema-settings/DataTemplates/utils.tsx +++ b/packages/core/client/src/schema-settings/DataTemplates/utils.tsx @@ -53,7 +53,7 @@ export const useSyncFromForm = (fieldSchema, collection?, callBack?) => { field, disabled, }; - const tatgetFormField = formData.find((v) => v.name === field.name); + const tatgetFormField = formData.find((v) => v.name === option.key); if ( ['belongsTo', 'belongsToMany'].includes(field.type) && (!tatgetFormField || ['Select', 'Picker'].includes(tatgetFormField?.fieldMode))