diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 17488a4617..b2c75e7f32 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -1379,6 +1379,8 @@ export default { this.onSampleError = obj.onSampleError; } this.dataProcessing(obj.hashTree); + this.addNum(obj.hashTree); + this.scenarioDefinition = obj.hashTree; } @@ -1635,6 +1637,63 @@ export default { }); } } + }, + addNum(hashTree){ + let funcs = []; + for (let i = 0; i < hashTree.length; i++) { + let data = hashTree[i]; + if(!data.num){ + if(data.refType){ + if(data.refType==='API'){ + funcs.push(this.getApiDefinitionNumById(data.id)); + }else if(data.refType==='CASE'){ + funcs.push(this.getApiTestCaseNumById(data.id)); + } + }else { + funcs.push(this.getScenarioNumById(data.id)); + } + } + } + Promise.all(funcs).then(([result1, result2, result3]) =>{ + for (let i = 0; i < hashTree.length; i++) { + let data = hashTree[i]; + if(!data.num){ + if(data.refType){ + if(data.refType==='API'){ + this.$set(data,'num',result1); + }else if(data.refType==='CASE'){ + this.$set(data,'num',result2); + } + }else { + this.$set(data,'num',result3); + } + } + } + }); + }, + getApiDefinitionNumById(id){ + return new Promise((resolve) => { + let url = '/api/definition/get/'+id; + this.$get(url, response => { + resolve(response.data.num); + }); + }); + }, + getApiTestCaseNumById(id){ + return new Promise((resolve) => { + let url = '/api/testcase/findById/'+id; + this.$get(url, response => { + resolve(response.data.num); + }); + }); + }, + getScenarioNumById(id){ + return new Promise((resolve) => { + let url = '/api/automation/getApiScenario/'+id; + this.$get(url, response => { + resolve(response.data.num); + }); + }); } } } diff --git a/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue b/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue index bd05dc5924..6ad362672a 100644 --- a/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue @@ -5,10 +5,9 @@
{{ data.index }}
+ {{ title }} - {{ getMethod() }} - @@ -22,9 +21,11 @@ {{ data.name }} + {{ getMethod() }} + - + @@ -192,6 +193,7 @@ export default { .ms-left-btn { font-size: 13px; margin-right: 15px; + margin-left: 10px; } .header-right { diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue index bd3031ef44..0bf724e10b 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -16,6 +16,10 @@ {{ getProjectName(request.projectId) }} + +