diff --git a/CHANGELOG.md b/CHANGELOG.md index d001b83..b6c3681 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,16 @@ > `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯, > 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。 +## 开发快照 snapshot/v0.1.46 - 2026-10-21 + +### Added + +- 区域统计新增“按部门/按区域/按人”分析切换;按部门保留原树形与直属人员。按区域查看已保存区域内人员,按人查看完整去重名册,均按提问次数降序并保留零提问人员,固定50人/页与页码选择,展示区域、所属部门、次数和最近提问时间。 + +### Changed + +- 新分析复用同一累计/自然月/自然周快照,不额外创建模型或聚合作业;同区域多部门人员只列一次,跨区域及未归属者单列待核对,不自动选主区域。分析分页与切换只读,不改变原问答、区域映射、部门汇总、已保存周报及外部发送闸门。 + ## 开发快照 snapshot/v0.1.45 - 2026-10-21 ### Added diff --git a/web/src/QADepartmentStatistics.test.tsx b/web/src/QADepartmentStatistics.test.tsx index af2989d..0e1e25b 100644 --- a/web/src/QADepartmentStatistics.test.tsx +++ b/web/src/QADepartmentStatistics.test.tsx @@ -6,6 +6,8 @@ import { departmentStatisticsFixture } from './qaDepartmentStatistics.fixture' it('offers all, natural-month and natural-week scopes and never switches the selected-department action to a second mapping page', () => { const html = renderToStaticMarkup() for (const label of ['按累计统计', '按自然月统计', '按自然周统计', '绑定选中部门']) expect(html).toContain(label) + for (const label of ['按部门', '按区域', '按人']) expect(html).toContain('>' + label + '<') + expect(html).toContain('aria-label="分析维度"') expect(html).not.toContain('设置选中部门的区域') expect(html).not.toContain('返回部门统计') }) diff --git a/web/src/QADepartmentStatistics.tsx b/web/src/QADepartmentStatistics.tsx index 3d450f2..98224a6 100644 --- a/web/src/QADepartmentStatistics.tsx +++ b/web/src/QADepartmentStatistics.tsx @@ -10,6 +10,8 @@ import { currentQAWeekValue } from './qaWeeks' import { bindOrganizationDepartments } from './qaOrg' import type { RegionDefinition } from './qaOrg' import { QARegions } from './QARegions' +import { PeopleAnalysisView } from './QAPeopleAnalysis' +import { departmentTime } from './qaPeopleAnalysis' import './qaDepartmentStatistics.css' import { QAPeriodInput } from './QAPeriodInput' export interface DepartmentStatisticsViewProps { @@ -21,16 +23,7 @@ export interface DepartmentStatisticsViewProps { onSelect?: (ids: string[]) => void onCollapse?: (id: string) => void } -export const departmentTime = (value: string) => - new Date(value).toLocaleString('zh-CN', { - timeZone: 'Asia/Shanghai', - year: 'numeric', - month: '2-digit', - day: '2-digit', - hour: '2-digit', - minute: '2-digit', - hour12: false, - }) +export { departmentTime } from './qaPeopleAnalysis' export function defaultStatisticsCollapsed(data: DepartmentStatisticsSnapshot): Set { const direct = new Set(data.people.flatMap((p) => p.department_ids)) return new Set( @@ -267,6 +260,7 @@ export function DepartmentRegionBinding({ } const currentWeekValue = currentQAWeekValue export function QARegionalStatistics({ onSaved }: { onSaved?: () => void } = {}) { + const [analysisMode, setAnalysisMode] = useState<'departments' | 'regions' | 'people'>('departments') const [period, setPeriod] = useState<'all' | 'month' | 'week'>('all'), [month, setMonth] = useState(currentMonth), [week, setWeek] = useState(currentWeekValue), @@ -390,6 +384,19 @@ export function QARegionalStatistics({ onSaved }: { onSaved?: () => void } = {}) +