From fdfe435ecd39400e405efe6ef7e872fb3889da0e Mon Sep 17 00:00:00 2001 From: yeuimu <2197651308@qq.com> Date: Fri, 28 Aug 2026 20:04:29 +0800 Subject: [PATCH] fix(admin): config dialog merge candidates search globally by name group MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 合并同名候选不再局限于当前分类节点:collectSiblings 改为按名称 3 段组键 (sameOriginGroup)遍历整棵右树收集同款链接(含已配置,勾选归族幂等), 跨分类的同款链接(如 BRTF004 分布在多个分类组)也能勾选归族 --- apps/admin/src/views/goods/GoodsView.vue | 12 ++++++++++-- docs/references/product-center.md | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/admin/src/views/goods/GoodsView.vue b/apps/admin/src/views/goods/GoodsView.vue index 4197c4c..7cb62db 100644 --- a/apps/admin/src/views/goods/GoodsView.vue +++ b/apps/admin/src/views/goods/GoodsView.vue @@ -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) } } diff --git a/docs/references/product-center.md b/docs/references/product-center.md index 56d09cf..2964884 100644 --- a/docs/references/product-center.md +++ b/docs/references/product-center.md @@ -154,7 +154,8 @@ pnpm --filter @inkreach/api backfill:product-families 归并(同组合取最低价,「链接数」列显示来源数,人工价带标签),无需额外请求; - 编辑弹窗商品「名称」预填解析后的「品名 型号」,保存即采用解析名;右侧原产品库与配置弹窗 始终显示**原始链接名**; -- 配置弹窗「合并同名」支持**搜索过滤**同分类链接(含已配置链接)。 +- 配置弹窗「合并同名」候选为**全局同款链接**(按名称 3 段组键跨分类匹配, + 含已配置链接),支持搜索过滤。 - 右树徽标语义(**族感知**,公开契约一族一款):**已配置 N**(绿,本链接已配置为官网商品, N=国数)/ **已配置**(绿,本链接未单独建商品但所属族已配置)/ **成族**(蓝,已归族且全族 未配置)/ **未配置**(橙);「定位到官网商品」在自身或同族已配置时出现(按 主链接 → 同族 →