From da688552cf72a16f8538a0d74286a422147f661d Mon Sep 17 00:00:00 2001 From: baiqi Date: Fri, 13 Dec 2024 15:50:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3&=E7=94=A8=E4=BE=8B=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=94=99=E8=AF=AF=E6=8D=95=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/management/api/index.vue | 15 +++++++---- .../case/createAndEditCaseDrawer.vue | 26 +++++++++++++------ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/frontend/src/views/api-test/management/components/management/api/index.vue b/frontend/src/views/api-test/management/components/management/api/index.vue index e926738e84..9d64e22de8 100644 --- a/frontend/src/views/api-test/management/components/management/api/index.vue +++ b/frontend/src/views/api-test/management/components/management/api/index.vue @@ -381,11 +381,16 @@ let copyFilesMap: Record = {}; const fileIds = parseRequestBodyFiles(res.request.body, [], [], []).uploadFileIds; if (fileIds.length > 0 && isCopy) { - copyFilesMap = await definitionFileCopy({ - resourceId: typeof apiInfo === 'string' ? apiInfo : apiInfo.id, - fileIds, - }); - parseRequestBodyFiles(res.request.body, res.response, [], [], copyFilesMap); // 替换请求的文件 id + try { + copyFilesMap = await definitionFileCopy({ + resourceId: typeof apiInfo === 'string' ? apiInfo : apiInfo.id, + fileIds, + }); + parseRequestBodyFiles(res.request.body, res.response, [], [], copyFilesMap); // 替换请求的文件 id + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } } else { parseRequestBodyResult = parseRequestBodyFiles(res.request.body, res.response, [], [], copyFilesMap); // 解析请求体中的文件,将详情中的文件 id 集合收集,更新时以判断文件是否删除以及是否新上传的文件 } diff --git a/frontend/src/views/api-test/management/components/management/case/createAndEditCaseDrawer.vue b/frontend/src/views/api-test/management/components/management/case/createAndEditCaseDrawer.vue index bb8c81e3e5..801a610e46 100644 --- a/frontend/src/views/api-test/management/components/management/case/createAndEditCaseDrawer.vue +++ b/frontend/src/views/api-test/management/components/management/case/createAndEditCaseDrawer.vue @@ -227,10 +227,15 @@ let copyFilesMap: Record = {}; const fileIds = parseRequestBodyFiles(apiDetailInfo.value.request.body, [], [], []).uploadFileIds; if (fileIds.length > 0) { - copyFilesMap = await definitionFileCopy({ - resourceId: apiDetailInfo.value.id as string, - fileIds, - }); + try { + copyFilesMap = await definitionFileCopy({ + resourceId: apiDetailInfo.value.id as string, + fileIds, + }); + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } } parseRequestBodyFiles(apiDetailInfo.value.request.body, [], [], [], copyFilesMap); // 替换请求文件 id } @@ -258,10 +263,15 @@ let copyFilesMap: Record = {}; const fileIds = parseRequestBodyFiles(record.request.body, [], [], []).uploadFileIds; if (fileIds.length > 0) { - copyFilesMap = await caseFileCopy({ - resourceId: record.id as string, - fileIds, - }); + try { + copyFilesMap = await caseFileCopy({ + resourceId: record.id as string, + fileIds, + }); + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } } parseRequestBodyFiles(record.request.body, [], [], [], copyFilesMap); // 替换请求文件 id detailForm.value = {