feat(product-family): replace legacy good merge with family mechanism in config view and public detail

This commit is contained in:
yeuimu
2026-08-28 14:14:58 +08:00
parent 14c53504f0
commit 4eadb67c36
11 changed files with 2894 additions and 2710 deletions
@@ -0,0 +1,13 @@
# 产品族 × 商品配置页完整融入 实施计划
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans. Steps use checkbox (`- [ ]`) syntax.
**Goal:** 「商品配置」页深度接入族:右树按族分组、配置勾选兄弟=挂族(双写兼容)、编辑表单可查看/切换族。
**Tasks:**
1. **后端**`UpdateGoodDto.familyId?: number | null``update()` 校验族存在后写入;`GOOD_INCLUDE.originGood``family` select 并透出到 `GoodDetailDto``family: { familyId, familyCode, familyName } | null`)。测试:update 改族/清族/非法族 404。
2. **右树按族分组**`buildRightTree.mapCat` 内按 `og.familyId` 分桶:族节点(`isFamily: true`label=`编码 · 族名 (n)`+ 未入族桶;og 节点 `parentId` 指向族节点(`collectSiblings` 语义随之升级为同族);非 OG 节点模板分支渲染族节点。过滤/展开/计数逻辑不改(遍历式,天然兼容)。
3. **配置弹窗挂族**`handleConfigSubmit` 在 createGood 前:主链接有族 → `updateMembers(add: 勾选兄弟)`;无族且有勾选 → `POST /product-families`(族名=主链接名 3 段截断, `originGoodIds=[主+勾选]`);**保留 mergedOriginGoodIds 双写**(公开读路径兼容观察期)。
4. **编辑表单族显示/切换**:编辑弹窗显示 `所属族`familyCode/familyName),可搜索切换(远程搜索族列表),保存时 `updateGood({ familyId })`
5. 验证:api 全量 + admin vitest + vue-tsc/build + 冒烟;文档更新(structs/product-center);合并 develop。