feat(testReport): 新增测试报告分组和报告生成功能

- 添加ReportTaskState和ReportTaskGenerateState类型定义
- 扩展ReportTaskLedgerImportStage枚举,增加文件导入阶段
- 新增ReportTaskLedgerImportRequest、ReportTaskLedgerValidateAttachmentRecord等接口定义
- 添加validateReportTaskLedgerApi、importReportTaskLedgerApi等API方法
- 在操作列新增分组和生成报告按钮
- 实现ReportTaskGroupDialog组件用于监测点分组管理
- 添加分组报告下载功能和相关事件处理
- 优化报告任务详情对话框中的分组报告显示
- 更新createEmptyLedgerPreparedState函数初始化逻辑
This commit is contained in:
dk
2026-07-20 16:09:05 +08:00
parent 6984f66da4
commit 6d876ec7dd
8 changed files with 518 additions and 15 deletions

View File

@@ -37,11 +37,32 @@ export const downloadReportTaskLedgerTemplateApi = (): Promise<AxiosResponse<Blo
}) as unknown as Promise<AxiosResponse<Blob>>
export const validateReportTaskLedgerApi = (id: string, formData: FormData) => {
return http.post<ReportTask.ReportTaskLedgerImportResult>(`${REPORT_TASK_BASE_URL}/${id}/ledger/validate`, formData, {
return http.post<ReportTask.ReportTaskLedgerValidateResult>(`${REPORT_TASK_BASE_URL}/${id}/ledger/validate`, formData, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
export const importReportTaskLedgerApi = (id: string, params: ReportTask.ReportTaskLedgerImportRequest) => {
return http.post<ReportTask.ReportTaskLedgerImportResult>(`${REPORT_TASK_BASE_URL}/${id}/ledger/import`, params)
}
export const listReportTaskPointsApi = (id: string) => {
return http.get<ReportTask.ReportTaskPointRecord[]>(`${REPORT_TASK_BASE_URL}/${id}/point/list`)
}
export const saveReportTaskGroupsApi = (id: string, params: ReportTask.ReportTaskGroupSaveRequest) => {
return http.post<boolean>(`${REPORT_TASK_BASE_URL}/${id}/group/save`, params)
}
export const listReportTaskGroupReportsApi = (id: string) => {
return http.get<ReportTask.ReportTaskGroupReportRecord[]>(`${REPORT_TASK_BASE_URL}/${id}/group-report/list`)
}
export const generateReportTaskGroupReportsApi = (id: string) => {
return http.post<boolean>(`${REPORT_TASK_BASE_URL}/${id}/generate`)
}
export const downloadReportTaskGroupReportApi = (groupReportId: string): Promise<AxiosResponse<Blob>> =>
http.get(`${REPORT_TASK_BASE_URL}/group-report/${groupReportId}/download`, undefined, {
responseType: 'blob'
}) as unknown as Promise<AxiosResponse<Blob>>

View File

@@ -1,9 +1,12 @@
export namespace ReportTask {
export type ReportTaskState = '01' | '02' | '03' | '04' | '05'
export type ReportTaskGenerateState = 0 | 1 | 2
export type ReportTaskGroupReportGenerateState = 0 | 1 | 2 | 3
export type ReportTaskLedgerImportStage =
| '选择文件'
| '校验文件'
| '文件上传'
| '文件导入'
| '基础资料维护'
| '完成'
@@ -41,6 +44,7 @@ export namespace ReportTask {
searchBeginTime?: string
searchEndTime?: string
timeRange?: string[]
state?: ReportTaskState | string
pageNum?: number
pageSize?: number
}
@@ -65,12 +69,59 @@ export namespace ReportTask {
checkResult?: string
}
export interface ReportTaskLedgerImportRequest {
batchId: string
}
export interface ReportTaskLedgerImportStageRecord {
stage?: ReportTaskLedgerImportStage | string | null
success?: boolean | null
message?: string | null
}
export interface ReportTaskLedgerValidateAttachmentRecord {
attachmentName?: string | null
attachmentType?: string | null
referenced?: boolean | null
uploaded?: boolean | null
missing?: boolean | null
reuploadAllowed?: boolean | null
message?: string | null
}
export interface ReportTaskLedgerValidatePointRecord {
rowNo?: number | null
pointKey?: string | null
substationName?: string | null
pointName?: string | null
complete?: boolean | null
missingAttachmentCount?: number | null
testDeviceNoValid?: boolean | null
testDeviceNoMessage?: string | null
clientUnitNameValid?: boolean | null
clientUnitNameMessage?: string | null
attachments?: ReportTaskLedgerValidateAttachmentRecord[] | null
}
export interface ReportTaskLedgerValidateResult {
sessionId?: string | null
batchId?: string | null
success?: boolean | null
summaryFileName?: string | null
summaryFilePresent?: boolean | null
tempStoragePath?: string | null
uploadedFileCount?: number | null
pointCount?: number | null
missingAttachmentCount?: number | null
canContinueUpload?: boolean | null
requiredSheets?: string[] | null
existingSheets?: string[] | null
missingSheets?: string[] | null
orphanAttachmentNames?: string[] | null
failReasons?: string[] | null
points?: ReportTaskLedgerValidatePointRecord[] | null
}
export interface ReportTaskLedgerImportSnapshotGroupRecord {
groupNo?: number | null
count?: number | null
@@ -100,7 +151,9 @@ export namespace ReportTask {
currentStage?: ReportTaskLedgerImportStage | string | null
success?: boolean | null
summaryFileName?: string | null
tempStoragePath?: string | null
totalFileCount?: number
uploadedFileCount?: number
pointCount?: number
excelAttachmentCount?: number
wordAttachmentCount?: number
@@ -153,9 +206,13 @@ export namespace ReportTask {
export interface ReportTaskLedgerPreparedState {
draftId: string
batchId: string
validateSessionId: string
validateResult: ReportTaskLedgerValidateResult | null
latestImportResult: ReportTaskLedgerImportResult | null
snapshot: ReportTaskLedgerImportSnapshot | null
hasImported: boolean
validatedBatchId: string
pendingReimport: boolean
pendingRevalidate: boolean
}
}