feat: 将入库汇总导出从本地 xlsx 重构为后端异步轮询模式(submitExportTask + checkExportStatus)
This commit is contained in:
@ -17,11 +17,43 @@ export function getInboundSummaryList(params: InboundSummaryQuery) {
|
||||
})
|
||||
}
|
||||
|
||||
export function exportInboundSummary(params: any) {
|
||||
// ============================================================
|
||||
// 旧版:前端直接处理 Excel blob(已废弃,保留用于参考)
|
||||
// ============================================================
|
||||
// export function exportInboundSummary(params: any) {
|
||||
// return request({
|
||||
// url: '/v1/inbound/summary/export',
|
||||
// method: 'get',
|
||||
// params,
|
||||
// responseType: 'blob'
|
||||
// })
|
||||
// }
|
||||
|
||||
// ============================================================
|
||||
// 新版:异步导出 API(后端生成 + 轮询任务状态)
|
||||
// ============================================================
|
||||
|
||||
/**
|
||||
* 提交异步导出任务
|
||||
* POST /api/v1/export/inventory
|
||||
* 返回 { task_id: string }
|
||||
*/
|
||||
export function submitExportTask(filters: Record<string, any>) {
|
||||
return request({
|
||||
url: '/v1/inbound/summary/export',
|
||||
method: 'get',
|
||||
params,
|
||||
responseType: 'blob'
|
||||
url: '/v1/export/inventory',
|
||||
method: 'post',
|
||||
data: filters
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮询导出任务状态
|
||||
* GET /api/v1/export/status/<taskId>
|
||||
* 返回 { status: 'processing'|'completed'|'failed', progress: number, url: string, error: string }
|
||||
*/
|
||||
export function checkExportStatus(taskId: string) {
|
||||
return request({
|
||||
url: `/v1/export/status/${taskId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user