fix(接口测试): 修复复制数据时由于拼接copy_导致名字过长不利于保存的问题

--bug=1038797 --user=宋天阳 https://www.tapd.cn/55049933/s/1492270
This commit is contained in:
Jianguo-Genius 2024-04-09 20:09:34 +08:00 committed by Craftsman
parent 09f7bea6cf
commit 859eedfa12
4 changed files with 20 additions and 4 deletions

View File

@ -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

View File

@ -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;
//

View File

@ -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: {},
});

View File

@ -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']);