30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import type { SalaryRole } from './performance-salary-roles'
|
|
import type { SalaryPosition } from './salary-position-contract'
|
|
import type { SalaryTemplate } from './performance-salary-templates'
|
|
|
|
export type SalaryCell = string | number | null
|
|
export type SalaryDetailRow = {
|
|
employeeProfileId: string
|
|
employeeLabel: string
|
|
hasSalaryBase: boolean
|
|
positionGroupCode: string
|
|
values: Record<string, SalaryCell>
|
|
metrics: Record<string, number | null>
|
|
totalScore: number | null
|
|
positionId?: string
|
|
}
|
|
export type SalaryDetails = {
|
|
displayMonth: string
|
|
sourceMonth: string
|
|
isFallback: boolean
|
|
roles: Record<SalaryRole, SalaryDetailRow[]>
|
|
positionGroups: Array<{ position: SalaryPosition; template: SalaryTemplate; rows: SalaryDetailRow[] }>
|
|
}
|
|
|
|
export function salarySourceLabel(data: Pick<SalaryDetails, 'displayMonth' | 'sourceMonth' | 'isFallback'>) {
|
|
const label = (month: string) => `${Number(month.slice(0, 4))}年${Number(month.slice(5))}月`
|
|
return data.isFallback
|
|
? `${Number(data.displayMonth.slice(5))}月暂无调研数据,当前使用${label(data.sourceMonth)}数据测试`
|
|
: `数据月份:${label(data.sourceMonth)}`
|
|
}
|