fix(qaops): 将部门总人数改为独立表格列
build / build (push) Successful in 1m5s

总人数放在访问人数前,复用既有分支去重值;移除访问人数格内分母小字,人员行添加对应空白列以保持六列对齐。不改默认展开及其他分析。

验证:独立总人数列与人员六列对齐分别先红后绿;11项相关测试及类型检查通过。完整门禁、候选及上线验收待执行。
This commit is contained in:
姚章浩
2026-10-24 13:27:25 +08:00
parent 1419ee03fc
commit c56ab5850b
4 changed files with 28 additions and 9 deletions
+6
View File
@@ -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
+16 -3
View File
@@ -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(<DepartmentStatisticsView data={data} />)
const headers = [...html.matchAll(/<th[^>]*>([^<]+)<\/th>/g)].map((m) => m[1])
expect(headers).toEqual(['部门 / 人员', '访问人数', '访问比例', '访问次数', '最近提问时间'])
expect(html).toContain('总人数')
expect(headers).toEqual(['部门 / 人员', '总人数', '访问人数', '访问比例', '访问次数', '最近提问时间'])
const root = html.match(/<tr[^>]*data-department-id="root"[^>]*>([\s\S]*?)<\/tr>/)![1]
const cells = [...root.matchAll(/<td[^>]*>([\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('<summary')
const people = [...html.matchAll(/<tr[^>]*data-person-key="[^"]+"[^>]*>([\s\S]*?)<\/tr>/g)]
expect(people).toHaveLength(4)
for (const person of people) {
const cells = [...person[1].matchAll(/<td[^>]*>([\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!
+5 -4
View File
@@ -81,6 +81,7 @@ function DepartmentPersonRow({
) : null}
</div>
</td>
<td aria-label="人员行不单独计算部门总人数">—</td>
<td aria-label="人员行不单独计算访问人数">—</td>
<td aria-label="人员行不单独计算部门访问比例">—</td>
<td>{person.visits.toLocaleString('zh-CN')}</td>
@@ -110,11 +111,13 @@ export function DepartmentStatisticsView(p: DepartmentStatisticsViewProps) {
<col />
<col />
<col />
<col />
<col className="qa-department-time-column" />
</colgroup>
<thead>
<tr>
<th>部门 / 人员</th>
<th>总人数</th>
<th>访问人数</th>
<th>访问比例</th>
<th title="已入总表的唯一提问事件,包含失败请求;不包含未采集的网页浏览">访问次数</th>
@@ -171,10 +174,8 @@ export function DepartmentStatisticsView(p: DepartmentStatisticsViewProps) {
</span>
</div>
</td>
<td>
<span>{d.visitors.toLocaleString('zh-CN')}</span>
<small className="qa-department-roster">总人数 {d.total_people.toLocaleString('zh-CN')}</small>
</td>
<td>{d.total_people.toLocaleString('zh-CN')}</td>
<td>{d.visitors.toLocaleString('zh-CN')}</td>
<td className="qa-department-ratio" data-ratio={d.ratio === null ? 'unknown' : d.ratio}>
{d.ratio === null ? '—' : `${d.ratio.toFixed(1)}%`}
</td>
+1 -2
View File
@@ -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;