fix(admin,api): always show family composition badge N条链接·M个配置

按用户反馈(PLTM006 明明能查到配置数却不显示):左树徽标此前只在
同分类内 ≥2 个配置时才出现,单配置族一行上什么都不显示,而右树同族
链接都挂着绿色已配置徽标,两边数字对不上,反复造成「配置数没显示」
的误解。

- goods API:GOOD_INCLUDE 的 family 带 _count.originGoods,
  GoodDto.originGood.family 增加 memberCount(族成员链接数)
- admin:distinctByFamily 记录 linkCount;一族一行的徽标常显
  「N 条链接 · M 个配置」(链接数=族成员数,配置数=该族官网商品数),
  悬浮仍列出全部配置可打开
- 文档同步徽标语义

效果:PLTM006 行显示「4 条链接 · 1 个配置」(真值:4 条链接仅配了
1 个官网商品);PLTF026 的「4 条链接 · 4 个配置」同屏可对比,其中
4 个配置为历史同国家重复配置,建议另行清理。

验证:admin vue-tsc 干净 + vitest 22/22;api goods spec 18/18;
Prisma _count 查询实测返回 originGoods=4
This commit is contained in:
yeuimu
2026-08-30 03:07:16 +08:00
parent 5d089bdb43
commit a756c8c3c8
5 changed files with 22 additions and 9 deletions
+3 -2
View File
@@ -13,7 +13,7 @@ export interface GoodRelations {
goodName: string | null;
goodImage: string | null;
goodPrice: unknown;
family?: { id: bigint; familyCode: string | null; familyName: string } | null;
family?: { id: bigint; familyCode: string | null; familyName: string; _count?: { originGoods: number } } | null;
detail?: {
productCode: string | null;
syncedAt: Date;
@@ -128,7 +128,7 @@ export class GoodDto {
sizeRowCount: number;
packageRowCount: number;
productCode: string | null;
family?: { familyId: string; familyCode: string | null; familyName: string } | null;
family?: { familyId: string; familyCode: string | null; familyName: string; memberCount?: number } | null;
} | null;
static from(
@@ -223,6 +223,7 @@ export class GoodDto {
familyId: rel.originGood.family.id.toString(),
familyCode: rel.originGood.family.familyCode,
familyName: rel.originGood.family.familyName,
memberCount: rel.originGood.family._count?.originGoods,
}
: null,
}