fix(salary): unify technical detail tables and hide zero-share KPIs

This commit is contained in:
江林铖 2026-11-24 09:46:31 +08:00
parent 14f168c471
commit f0ac4d3db4
6 changed files with 170 additions and 28 deletions

View File

@ -31,6 +31,66 @@ const managementPayload = (month = '2026-10'): SalaryDetails => ({
positionGroups: [{ position: managementPosition, template: getPositionSalaryTemplate(managementPosition, month), rows: [] }],
})
const technicalPosition = {
...INITIAL_SALARY_POSITIONS[2].value, id: 'technical', revision: 2, personnelCount: 0, updatedAt: '',
dimensions: INITIAL_SALARY_POSITIONS[2].value.dimensions.map((dimension, index) => ({
...dimension, weight: ['30', '60', '10'][index],
metrics: dimension.metrics.map((metric, metricIndex) => ({ ...metric,
name: index === 1 && metricIndex === 0 ? 'AI功能降本成效' : metric.name,
weight: [['50', '50'], ['30', '30', '40'], ['100']][index][metricIndex],
})),
})),
}
const technicalPayload = (): SalaryDetails => ({
...managementPayload(),
positionGroups: [{ position: technicalPosition, template: getPositionSalaryTemplate(technicalPosition, '2026-10'), rows: [] }],
})
test('技术岗无人时展示已保存六项指标和5行真空白,公共列与策划岗一致且无积分', async () => {
const data = technicalPayload()
;(fetch as jest.Mock).mockResolvedValue(json(data))
render(<PerformanceSalaryDetails role="ai-technical" month="2026-10" />)
expect(await screen.findByText('暂无AI技术设计师岗人员,请在人员薪资配置中新增')).toBeInTheDocument()
const region = screen.getByRole('region', { name: 'AI技术设计师薪资明细表格' })
expect(region).toHaveAttribute('tabindex', '0')
expect(region).toHaveClass('overflow-auto', 'max-w-full')
const table = within(region).getByRole('table'), rows = within(table).getAllByRole('row')
expect(rows).toHaveLength(7)
const headers = within(rows[1]).getAllByRole('columnheader')
expect(headers.slice(0, 7).map(cell => cell.textContent)).toEqual(['花名', '姓名', '职级', '部门', '基本工资', '职级工资', '绩效工资'])
expect(headers.slice(-5).map(cell => cell.textContent)).toEqual(['绩效系数', '2026年10月合计总薪资', '2026年9月合计总薪资', '环比上月薪资差值', '备注'])
expect(headers.filter(cell => /考核得分/.test(cell.textContent || '')).map(cell => cell.textContent?.match(/综合占比(\d+)%/)?.[1])).toEqual(['15', '15', '18', '18', '24', '10'])
expect(headers.some(cell => cell.textContent?.includes('积分'))).toBe(false)
expect(headers[0]).toHaveClass('sticky', 'left-0')
for (const row of rows.slice(2)) {
const cells = within(row).getAllByRole('cell')
expect(cells).toHaveLength(24)
expect(cells.every(cell => cell.textContent === '')).toBe(true)
expect(cells[0]).toHaveClass('sticky', 'left-0')
}
})
test('技术岗有人员时仅展示真实行,缺失分数和工资保持空值,零占比两列不展示', async () => {
const data = technicalPayload()
const hidden = technicalPosition.dimensions[0].metrics[0]
const configured = { ...technicalPosition, dimensions: technicalPosition.dimensions.map((dimension, index) => index === 0 ? {
...dimension, metrics: dimension.metrics.map((metric, metricIndex) => ({ ...metric, weight: metricIndex === 0 ? '0' : '100' })),
} : dimension) }
const row = { ...payload().roles['ai-planning'][0], values: { name: '技术姓名', nickname: '技术花名', baseSalary: '2500.00', points: 99, performanceCoefficient: null, currentTotal: null, [`${hidden.id}RawValue`]: 100, [`${hidden.id}Score`]: 0 } }
data.roles['ai-technical'] = [row]
data.positionGroups = [{ position: configured, template: getPositionSalaryTemplate(configured, '2026-10'), rows: [row] }]
;(fetch as jest.Mock).mockResolvedValue(json(data))
render(<PerformanceSalaryDetails role="ai-technical" month="2026-10" />)
expect(await screen.findByText('技术花名')).toHaveClass('sticky', 'left-0')
expect(screen.queryByText('暂无AI技术设计师岗人员,请在人员薪资配置中新增')).not.toBeInTheDocument()
const table = screen.getByRole('table'), rows = within(table).getAllByRole('row')
expect(rows).toHaveLength(3)
const headers = within(rows[1]).getAllByRole('columnheader'), cells = within(rows[2]).getAllByRole('cell')
expect(headers.some(header => header.textContent?.includes(hidden.name) || header.textContent?.includes('积分'))).toBe(false)
expect(cells).toHaveLength(22)
for (const label of ['绩效系数', '2026年10月合计总薪资']) expect(cells[headers.findIndex(header => header.textContent === label)]).toHaveTextContent('——')
})
test('管理岗无人时展示保存方案完整表头与5行真空白,不伪造人员、分数或积分列', async () => {
const data = managementPayload()
;(fetch as jest.Mock).mockResolvedValue(json(data))
@ -99,7 +159,7 @@ test('展示真实人员、精确金额、缺失值、来源提示及内部横
render(<PerformanceSalaryDetails role="ai-planning" month="2026-10" />)
expect(screen.getByRole('status')).toHaveTextContent('正在读取薪资明细')
expect(await screen.findByText('测试姓名')).toBeInTheDocument()
expect(within(screen.getAllByRole('row')[1]).getAllByRole('columnheader')).toHaveLength(25)
expect(within(screen.getAllByRole('row')[1]).getAllByRole('columnheader')).toHaveLength(21)
expect(screen.getAllByRole('row')).toHaveLength(3)
const cells = screen.getAllByRole('cell')
expect(cells[0]).toHaveTextContent('测试花名')
@ -216,7 +276,8 @@ test('零分显示0.00,缺失原始值及贡献均显示占位符', async () =
render(<PerformanceSalaryDetails role="ai-planning" month="2026-09" />)
expect(await screen.findAllByText('0.00 分')).toHaveLength(2)
const headers = within(screen.getAllByRole('row')[1]).getAllByRole('columnheader')
const missingIndex = headers.findIndex(header => header.textContent === '跨部门协同 · 调研得分')
expect(headers.some(header => header.textContent?.includes('跨部门协同'))).toBe(false)
const missingIndex = headers.findIndex(header => header.textContent === '工作配合满意度 · 调研得分')
const cells = within(screen.getAllByRole('row')[2]).getAllByRole('cell')
expect(cells[missingIndex]).toHaveTextContent('——')
expect(cells[missingIndex + 1]).toHaveTextContent('——')

View File

@ -45,7 +45,7 @@ export default function PerformanceSalaryDetails({ role, month }: { role: Salary
const data = current?.data
const rows = data?.roles[role] ?? []
const groups = data?.positionGroups.filter(group => group.position.salaryRole === role) ?? []
const visibleGroups = groups.filter(group => group.rows.length > 0 || role === 'management')
const visibleGroups = groups.filter(group => group.rows.length > 0 || role === 'management' || role === 'ai-technical')
const surveyMatchIssues = data?.surveyMatchIssues?.filter(issue => issue.salaryRole === role) ?? []
return (
<>
@ -81,7 +81,7 @@ export default function PerformanceSalaryDetails({ role, month }: { role: Salary
const detailId = `metric-details-${position.id}`
return <section key={position.id} className="mb-8" aria-label={`${position.name}薪资明细`}>
<div className="mb-3 flex flex-wrap items-baseline gap-x-3 gap-y-1"><h2 className="text-lg font-bold text-[#101828]">{position.name}</h2><span className="text-sm text-[#66758b]">{rows.length}人 · 配置版本{position.revision} · 最新配置适用于所有月份</span></div>
{rows.length === 0 && <p className="mb-3 text-sm leading-6 text-[#66758b]">暂无管理岗人员,请在人员薪资配置中新增</p>}
{rows.length === 0 && <p className="mb-3 text-sm leading-6 text-[#66758b]">{role === 'ai-technical' ? '暂无AI技术设计师岗人员,请在人员薪资配置中新增' : '暂无管理岗人员,请在人员薪资配置中新增'}</p>}
{!position.dimensions.length && <p className="mb-3 text-sm text-[#66758b]">未匹配绩效方案。请在人员薪资配置中设置职级,并确认存在对应方案;绩效系数和总薪资暂不计算。</p>}
<div
role="region" aria-label={`${template.title}薪资明细表格`} aria-describedby="salary-table-help" tabIndex={0}

View File

@ -11,9 +11,9 @@ test('导出后重新读取:五岗模板字段、空行、冻结及月份均
await reloaded.xlsx.load(buffer)
expect(reloaded.worksheets.map(sheet => sheet.name)).toEqual(['AI全案策划岗', '摄影中心岗', '空间视觉岗', '管理岗', 'AI技术设计师岗'])
const expected = [
{ columns: 25, headerRow: 3, lastHeader: '备注', firstMerge: 'A2:G2' },
{ columns: 21, headerRow: 3, lastHeader: '备注', firstMerge: 'A2:G2' },
{ columns: 16, headerRow: 2, lastHeader: '备注', firstMerge: 'A1:P1' },
{ columns: 22, headerRow: 3, lastHeader: '备注', firstMerge: 'A2:G2' },
{ columns: 20, headerRow: 3, lastHeader: '备注', firstMerge: 'A2:G2' },
{ columns: 24, headerRow: 3, lastHeader: '备注', firstMerge: 'A2:G2' },
{ columns: 24, headerRow: 3, lastHeader: '备注', firstMerge: 'A2:G2' },
]
@ -25,6 +25,7 @@ test('导出后重新读取:五岗模板字段、空行、冻结及月份均
expect(sheet.getCell(target.headerRow, 1).value).toBe('花名')
if (index !== 1) expect(sheet.getCell(target.headerRow, 2).value).toBe('姓名')
expect(headers).not.toContain('品牌')
expect(headers.some(value => /综合占比0%/.test(value))).toBe(false)
expect(headers.filter(value => value === '绩效系数')).toHaveLength(1)
expect(headers.filter(value => value === '环比上月薪资差值')).toHaveLength(1)
expect(sheet.getCell(target.headerRow + 1, headers.indexOf('环比上月薪资差值')).numFmt).toBe('#,##0.00')
@ -111,3 +112,28 @@ test('标准下载文件并回收对象URL', async () => {
click.mockRestore()
timer.mockRestore()
})
test.each(['ai-planning', 'photography', 'spatial-visual', 'management', 'ai-technical'] as const)('%s导出过滤零占比及空维度,保留微小正占比并重算合并和打印范围', async salaryRole => {
const seed = INITIAL_SALARY_POSITIONS[0].value
const position = { ...seed, salaryRole, id: 'export-position', revision: 1, personnelCount: 0, updatedAt: '', name: '过滤验证', dimensions: [
{ ...seed.dimensions[0], name: '零维度', weight: '0' },
{ ...seed.dimensions[1], name: '小占比维度', weight: '0.01', metrics: seed.dimensions[1].metrics.map((metric, index) => ({ ...metric, name: ['零指标', '微小正指标', '正指标'][index], weight: ['0', '0.01', '99.99'][index] })) },
{ ...seed.dimensions[2], weight: '99.99' },
] }
const workbook = await buildSalaryTemplateWorkbook('2026-11', [position])
const restored = new ExcelJS.Workbook()
await restored.xlsx.load(await workbook.xlsx.writeBuffer())
const sheet = restored.getWorksheet('过滤验证')!, labels = sheet.getRow(3).values as string[]
expect(labels.filter(label => label?.includes('零指标') || label?.includes('视觉调性') || label?.includes('跨部门协同'))).toEqual([])
expect(labels).toContain('微小正指标 · 考核得分(综合占比0.000001%)')
expect(labels.filter(label => label?.includes('考核得分'))).toHaveLength(3)
const expectedColumns = salaryRole === 'ai-planning' ? 19 : salaryRole === 'photography' ? 21 : 18
expect(sheet.columnCount).toBe(expectedColumns)
const start = salaryRole === 'ai-planning' ? 'I' : 'H', end = salaryRole === 'ai-planning' ? 'L' : 'K'
expect(sheet.model.merges).toContain(`${start}2:${end}2`)
expect(sheet.getRow(2).values).not.toContain('零维度 · 维度权重0%')
expect(sheet.pageSetup.printArea).toBe(`A1:${sheet.getColumn(expectedColumns).letter}8`)
expect(sheet.views[0]).toMatchObject({ state: 'frozen', xSplit: 1, ySplit: 3 })
expect(sheet.rowCount).toBe(8)
for (let row = 4; row <= 8; row++) for (let col = 1; col <= sheet.columnCount; col++) expect(sheet.getCell(row, col).value).toBeNull()
})

View File

@ -20,7 +20,7 @@ describe('薪资模板月份与字段', () => {
test('AI每项原始值紧邻综合占比考核得分,删除三项保底字段', () => {
const template = getSalaryTemplate('ai-planning', '2026-09')
expect(template.columns).toHaveLength(25)
expect(template.columns).toHaveLength(21)
expect(template.columns.map(column => column.label)).toEqual(expect.arrayContaining([
'创意成果市场验证 · 市场验证得分(上月)', '创意成果市场验证 · 考核得分(上月,综合占比7%)',
'品牌调性评审 · 调研得分', '品牌调性评审 · 考核得分(综合占比25%)',
@ -38,10 +38,63 @@ describe('薪资模板月份与字段', () => {
test('空间视觉恢复原始得分,未确认维度占比不猜测', () => {
const template = getSalaryTemplate('spatial-visual', '2026-10')
expect(template.columns).toHaveLength(22)
expect(template.columns).toHaveLength(20)
expect(template.columns.map(column => column.label)).not.toEqual(expect.arrayContaining(['百分比', '实际绩效']))
expect(template.groups.find(group => group.key === 'cooperation')?.label).toBe('配合度 · 维度权重5%')
expect(template.columns.map(column => column.label)).toContain('工作配合度 · 考核得分(综合占比0.3%)')
expect(template.columns.map(column => column.label)).toContain('项目按时交付率 · 考核得分(综合占比待配置)')
expect(template.columns.some(column => column.key.startsWith('sharing'))).toBe(false)
})
test('技术岗默认模板使用11月六项指标和策划岗公共分区,不显示积分', () => {
const template = getSalaryTemplate('ai-technical', '2026-11')
const planning = getSalaryTemplate('ai-planning', '2026-11')
expect(template.columns).toHaveLength(24)
for (const key of ['identity', 'settlement', 'salary', 'remarks']) {
expect(template.groups.find(group => group.key === key)).toEqual(planning.groups.find(group => group.key === key))
}
expect(template.groups.slice(1, 4).map(group => group.label)).toEqual(['定性 · 维度权重30%', '定量 · 维度权重60%', '配合度 · 维度权重10%'])
expect(template.columns.filter(column => column.key.endsWith('RawValue')).map(column => column.label)).toEqual([
'项目维护(使用方评分) · 原始得分', '项目成果验证 · 调研得分', 'AI功能降本成效(成本节约率) · 原始得分',
'项目按时交付率 · 按时交付率', '知识分享/月度复盘分享 · 调研得分', '月度上级对成员工作配合满意度调研 · 调研得分',
])
expect(template.columns.filter(column => column.key.endsWith('Score')).map(column => column.label.match(/综合占比(.*?)%/)?.[1])).toEqual(['15', '15', '18', '18', '24', '10'])
expect(template.columns.some(column => column.key === 'points' || column.key.startsWith('knowledge'))).toBe(false)
})
test.each(['ai-planning', 'photography', 'spatial-visual', 'management', 'ai-technical'] as const)('%s按精确综合占比过滤KPI与空维度,恢复正权重立即显示且不改配置', role => {
const original = INITIAL_SALARY_POSITIONS[0].value
const position = { ...original, salaryRole: role, id: 'job', revision: 1, personnelCount: 0, updatedAt: '', dimensions: [
{ ...original.dimensions[0], weight: '0', metrics: [original.dimensions[0].metrics[0]] },
{ ...original.dimensions[1], weight: '100', metrics: original.dimensions[1].metrics.slice(0, 2).map((metric, index) => ({ ...metric, weight: index === 0 ? '0' : '100' })) },
] }
const snapshot = JSON.stringify(position)
const template = getPositionSalaryTemplate(position, '2026-11')
expect(JSON.stringify(position)).toBe(snapshot)
expect(template.groups.some(group => group.key === position.dimensions[0].id)).toBe(false)
const visible = position.dimensions[1].metrics[1]
expect(template.columns.filter(column => column.key.endsWith('RawValue')).map(column => column.key)).toEqual([`${visible.id}RawValue`])
expect(template.groups.every(group => group.columns.length > 0)).toBe(true)
position.dimensions[0].weight = '10'
position.dimensions[1].weight = '90'
position.dimensions[1].metrics[0].weight = '10'
position.dimensions[1].metrics[1].weight = '90'
const restored = getPositionSalaryTemplate(position, '2026-11')
expect(restored.columns.filter(column => column.key.endsWith('RawValue'))).toHaveLength(3)
expect(restored.columns.filter(column => column.key.endsWith('Score'))).toHaveLength(3)
})
test('最小合法正权重0.01%×0.01%仍保留两列,保存配置优先于技术岗默认模板', () => {
const original = INITIAL_SALARY_POSITIONS[2].value
const position = { ...original, id: 'technical', revision: 2, personnelCount: 0, updatedAt: '', dimensions: [
{ ...original.dimensions[0], name: '自定义维度', weight: '0.01', metrics: original.dimensions[0].metrics.map((metric, index) => ({ ...metric, name: `自定义指标${index}`, weight: index === 0 ? '0.01' : '99.99' })) },
{ ...original.dimensions[2], weight: '99.99' },
] }
const template = getPositionSalaryTemplate(position, '2026-11')
expect(template.groups[1].label).toBe('自定义维度 · 维度权重0.01%')
expect(template.columns.map(column => column.label)).toContain('自定义指标0 · 考核得分(综合占比0.000001%)')
expect(template.columns.filter(column => column.key.endsWith('RawValue'))).toHaveLength(3)
expect(template.columns.some(column => /AI功能降本成效/.test(column.label))).toBe(false)
})
test('管理岗公共表头与策划岗一致,主管指标保留且不含积分或基础薪资遗留列', () => {

View File

@ -51,7 +51,7 @@ test.each(['ai-planning', 'ai-technical', 'management', 'photography', 'spatial-
expect(template.columns.filter(c => c.key === 'performanceCoefficient')).toHaveLength(1)
expect(template.columns.some(c => c.key === 'performanceScore' || c.label.includes('绩效得分'))).toBe(false)
expect(template.columns.some(c => c.key.endsWith('Weighted') || c.label.includes('加权得分'))).toBe(false)
expect(template.columns.filter(c => c.key.endsWith('Score') && c.key !== 'performanceScore')).toHaveLength(6)
expect(template.columns.filter(c => c.key.endsWith('Score') && c.key !== 'performanceScore')).toHaveLength(4)
})
test('各项考核得分直接乘综合占比,总分等于显示值相加且无二次加权', () => {

View File

@ -59,11 +59,11 @@ const identity = () => [
column('department', '部门', 'text', 160),
]
const baseWages = () => [column('baseSalary', '基本工资', 'money'), column('gradeSalary', '职级工资', 'money'), column('performanceSalary', '绩效工资', 'money')]
const review = (key: string, label: string, overallShare: string, source: MetricSource['kind'] = 'survey') => [
const review = (key: string, label: string, overallShare: number | null, source: MetricSource['kind'] = 'survey'): SalaryTemplateColumn[] => overallShare === 0 ? [] : [
column(`${key}RawValue`, `${label} · ${source === 'market-intent-top3' ? '市场验证得分(上月)' : source === 'survey' ? '调研得分' : source === 'on-time' ? '按时交付率' : '原始得分'}`, source === 'on-time' ? 'percent' : 'number', 176),
column(`${key}Score`, `${label} · 考核得分(${source === 'market-intent-top3' ? '上月,' : ''}综合占比${overallShare})`, 'number', 200),
column(`${key}Score`, `${label} · 考核得分(${source === 'market-intent-top3' ? '上月,' : ''}综合占比${overallShare === null ? '待配置' : `${overallShare}%`})`, 'number', 200),
]
const aiSharing = () => review('sharing', '知识分享/月度复盘分享', '0%')
const aiSharing = () => review('sharing', '知识分享/月度复盘分享', 0)
export function getSalaryTemplate(role: SalaryRole, month: string): SalaryTemplate {
const current = salaryMonthLabel(month)
@ -82,13 +82,13 @@ export function getSalaryTemplate(role: SalaryRole, month: string): SalaryTempla
group('identity', '基础信息', [...identity(), ...baseWages()]),
group('points', '积分', [column('points', `${current}积分`, 'number', 160)]),
group('qualitative', '定性 · 维度权重25%', [
...review('brandReview', '品牌调性评审', '25%'), ...review('collaboration', '跨部门协同', '0%'),
...review('brandReview', '品牌调性评审', 25), ...review('collaboration', '跨部门协同', 0),
]),
group('quantitative', '定量 · 维度权重70%', [
...review('marketValidation', '创意成果市场验证', '7%', 'market-intent-top3'),
...review('onTime', '项目按时交付率', '63%', 'on-time'), ...aiSharing(),
...review('marketValidation', '创意成果市场验证', 7, 'market-intent-top3'),
...review('onTime', '项目按时交付率', 63, 'on-time'), ...aiSharing(),
]),
group('cooperation', '配合度 · 维度权重5%', review('cooperation', '工作配合度', '5%')),
group('cooperation', '配合度 · 维度权重5%', review('cooperation', '工作配合度', 5)),
settlement(), salarySummary(), remarks(),
],
photography: [group('photography', '', [
@ -102,35 +102,35 @@ export function getSalaryTemplate(role: SalaryRole, month: string): SalaryTempla
'spatial-visual': [
group('identity', '基础信息', [...identity(), ...baseWages()]),
group('qualitative', '定性 · 维度权重20%', [
...review('aiTools', '协助搭建部门AI辅助工具', '3.2%'), ...review('collaboration', '跨部门协同', '0.8%'),
...review('aiTools', '协助搭建部门AI辅助工具', 3.2), ...review('collaboration', '跨部门协同', 0.8),
]),
group('quantitative', '定量', [
...review('onTime', '项目按时交付率', '待配置', 'on-time'), ...aiSharing(),
...review('onTime', '项目按时交付率', null, 'on-time'), ...aiSharing(),
]),
group('cooperation', '配合度 · 维度权重5%', review('cooperation', '工作配合度', '0.3%')),
group('cooperation', '配合度 · 维度权重5%', review('cooperation', '工作配合度', 0.3)),
settlement(), salarySummary(), remarks(),
],
management: [
group('identity', '基础信息', [...identity(), ...baseWages()]),
group('qualitative', '定性 · 维度权重70%', [
...review('visualTone', '视觉调性', '56%'), ...review('collaboration', '跨部门协同', '14%'),
...review('visualTone', '视觉调性', 56), ...review('collaboration', '跨部门协同', 14),
]),
group('quantitative', '定量 · 维度权重20%', [
...review('marketValidation', '创意成果市场验证', '8%', 'unavailable'), ...review('onTime', '项目按时交付率', '8%', 'on-time'),
...review('sharing', '知识分享/项目复盘', '4%'),
...review('marketValidation', '创意成果市场验证', 8, 'unavailable'), ...review('onTime', '项目按时交付率', 8, 'on-time'),
...review('sharing', '知识分享/项目复盘', 4),
]),
group('satisfaction', '满意度 · 维度权重10%', review('cooperation', '工作配合度', '10%')),
group('satisfaction', '满意度 · 维度权重10%', review('cooperation', '工作配合度', 10)),
settlement(), salarySummary(), remarks(),
],
}
templates['ai-technical'] = [
group('identity', '基础信息', [...identity(), ...baseWages()]),
group('qualitative', '定性 · 维度权重25%', [...review('maintenance', '项目维护', '12.5%', 'unavailable'), ...review('projectResult', '项目成果验证', '12.5%')]),
group('quantitative', '定量 · 维度权重70%', [...review('knowledge', 'AI知识库建设', '0%', 'unavailable'), ...review('onTime', '项目按时交付率', '42%', 'on-time'), ...review('sharing', '知识分享/月度复盘分享', '28%')]),
group('cooperation', '配合度 · 维度权重5%', review('cooperation', '工作配合满意度', '5%')),
group('qualitative', '定性 · 维度权重30%', [...review('maintenance', '项目维护(使用方评分)', 15, 'unavailable'), ...review('projectResult', '项目成果验证', 15)]),
group('quantitative', '定量 · 维度权重60%', [...review('costReduction', 'AI功能降本成效(成本节约率)', 18, 'unavailable'), ...review('onTime', '项目按时交付率', 18, 'on-time'), ...review('sharing', '知识分享/月度复盘分享', 24)]),
group('cooperation', '配合度 · 维度权重10%', review('cooperation', '月度上级对成员工作配合满意度调研', 10)),
settlement(), salarySummary(), remarks(),
]
const groups = templates[role]
const groups = templates[role].filter(item => item.columns.length > 0)
return { role, title: SALARY_ROLES.find(item => item.key === role)!.title, month, grouped: role !== 'photography', groups, columns: groups.flatMap(item => item.columns) }
}
@ -139,7 +139,9 @@ export function getPositionSalaryTemplate(position: SalaryPosition, month: strin
const prefix: SalaryTemplateGroup[] = [group('identity', '基础信息', [...identity(), ...baseWages()])]
if (position.salaryRole === 'ai-planning') prefix.push(group('points', '积分', [column('points', `${salaryMonthLabel(month)}积分`, 'number', 160)]))
const assessment = position.dimensions.map(dimension => group(dimension.id, `${dimension.name} · 维度权重${dimension.weight}%`, dimension.metrics.flatMap(metric =>
review(metric.id, metric.name, `${Number((percentageBasisPoints(dimension.weight) * percentageBasisPoints(metric.weight) / 1e6).toFixed(6))}%`, metric.source.kind))))
// Integer basis points preserve tiny positive shares; only an exact zero hides the pair.
review(metric.id, metric.name, percentageBasisPoints(dimension.weight) * percentageBasisPoints(metric.weight) / 1e6, metric.source.kind))))
.filter(item => item.columns.length > 0)
const summary = position.salaryRole === 'photography'
? [group('settlement', '绩效结算', [column('performanceCoefficient', '绩效系数', 'number')]), group('salary', '薪资', base.columns.filter(item => ['bonus', 'fixedPay', 'currentTotal', 'previousTotal', 'beforePreviousTotal', 'salaryDifference'].includes(item.key))), group('remarks', '备注', [column('remarks', '备注', 'text', 224)])]
: base.groups.filter(item => ['settlement', 'salary', 'remarks'].includes(item.key)).map(item => ({ ...item, columns: item.columns.filter(item => !['baseSalary', 'gradeSalary', 'performanceSalary'].includes(item.key)) }))