From e977ffc42d395eb296e887c3b13fb9021b415552 Mon Sep 17 00:00:00 2001 From: DXC Date: Tue, 19 May 2026 10:41:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=86=E5=85=A5=E5=BA=93=E6=B1=87?= =?UTF-8?q?=E6=80=BB=E5=AF=BC=E5=87=BA=E4=BB=8E=E6=9C=AC=E5=9C=B0=20xlsx?= =?UTF-8?q?=20=E9=87=8D=E6=9E=84=E4=B8=BA=E5=90=8E=E7=AB=AF=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E8=BD=AE=E8=AF=A2=E6=A8=A1=E5=BC=8F=EF=BC=88submitExp?= =?UTF-8?q?ortTask=20+=20checkExportStatus=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/inbound/inbound_summary.ts | 42 +++++++- .../views/stock/inbound/inbound_summary.vue | 98 +++++++++++++------ 2 files changed, 105 insertions(+), 35 deletions(-) diff --git a/inventory-web/src/api/inbound/inbound_summary.ts b/inventory-web/src/api/inbound/inbound_summary.ts index 6c14610..5c77336 100644 --- a/inventory-web/src/api/inbound/inbound_summary.ts +++ b/inventory-web/src/api/inbound/inbound_summary.ts @@ -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) { 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/ + * 返回 { status: 'processing'|'completed'|'failed', progress: number, url: string, error: string } + */ +export function checkExportStatus(taskId: string) { + return request({ + url: `/v1/export/status/${taskId}`, + method: 'get' }) } \ No newline at end of file diff --git a/inventory-web/src/views/stock/inbound/inbound_summary.vue b/inventory-web/src/views/stock/inbound/inbound_summary.vue index 3cd79e3..1ddf346 100644 --- a/inventory-web/src/views/stock/inbound/inbound_summary.vue +++ b/inventory-web/src/views/stock/inbound/inbound_summary.vue @@ -104,9 +104,9 @@