From c56ab5850bc1e808974dd8a503912b597b14b82c 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:27:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(qaops):=20=E5=B0=86=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E6=80=BB=E4=BA=BA=E6=95=B0=E6=94=B9=E4=B8=BA=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 总人数放在访问人数前,复用既有分支去重值;移除访问人数格内分母小字,人员行添加对应空白列以保持六列对齐。不改默认展开及其他分析。 验证:独立总人数列与人员六列对齐分别先红后绿;11项相关测试及类型检查通过。完整门禁、候选及上线验收待执行。 --- CHANGELOG.md | 6 ++++++ web/src/QADepartmentStatistics.test.tsx | 19 ++++++++++++++++--- web/src/QADepartmentStatistics.tsx | 9 +++++---- web/src/qaDepartmentStatistics.css | 3 +-- 4 files changed, 28 insertions(+), 9 deletions(-) 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;