fix(qaops): 区域人员表直接展示部门并调整列宽
build / build (push) Successful in 1m5s

仅按区域显示真实部门名称与完整路径悬停,替代部门数量折叠摘要;适配人员与部门列宽,按人视图保持原样。归属、统计与分页不变。

验证:真实节点名称、区域直显且按人不变、区域列宽分别先红后绿,14项相关测试与类型检查通过。完整门禁、候选和上线验收待执行。
This commit is contained in:
姚章浩
2026-10-24 14:14:21 +08:00
parent f533c63fef
commit f38541db06
6 changed files with 66 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.50 - 2026-10-24
### Changed
- 按区域人员表“所属部门”直接显示部门名称,多部门逐行列出并保留完整路径悬停说明;移除该视图的“个直属部门”折叠入口。人员与部门列加宽,区域列收紧;按人视图保留原详情入口和列宽,排序、去重、周期与分页不变。
## 开发快照 snapshot/v0.1.49 - 2026-10-24
### Changed
+23
View File
@@ -24,6 +24,29 @@ it('renders at most fifty ranked people with actual question counts and no depar
expect(html).not.toContain('checkbox')
expect(html).not.toContain('绑定选中部门')
})
it('shows region department names immediately with full-path titles while leaving all-person details unchanged', () => {
const data = fixture()
data.rows.find((d) => d.id === 'root')!.name = '研发/视觉'
const html = renderToStaticMarkup(<PeopleAnalysisView data={data} mode="regions" />)
expect(html).toContain('qa-people-departments-inline')
expect(html).toContain('title="研发/视觉/Fixture Child"')
expect(html).toContain('>研发/视觉</li>')
expect(html).toContain('>Fixture Child</li>')
expect(html).not.toContain('<summary')
expect(html).not.toContain('个直属部门')
const all = renderToStaticMarkup(<PeopleAnalysisView data={data} mode="people" />)
expect(all).toContain('<summary')
expect(all).toContain('个直属部门')
})
it('widens region names and departments without changing all-person column widths', () => {
const data = fixture()
const widths = (mode: 'regions' | 'people') =>
[
...renderToStaticMarkup(<PeopleAnalysisView data={data} mode={mode} />).matchAll(/<col style="width:(\d+)%"/g),
].map((m) => Number(m[1]))
expect(widths('regions')).toEqual([6, 20, 9, 36, 9, 20])
expect(widths('people')).toEqual([6, 19, 16, 29, 10, 20])
})
it('region analysis lists the saved region members once and all-person analysis retains unassigned and zero-use people', () => {
const data = fixture()
const region = renderToStaticMarkup(<PeopleAnalysisView data={data} mode="regions" />)
+16 -7
View File
@@ -8,13 +8,16 @@ export function PeopleRankingTable({
page,
onPage,
label,
inlineDepartments = false,
}: {
people: PersonRankingRow[]
page: number
onPage: (n: number) => void
label: string
inlineDepartments?: boolean
}) {
const window = peoplePage(people, page)
const columnWidths = inlineDepartments ? [6, 20, 9, 36, 9, 20] : [6, 19, 16, 29, 10, 20]
return (
<section
className="qa-people-ranking"
@@ -25,12 +28,9 @@ export function PeopleRankingTable({
<div className="qa-department-table-scroll" tabIndex={0} aria-label="人员排行表格滚动区">
<table className="qa-department-table qa-people-ranking-table">
<colgroup>
<col style={{ width: '6%' }} />
<col style={{ width: '19%' }} />
<col style={{ width: '16%' }} />
<col style={{ width: '29%' }} />
<col style={{ width: '10%' }} />
<col style={{ width: '20%' }} />
{columnWidths.map((width, i) => (
<col key={i} style={{ width: width + '%' }} />
))}
</colgroup>
<thead>
<tr>
@@ -60,7 +60,15 @@ export function PeopleRankingTable({
</td>
<td className="qa-people-region-cell">{person.region_label}</td>
<td className="qa-people-paths">
{person.department_paths.length ? (
{person.department_paths.length && inlineDepartments ? (
<ul className="qa-people-departments-inline">
{person.department_paths.map((d) => (
<li key={d.id} title={d.path} aria-label={d.path}>
{d.name}
</li>
))}
</ul>
) : person.department_paths.length ? (
<details>
<summary title={person.department_paths.map((d) => d.path).join(';')}>
{person.department_paths.length} 个直属部门
@@ -152,6 +160,7 @@ export function PeopleAnalysisView({ data, mode }: { data: DepartmentStatisticsS
page={page}
onPage={setPage}
label={mode === 'regions' ? '区域人员排行' : '全体人员排行'}
inlineDepartments={mode === 'regions'}
/>
<p className="qa-department-note">
沿用当前已同步通讯录及已保存区域配置;同一区域多部门人员去重,跨区域人员单列“跨区域待核对”,未配置者列“未归属”,不擅自裁决主归属或生成绩效结论。
+8
View File
@@ -82,6 +82,14 @@
padding-left: 16px;
margin: 6px 0 0;
}
.qa-people-paths .qa-people-departments-inline {
list-style: none;
padding: 0;
margin: 0;
}
.qa-people-departments-inline li + li {
margin-top: 4px;
}
.qa-people-question-count {
font-weight: 600;
}
+11
View File
@@ -13,6 +13,17 @@ it('ranks every unique roster person by questions descending including zero use
expect(result.people.find((p) => p.visits === 0)?.name).toBe('')
expect(JSON.stringify(data)).toBe(before)
})
it('keeps the actual department name separately from its complete path without splitting name slashes', () => {
const data = fixture()
data.rows.find((d) => d.id === 'root')!.name = '研发/视觉'
const person = peopleAnalysis(data).people.find((p) => p.visits === 2)!
expect(person.department_paths.find((d) => d.id === 'root')?.name).toBe('研发/视觉')
expect(person.department_paths.find((d) => d.id === 'child')).toEqual({
id: 'child',
name: 'Fixture Child',
path: '研发/视觉/Fixture Child',
})
})
it('groups same-region memberships once and separates cross-region and unassigned without choosing a primary', () => {
const data = fixture()
data.regions.push({ id: 'industrial', name: 'Industrial' }, { id: 'empty', name: 'Empty' })
+2 -2
View File
@@ -15,7 +15,7 @@ export type PersonRankingRow = DepartmentPersonStatistic & {
region_state: 'matched' | 'cross_region' | 'unassigned'
group_key: string
region_label: string
department_paths: Array<{ id: string; path: string }>
department_paths: Array<{ id: string; name: string; path: string }>
}
export type PeopleAnalysisGroup = { key: string; name: string; people: PersonRankingRow[]; visits: number }
export function peopleAnalysis(data: DepartmentStatisticsSnapshot): {
@@ -39,7 +39,7 @@ export function peopleAnalysis(data: DepartmentStatisticsSnapshot): {
names.unshift(d.name)
current = d.parent_id
}
return { id, path: names.join('/') }
return { id, name: nodes.get(id)!.name, path: names.join('/') }
}),
}))
.sort((a, b) => b.visits - a.visits || a.name.localeCompare(b.name, 'zh-CN') || a.key.localeCompare(b.key))