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)
}
}
+2 -1
View File
@@ -154,7 +154,8 @@ pnpm --filter @inkreach/api backfill:product-families
归并(同组合取最低价,「链接数」列显示来源数,人工价带标签),无需额外请求;
- 编辑弹窗商品「名称」预填解析后的「品名 型号」,保存即采用解析名;右侧原产品库与配置弹窗
始终显示**原始链接名**
- 配置弹窗「合并同名」支持**搜索过滤**同分类链接(含已配置链接)。
- 配置弹窗「合并同名」候选为**全局同款链接**(按名称 3 段组键跨分类匹配,
含已配置链接),支持搜索过滤。
- 右树徽标语义(**族感知**,公开契约一族一款):**已配置 N**(绿,本链接已配置为官网商品,
N=国数)/ **已配置**(绿,本链接未单独建商品但所属族已配置)/ **成族**(蓝,已归族且全族
未配置)/ **未配置**(橙);「定位到官网商品」在自身或同族已配置时出现(按 主链接 → 同族 →