From 1419ee03fc1bb4a0564a33bf9559fd81d2ccb8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?= Date: Sat, 24 Oct 2026 13:07:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(qaops):=20=E5=8C=BA=E5=9F=9F=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E9=BB=98=E8=AE=A4=E4=BB=85=E5=B1=95=E5=BC=80=E5=88=B0?= =?UTF-8?q?=E4=B8=80=E7=BA=A7=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 只调整默认折叠深度;保留手动逐级展开、原统计值及另外两个分析维度。 验证:默认不显示二级节点的回归先红后绿,11项相关测试及类型检查通过。完整门禁、候选和上线验收待执行。 --- CHANGELOG.md | 6 ++++++ web/src/QADepartmentStatistics.test.tsx | 11 +++++++++-- web/src/QADepartmentStatistics.tsx | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6c3681..6128a06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,12 @@ > `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯, > 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。 +## 开发快照 snapshot/v0.1.47 - 2026-10-24 + +### Changed + +- 区域统计按部门视图默认只展开到一级部门,二级及以下初始收起;保留手动逐级展开、直属人员、既有统计口径及按区域/按人视图。 + ## 开发快照 snapshot/v0.1.46 - 2026-10-21 ### Added diff --git a/web/src/QADepartmentStatistics.test.tsx b/web/src/QADepartmentStatistics.test.tsx index 0e1e25b..b609343 100644 --- a/web/src/QADepartmentStatistics.test.tsx +++ b/web/src/QADepartmentStatistics.test.tsx @@ -41,14 +41,21 @@ it('hides direct people together with collapsed departments without changing bra expect(html).not.toContain('data-person-key=') expect(html).toContain('data-total-people="3"') }) -it('makes a deep leaf with direct people expandable but initially collapsed', () => { +it('defaults to first-level departments and keeps deeper leaves manually expandable without changing metrics', () => { const data = parseDepartmentStatistics(departmentStatisticsFixture, { period: 'all' }).snapshot! const child = data.rows.find((d) => d.id === 'child')! data.rows.push({ ...child, id: 'deep', parent_id: 'child', name: 'Deep Fixture' }) for (const p of data.people) p.department_ids = p.department_ids.map((id) => (id === 'child' ? 'deep' : id)) const initial = renderToStaticMarkup() - expect(initial).toContain('展开部门 Deep Fixture') + expect(initial).toContain('data-department-id="root"') + expect(initial).toContain('data-department-id="child"') + expect(initial).not.toContain('data-department-id="deep"') expect(initial).not.toContain('data-parent-department="deep"') + const parentOpened = renderToStaticMarkup() + expect(parentOpened).toContain('展开部门 Deep Fixture') + expect(parentOpened).not.toContain('data-parent-department="deep"') + expect(initial).toContain('data-total-people="3"') + expect(parentOpened).toContain('data-total-people="3"') const expanded = renderToStaticMarkup() expect(expanded).toContain('data-parent-department="deep"') }) diff --git a/web/src/QADepartmentStatistics.tsx b/web/src/QADepartmentStatistics.tsx index 98224a6..a1d5688 100644 --- a/web/src/QADepartmentStatistics.tsx +++ b/web/src/QADepartmentStatistics.tsx @@ -28,7 +28,7 @@ export function defaultStatisticsCollapsed(data: DepartmentStatisticsSnapshot): const direct = new Set(data.people.flatMap((p) => p.department_ids)) return new Set( departmentTree(data.rows, new Set()) - .filter((r) => r.depth >= 2 && (r.hasChildren || direct.has(r.department.id))) + .filter((r) => r.depth >= 1 && (r.hasChildren || direct.has(r.department.id))) .map((r) => r.department.id) ) }