fix(projects): 工作日志编辑日期不回填

This commit is contained in:
2026-05-21 22:05:30 +08:00
parent ba328e02bb
commit 62859bfc38

View File

@@ -143,13 +143,15 @@ export type ProjectTaskResponse = Omit<
export type TaskWorklogResponse = Omit<
Api.Project.TaskWorklog,
'id' | 'taskId' | 'userId' | 'difficulty' | 'attachments'
'id' | 'taskId' | 'userId' | 'difficulty' | 'attachments' | 'startDate' | 'endDate'
> & {
id: StringIdResponse;
taskId: StringIdResponse;
userId: StringIdResponse;
difficulty?: string | null;
attachments?: AttachmentItemResponse[] | null;
startDate?: ProjectLocalDateValue;
endDate?: ProjectLocalDateValue;
};
export interface ProjectMemberResponse {
@@ -353,6 +355,9 @@ export function normalizeTaskWorklog(response: TaskWorklogResponse): Api.Project
workContent: response.workContent ?? null,
attachments: normalizeAttachments(response.attachments),
progressRate: typeof response.progressRate === 'number' ? response.progressRate : 0,
// 后端 LocalDate 默认序列化为 [year, month, day] 数组,必须归一为 'YYYY-MM-DD' 字符串供 ElDatePicker 使用
startDate: normalizeProjectLocalDate(response.startDate) ?? '',
endDate: normalizeProjectLocalDate(response.endDate) ?? '',
// 历史记录或异常缺失时兜底为字典默认档位 "2"
difficulty: response.difficulty ?? '2',
difficultyName: response.difficultyName ?? null