fix(admin): config dialog merge candidates search globally by name group

合并同名候选不再局限于当前分类节点:collectSiblings 改为按名称 3 段组键
(sameOriginGroup)遍历整棵右树收集同款链接(含已配置,勾选归族幂等),
跨分类的同款链接(如 BRTF004 分布在多个分类组)也能勾选归族
This commit is contained in:
yeuimu
2026-08-28 20:04:29 +08:00
parent a14b8ecf4a
commit fdfe435ecd
2 changed files with 12 additions and 3 deletions
+10 -2
View File
@@ -18,6 +18,7 @@ import { tagGroupsApi } from '@/api/tag-groups'
import { originGoodsApi } from '@/api/origin-goods'
import { syncApi } from '@/api/sync'
import { sameFamily } from '@/utils/family-match'
import { sameOriginGroup } from '@/utils/origin-name'
import { cleanLinkName } from '@/utils/origin-name'
import GoodsConfigDialog from './components/GoodsConfigDialog.vue'
import CustomGoodDialog from './components/CustomGoodDialog.vue'
@@ -401,8 +402,15 @@ function collectSiblings(ogNode: any): any[] {
const result: any[] = []
function traverse(nodes: any[]) {
for (const n of nodes) {
// 同分类下的全部其他链接(含已配置的,勾选归族操作幂等)
if (n.isOG && n.parentId === ogNode.parentId && String(n.rawId) !== String(ogNode.rawId)) result.push(n)
// 全局同款链接(跨分类):合并同名按名称组键匹配,
// 不局限于当前分类;含已配置的,勾选归族操作幂等
if (
n.isOG &&
String(n.rawId) !== String(ogNode.rawId) &&
sameOriginGroup(ogNode.goodName ?? ogNode.label, n.goodName ?? n.label)
) {
result.push(n)
}
if (n.children?.length) traverse(n.children)
}
}