fix: crossDomain 重复收集 — 真实树中的 system_mgmt/crossDomain 与虚拟 global_privileges 冲突,从真实树中移除 crossDomain 避免双重收集

This commit is contained in:
yueli
2026-07-17 16:22:59 +08:00
parent 0e6294890c
commit 29de22b575
2 changed files with 13 additions and 18 deletions

View File

@ -256,8 +256,19 @@ const fetchTree = async () => {
]
};
// 将虚拟节点放在最前面,然后交给 transformData 处理
const rawData = [globalNode, ...(res.data || [])];
// ★ 从真实树中移除 crossDomain已由虚拟节点 global_privileges 统一管理,避免重复)
const stripCrossDomain = (nodes: any[]) => {
nodes.forEach(node => {
if (node.children) {
node.children = node.children.filter((c: any) => c.code !== 'crossDomain')
stripCrossDomain(node.children)
}
})
}
const realData = res.data || []
stripCrossDomain(realData)
const rawData = [globalNode, ...realData];
rawTreeData.value = rawData;
tableData.value = transformData(rawData);
}
@ -468,13 +479,8 @@ const handleSave = async () => {
// 2. 操作权限 (crossDomain 不依赖页面可读)
if (row.hasWrite && row.operationCode) {
if (row.operationCode === 'crossDomain' || row.hasRead) {
if (row.operationCode === 'crossDomain') {
console.log('[DEBUG crossDomain] hasWrite=true, 将被加入提交列表. row.code=', row.code)
}
permissions.push(row.operationCode)
}
} else if (row.operationCode === 'crossDomain') {
console.log('[DEBUG crossDomain] hasWrite=', row.hasWrite, ', hasRead=', row.hasRead, ', 不会被加入提交列表')
}
// 3. 字段权限 (只有当页面可读时才有效)