From 9d6fde286bedb17d51ff5a52cf33a548f920ef2c Mon Sep 17 00:00:00 2001 From: liuyihe <2513762445@qq.com> Date: Tue, 15 Sep 2026 15:20:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/overseasHttp.ts | 24 ++++ src/components.d.ts | 1 + .../views/businessIdentifiers.test.mjs | 2 +- .../api/warehouseServices.ts | 4 +- .../views/ReturnOrdersView.vue | 33 +++++- .../views/WarehouseServiceView.vue | 112 +++++++++++++----- .../views/relabelAttachments.test.mjs | 15 +++ 7 files changed, 152 insertions(+), 39 deletions(-) diff --git a/src/api/overseasHttp.ts b/src/api/overseasHttp.ts index 3abc261..e567603 100644 --- a/src/api/overseasHttp.ts +++ b/src/api/overseasHttp.ts @@ -65,3 +65,27 @@ export async function overseasApiRequest(config: AxiosRequestConfig) { throw new ApiError(error instanceof Error ? error.message : '海外接口请求失败') } } + +export async function overseasBlobRequest(config: AxiosRequestConfig) { + try { + const response = await transport.request({ ...config, responseType: 'blob' }) + return response.data + } catch (error) { + if (error instanceof ApiError) throw error + if (axios.isAxiosError(error)) { + const body = error.response?.data + if (body instanceof Blob && body.type.includes('json')) { + try { + const parsed: unknown = JSON.parse(await body.text()) + if (isApiEnvelope(parsed) || isApiFailure(parsed)) { + throw new ApiError(parsed.message, parsed.code, error.response?.status, undefined, parsed.traceId, parsed.requestId) + } + } catch (parseError) { + if (parseError instanceof ApiError) throw parseError + } + } + throw new ApiError(error.code === 'ERR_NETWORK' ? '无法连接海外服务' : error.message, error.code || 'OVERSEAS_HTTP_ERROR', error.response?.status) + } + throw new ApiError(error instanceof Error ? error.message : '海外文件下载失败') + } +} diff --git a/src/components.d.ts b/src/components.d.ts index befd71f..f15b3f0 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -33,6 +33,7 @@ declare module 'vue' { ElEmpty: typeof import('element-plus/es')['ElEmpty'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] + ElImage: typeof import('element-plus/es')['ElImage'] ElInput: typeof import('element-plus/es')['ElInput'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] ElOption: typeof import('element-plus/es')['ElOption'] diff --git a/src/modules/first-leg/views/businessIdentifiers.test.mjs b/src/modules/first-leg/views/businessIdentifiers.test.mjs index a19916e..9b60b06 100644 --- a/src/modules/first-leg/views/businessIdentifiers.test.mjs +++ b/src/modules/first-leg/views/businessIdentifiers.test.mjs @@ -35,5 +35,5 @@ test('keeps overseas warehouse operations first and renders readable list values assert.match(overseas, /function formatDateTime\(value\?: string \| null\)/) assert.match(overseas, /import SingleLineText from '@\/components\/common\/SingleLineText\.vue'/) assert.match(overseas, /