From 3ef3cf258cbbe3f181a8a8d159a6a0f75bd50e31 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 12 Dec 2024 18:05:17 +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=89=8D=E5=90=8E=E7=BD=AE=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=BA=8F=E5=8F=B7=E5=8F=91=E7=94=9F=E5=8F=98=E5=8C=96=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【【接口测试】github#34598,接口场景中步骤的前置后置操作序号发生变更】 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001050316 --- .../automation/scenario/EditApiScenario.vue | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/api-test/frontend/src/business/automation/scenario/EditApiScenario.vue b/api-test/frontend/src/business/automation/scenario/EditApiScenario.vue index df9f4e183c..6384fcdfe0 100644 --- a/api-test/frontend/src/business/automation/scenario/EditApiScenario.vue +++ b/api-test/frontend/src/business/automation/scenario/EditApiScenario.vue @@ -1594,18 +1594,31 @@ export default { stepArray = stepArray || this.scenarioDefinition; this.recursionStep(stepArray); }, + recursionStep(stepArray, scenarioProjectId, fullPath, isGeneric) { - for (let i in stepArray) { + for (let i = 0; i < stepArray.length; i++) { let step = stepArray[i]; - step.index = !isGeneric ? Number(i) + 1 : step.index; - if (step.type === 'GenericController') { - this.pluginOrder(step); + + // 计算 index 和 projectId + if (!isGeneric && !this.stepFilter.get('ALlSamplerStep').includes(step.type)) { + step.index = Number(i) + 1; } - step.resourceId = step.resourceId || getUUID(); - // 历史数据处理 + step.projectId = step.projectId || scenarioProjectId || this.projectId; + + // 设置 clazzName + step.clazzName = step.clazzName || TYPE_TO_C.get(step.type); + + // 处理步骤中的身份认证管理器 + if (step.authManager && !step.authManager.clazzName) { + step.authManager.clazzName = TYPE_TO_C.get(step.authManager.type); + } + + // 处理历史数据 if (step.type === 'HTTPSamplerProxy' && !step.headers) { step.headers = [new KeyValue()]; } + + // 设置 LoopController 类型的额外处理 if ( step.type === ELEMENT_TYPE.LoopController && step.loopType === 'LOOP_COUNT' && @@ -1614,19 +1627,25 @@ export default { ) { step.countController.proceed = true; } - step.clazzName = step.clazzName || TYPE_TO_C.get(step.type); - if (step && step.authManager && !step.authManager.clazzName) { - step.authManager.clazzName = TYPE_TO_C.get(step.authManager.type); + + // 设置资源ID,若没有则生成一个 + step.resourceId = step.resourceId || getUUID(); + + // 设置 parentIndex + step.parentIndex = fullPath ? `${fullPath}_${step.index}` : step.index; + + // 处理 GenericController 类型的步骤 + if (step.type === 'GenericController') { + this.pluginOrder(step); } - // 如果自身没有ID并且场景有ID则赋值场景ID,否则赋值当前项目ID - step.projectId = step.projectId || scenarioProjectId || this.projectId; - // 添加debug结果 - step.parentIndex = fullPath ? fullPath + '_' + step.index : step.index; + + // 如果有子步骤,递归处理 if (step.hashTree && step.hashTree.length > 0) { this.recursionStep(step.hashTree, step.projectId, step.parentIndex, step.type === 'GenericController'); } } }, + addCustomizeApi(request) { this.customizeVisible = false; request.enable === undefined ? (request.enable = true) : request.enable;