From 9723e560b8ddec4a83f258c385ec2995d425e7c2 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 19 Nov 2021 14:29:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201.15=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/scenario/EditApiScenario.vue | 59 +++++++++++++++++++ .../scenario/common/ApiBaseComponent.vue | 8 ++- .../scenario/component/ApiComponent.vue | 57 +++++++++++++++++- .../component/ApiScenarioComponent.vue | 19 +++++- .../scenario/component/urlhelper.js | 32 ++++++++++ .../api/definition/ApiDefinition.vue | 13 ++++ 6 files changed, 179 insertions(+), 9 deletions(-) create mode 100644 frontend/src/business/components/api/automation/scenario/component/urlhelper.js 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) }} + +