diff --git a/CHANGELOG.md b/CHANGELOG.md index 6128a06..f5623a8 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.48 - 2026-10-24 + +### Changed + +- 区域统计按部门表格将“总人数”独立为一列,放在“访问人数”前;移除原访问人数格内的小字总人数。保留含子部门的稳定身份去重口径,人员行对应总人数/访问人数/访问比例均显示“—”,不改变一级默认展开及另外两个分析视图。 + ## 开发快照 snapshot/v0.1.47 - 2026-10-24 ### Changed diff --git a/web/src/QADepartmentStatistics.test.tsx b/web/src/QADepartmentStatistics.test.tsx index b609343..e14d086 100644 --- a/web/src/QADepartmentStatistics.test.tsx +++ b/web/src/QADepartmentStatistics.test.tsx @@ -11,12 +11,17 @@ it('offers all, natural-month and natural-week scopes and never switches the sel expect(html).not.toContain('设置选中部门的区域') expect(html).not.toContain('返回部门统计') }) -it('renders exactly five requested columns, a denominator and no fabricated zero ratio', () => { +it('renders six columns with total people separate from visitors and no fabricated zero ratio', () => { const data = parseDepartmentStatistics(departmentStatisticsFixture, { period: 'all' }).snapshot! const html = renderToStaticMarkup() const headers = [...html.matchAll(/]*>([^<]+)<\/th>/g)].map((m) => m[1]) - expect(headers).toEqual(['部门 / 人员', '访问人数', '访问比例', '访问次数', '最近提问时间']) - expect(html).toContain('总人数') + expect(headers).toEqual(['部门 / 人员', '总人数', '访问人数', '访问比例', '访问次数', '最近提问时间']) + const root = html.match(/]*data-department-id="root"[^>]*>([\s\S]*?)<\/tr>/)![1] + const cells = [...root.matchAll(/]*>([\s\S]*?)<\/td>/g)].map((m) => m[1]) + expect(cells).toHaveLength(6) + expect(cells[1]).toBe('3') + expect(cells[2]).toBe('2') + expect(html).not.toContain('qa-department-roster') expect(html).toContain('66.7%') expect(html).toContain('50.0%') expect(html).not.toContain('覆盖服务') @@ -34,6 +39,14 @@ it('shows direct people beneath each expanded department with a multi-department expect(html).toContain('Fixture Root/Fixture Child') expect(html).toContain('未命名人员') expect(html).toContain(']*data-person-key="[^"]+"[^>]*>([\s\S]*?)<\/tr>/g)] + expect(people).toHaveLength(4) + for (const person of people) { + const cells = [...person[1].matchAll(/]*>([\s\S]*?)<\/td>/g)].map((m) => m[1]) + expect(cells).toHaveLength(6) + expect(cells.slice(1, 4)).toEqual(['—', '—', '—']) + expect(person[1]).toContain('人员行不单独计算部门总人数') + } }) it('hides direct people together with collapsed departments without changing branch metrics', () => { const data = parseDepartmentStatistics(departmentStatisticsFixture, { period: 'all' }).snapshot! diff --git a/web/src/QADepartmentStatistics.tsx b/web/src/QADepartmentStatistics.tsx index a1d5688..b3a7ce2 100644 --- a/web/src/QADepartmentStatistics.tsx +++ b/web/src/QADepartmentStatistics.tsx @@ -81,6 +81,7 @@ function DepartmentPersonRow({ ) : null} + — — — {person.visits.toLocaleString('zh-CN')} @@ -110,11 +111,13 @@ export function DepartmentStatisticsView(p: DepartmentStatisticsViewProps) { + 部门 / 人员 + 总人数 访问人数 访问比例 访问次数 @@ -171,10 +174,8 @@ export function DepartmentStatisticsView(p: DepartmentStatisticsViewProps) { - - {d.visitors.toLocaleString('zh-CN')} - 总人数 {d.total_people.toLocaleString('zh-CN')} - + {d.total_people.toLocaleString('zh-CN')} + {d.visitors.toLocaleString('zh-CN')} {d.ratio === null ? '—' : `${d.ratio.toFixed(1)}%`} diff --git a/web/src/qaDepartmentStatistics.css b/web/src/qaDepartmentStatistics.css index 20f400c..10d6bec 100644 --- a/web/src/qaDepartmentStatistics.css +++ b/web/src/qaDepartmentStatistics.css @@ -254,8 +254,7 @@ overflow-wrap: anywhere; line-height: 1.5; } -.qa-department-region, -.qa-department-roster { +.qa-department-region { display: block; font-size: 11px; line-height: 1.5;