优化BasicSelectTree
parent
20f3ff46a9
commit
25371cab89
|
|
@ -25,11 +25,11 @@ function BasicSelectTree(props) {
|
|||
// 根据 level 处理树数据
|
||||
let processedTreeData = level
|
||||
? processTreeDataByLevel({
|
||||
data: treeData,
|
||||
level,
|
||||
childrenKey,
|
||||
currentLevel: 1,
|
||||
})
|
||||
data: treeData,
|
||||
level,
|
||||
childrenKey,
|
||||
currentLevel: 1,
|
||||
})
|
||||
: treeData;
|
||||
|
||||
// 根据 onlyLastLevel 处理树数据
|
||||
|
|
@ -51,17 +51,18 @@ function BasicSelectTree(props) {
|
|||
}
|
||||
onGetNodePaths?.(arrayObjectDeduplication(parentNodes, idKey));
|
||||
onGetLabel?.(label);
|
||||
return;
|
||||
}
|
||||
const parentNodes = getTreeNodePaths({
|
||||
data: treeData,
|
||||
targetId: value,
|
||||
idKey,
|
||||
childrenKey,
|
||||
isIncludeOneself: onGetNodePathsIsIncludeOneself,
|
||||
});
|
||||
onGetNodePaths?.(parentNodes);
|
||||
onGetLabel?.(parentNodes[parentNodes.length - 1][nameKey]);
|
||||
else {
|
||||
const parentNodes = getTreeNodePaths({
|
||||
data: treeData,
|
||||
targetId: value,
|
||||
idKey,
|
||||
childrenKey,
|
||||
isIncludeOneself: onGetNodePathsIsIncludeOneself,
|
||||
});
|
||||
onGetNodePaths?.(parentNodes);
|
||||
onGetLabel?.(parentNodes[parentNodes.length - 1][nameKey]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
onGetNodePaths?.([]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue