mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
fix: display issue with linkage rules in multi-level association data (#6755)
This commit is contained in:
parent
aecca20215
commit
a76ae40968
@ -36,16 +36,15 @@ const findOption = (str, options) => {
|
|||||||
|
|
||||||
const [firstKey, ...subKeys] = match[1].split('.'); // 拆分层级
|
const [firstKey, ...subKeys] = match[1].split('.'); // 拆分层级
|
||||||
const keys = [`$${firstKey}`, ...subKeys]; // 第一层保留 `$`,后续不带 `$`
|
const keys = [`$${firstKey}`, ...subKeys]; // 第一层保留 `$`,后续不带 `$`
|
||||||
|
|
||||||
let currentOptions = options;
|
let currentOptions = options;
|
||||||
let option = null;
|
let option = null;
|
||||||
for (const key of keys) {
|
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;
|
if (!option) return null;
|
||||||
|
|
||||||
// 进入下一层 children 查找
|
// 进入下一层 children 查找
|
||||||
if (Array.isArray(option.children) || option.isLeaf === false) {
|
if (Array.isArray(option.children) || option.isLeaf === false) {
|
||||||
currentOptions = option.children;
|
currentOptions = option.children || option.field.children;
|
||||||
} else {
|
} else {
|
||||||
return option; // 没有 children 直接返回
|
return option; // 没有 children 直接返回
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user