fix: display issue with linkage rules in multi-level association data (#6755)

This commit is contained in:
Katherine 2025-04-23 22:06:16 +08:00 committed by GitHub
parent aecca20215
commit a76ae40968
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,16 +36,15 @@ const findOption = (str, options) => {
const [firstKey, ...subKeys] = match[1].split('.'); // 拆分层级
const keys = [`$${firstKey}`, ...subKeys]; // 第一层保留 `$`,后续不带 `$`
let currentOptions = options;
let option = null;
for (const key of keys) {
option = currentOptions.find((opt) => opt.value === key);
option = currentOptions.find((opt) => opt.value === key || opt.name === key);
if (!option) return null;
// 进入下一层 children 查找
if (Array.isArray(option.children) || option.isLeaf === false) {
currentOptions = option.children;
currentOptions = option.children || option.field.children;
} else {
return option; // 没有 children 直接返回
}