feat(performance、workReport、workbench): 添加绩效表预填功能并优化工作台组件

This commit is contained in:
dk
2026-07-08 20:08:04 +08:00
parent 62b97a2fd7
commit e2094831e4
7 changed files with 187 additions and 26 deletions

View File

@@ -65,6 +65,11 @@ type MonthlyResultResponse = Omit<Api.Performance.Sheet.MonthlyResult, 'sheetId'
employeeId: StringIdResponse;
};
type PrefillResponse = Omit<Api.Performance.Sheet.PrefillData, 'sourceSheetId' | 'cellValues'> & {
sourceSheetId?: StringIdResponse | null;
cellValues?: Record<string, string | number | null | undefined> | null;
};
type TeamSummaryResponse = Omit<
Api.Performance.Team.Summary,
| 'expectedSheetCount'
@@ -185,6 +190,28 @@ function normalizeMonthlyResult(response: MonthlyResultResponse): Api.Performanc
};
}
function normalizePrefillData(response: PrefillResponse): Api.Performance.Sheet.PrefillData {
const cellValues = Object.fromEntries(
Object.entries(response.cellValues || {}).flatMap(([address, value]) => {
const normalizedAddress = String(address || '')
.trim()
.toUpperCase();
if (!normalizedAddress || value === null || value === undefined) {
return [];
}
return [[normalizedAddress, String(value)]];
})
);
return {
sourceSheetId: normalizeNullableStringId(response.sourceSheetId),
sourcePeriodMonth: response.sourcePeriodMonth ?? null,
cellValues
};
}
function normalizeTeamSummary(response: TeamSummaryResponse): Api.Performance.Team.Summary {
return {
...response,
@@ -464,6 +491,17 @@ export async function fetchPerformanceMonthlyResult(employeeId: string, periodMo
);
}
export async function fetchPerformanceSheetPrefill(employeeId: string, periodMonth: string) {
const result = await request<PrefillResponse>({
...safeJsonRequestConfig,
url: `${SHEET_PREFIX}/prefill`,
method: 'get',
params: { employeeId, periodMonth }
});
return mapServiceResult(result as ServiceRequestResult<PrefillResponse>, normalizePrefillData);
}
export function fetchPerformanceSheetStatusDict() {
return request<Api.Performance.Sheet.StatusDict[]>({
...safeJsonRequestConfig,