mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 11:56:29 +00:00
fix: useSyncFromForm support multi-level relationships (#2413)
This commit is contained in:
parent
3c161eab86
commit
823d4bd94d
@ -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,
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user