From 721815e8d6c1ce26ee885c9aa4f03466da7f45d1 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 23 Nov 2021 20:26:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E6=96=B0=E5=AF=BC=E5=85=A5id=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 【接口自动化】新引用的也显示 --- .../automation/scenario/EditApiScenario.vue | 65 ------------------- .../scenario/component/ApiComponent.vue | 19 +++++- .../component/ApiScenarioComponent.vue | 8 ++- 3 files changed, 23 insertions(+), 69 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 348ad6f4bc..7bc0484a17 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -556,7 +556,6 @@ export default { let data = JSON.parse(res.data); if (data.hashTree) { this.sort(data.hashTree); - this.addNum(data.hashTree); this.scenarioDefinition = data.hashTree; } } @@ -1401,7 +1400,6 @@ export default { this.onSampleError = obj.onSampleError; } this.dataProcessing(obj.hashTree); - this.addNum(obj.hashTree); this.scenarioDefinition = obj.hashTree; } } @@ -1671,69 +1669,6 @@ 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 if (data.type === 'scenario') { - 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 => { - if (response.data && response.data.num) { - resolve(response.data.num); - } - }); - }); - }, - getApiTestCaseNumById(id) { - return new Promise((resolve) => { - let url = '/api/testcase/get/' + id; - this.$get(url, response => { - if (response.data && response.data.num) { - resolve(response.data.num); - } - }); - }); - }, - getScenarioNumById(id) { - return new Promise((resolve) => { - let url = '/api/automation/getApiScenario/' + id; - this.$get(url, response => { - if (response.data && response.data.num) { - resolve(response.data.num); - } - }); - }); - } } } 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 2a6675f9d7..1dac044056 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -17,7 +17,7 @@