From 859eedfa12bd89dca56329c3d437a671ef9ba0bc Mon Sep 17 00:00:00 2001 From: Jianguo-Genius Date: Tue, 9 Apr 2024 20:09:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=8D=E5=88=B6=E6=95=B0=E6=8D=AE=E6=97=B6?= =?UTF-8?q?=E7=94=B1=E4=BA=8E=E6=8B=BC=E6=8E=A5copy=5F=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=90=8D=E5=AD=97=E8=BF=87=E9=95=BF=E4=B8=8D=E5=88=A9=E4=BA=8E?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1038797 --user=宋天阳 https://www.tapd.cn/55049933/s/1492270 --- .../management/components/management/api/index.vue | 5 ++++- .../management/case/createAndEditCaseDrawer.vue | 3 +++ frontend/src/views/api-test/scenario/index.vue | 8 ++++++-- .../components/caseTemplateDetail.vue | 8 +++++++- 4 files changed, 20 insertions(+), 4 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 4c1036bcea..d74d2c35a6 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 @@ -334,7 +334,10 @@ try { loading.value = true; const res = await getDefinitionDetail(typeof apiInfo === 'string' ? apiInfo : apiInfo.id); - const name = isCopy ? `copy_${res.name}` : res.name; + let name = isCopy ? `copy_${res.name}` : res.name; + if (name.length > 255) { + name = name.slice(0, 255); + } let parseRequestBodyResult; if (res.protocol === 'HTTP') { parseRequestBodyResult = parseRequestBodyFiles(res.request.body); // 解析请求体中的文件,将详情中的文件 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 f433405c5f..1358f95659 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 @@ -210,6 +210,9 @@ if (isCopy) { detailForm.value = cloneDeep(record as RequestParam); detailForm.value.name = `copy_${record?.name}`; + if (detailForm.value.name.length > 255) { + detailForm.value.name = detailForm.value.name.slice(0, 255); + } } environmentId.value = currentEnvConfig?.value?.id; // 编辑 diff --git a/frontend/src/views/api-test/scenario/index.vue b/frontend/src/views/api-test/scenario/index.vue index b470078b96..b5cb5a1023 100644 --- a/frontend/src/views/api-test/scenario/index.vue +++ b/frontend/src/views/api-test/scenario/index.vue @@ -391,12 +391,16 @@ return node; }); } + let copyName = `copy_${defaultScenarioInfo.name}`; + if (copyName.length > 255) { + copyName = copyName.slice(0, 255); + } scenarioTabs.value.push({ ...defaultScenarioInfo, steps: copySteps, id: isCopy ? getGenerateId() : defaultScenarioInfo.id || '', - label: isCopy ? `copy_${defaultScenarioInfo.name}` : defaultScenarioInfo.name, - name: isCopy ? `copy_${defaultScenarioInfo.name}` : defaultScenarioInfo.name, + label: isCopy ? copyName : defaultScenarioInfo.name, + name: isCopy ? copyName : defaultScenarioInfo.name, isNew: isCopy, stepResponses: {}, }); diff --git a/frontend/src/views/case-management/caseManagementFeature/components/caseTemplateDetail.vue b/frontend/src/views/case-management/caseManagementFeature/components/caseTemplateDetail.vue index 0274b2a8fe..c199515fee 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/caseTemplateDetail.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/caseTemplateDetail.vue @@ -518,9 +518,15 @@ // 处理详情字段 function getDetailData(detailResult: DetailCase) { const { customFields, attachments, steps } = detailResult; + + let copyName = `copy_${detailResult.name}`; + if (copyName.length > 255) { + copyName = copyName.slice(0, 255); + } + form.value = { ...detailResult, - name: route.params.mode === 'copy' ? `copy_${detailResult.name}` : detailResult.name, + name: route.params.mode === 'copy' ? copyName : detailResult.name, }; // 处理自定义字段 formRules.value = initFormCreate(customFields as CustomAttributes[], ['FUNCTIONAL_CASE:READ+UPDATE']);