fix(接口测试): 修复复制数据时由于拼接copy_导致名字过长不利于保存的问题
--bug=1038797 --user=宋天阳 https://www.tapd.cn/55049933/s/1492270
This commit is contained in:
parent
09f7bea6cf
commit
859eedfa12
|
@ -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 集合收集,更新时以判断文件是否删除以及是否新上传的文件
|
||||
|
|
|
@ -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;
|
||||
// 编辑
|
||||
|
|
|
@ -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: {},
|
||||
});
|
||||
|
|
|
@ -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']);
|
||||
|
|
Loading…
Reference in New Issue