From 53458630d8103e5a2b6e098c35e185704dc59535 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 11 Dec 2020 13:46:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/scenario/EditApiScenario.vue | 4 +- .../automation/scenario/api/ApiCaseList.vue | 59 ++++++++----------- .../automation/scenario/api/ApiDefinition.vue | 3 +- .../api/automation/scenario/api/ApiList.vue | 9 ++- 4 files changed, 34 insertions(+), 41 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 7a81fb266e..0d3c8a142a 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -237,7 +237,7 @@ - + {{$t('api_test.scenario.reference')}} {{ $t('commons.copy') }} @@ -348,6 +348,7 @@ debugData: {}, reportId: "", projectId: "", + visibleRef: "", } }, created() { @@ -417,6 +418,7 @@ this.reload(); }, apiListImport() { + this.visibleRef = getUUID(); this.apiListVisible = true; }, recursiveSorting(arr) { diff --git a/frontend/src/business/components/api/automation/scenario/api/ApiCaseList.vue b/frontend/src/business/components/api/automation/scenario/api/ApiCaseList.vue index a8e832c117..6ad9dd318c 100644 --- a/frontend/src/business/components/api/automation/scenario/api/ApiCaseList.vue +++ b/frontend/src/business/components/api/automation/scenario/api/ApiCaseList.vue @@ -72,7 +72,7 @@ - +
@@ -169,10 +169,8 @@ api: { type: Object }, - createCase: String, visible: { - type: Boolean, - default: false, + type: String, }, loaded: Boolean, refreshSign: String, @@ -202,7 +200,7 @@ api() { this.getApiTest(); }, - createCase() { + visible() { this.getApiTest(); } }, @@ -212,21 +210,6 @@ this.getApiTest(); }, methods: { - sysAddition() { - let condition = {}; - condition.projectId = this.api.projectId; - condition.apiDefinitionId = this.api.id; - condition.priority = this.priorityValue; - condition.name = this.name; - this.$post("/api/testcase/list", condition, response => { - for (let index in response.data) { - let test = response.data[index]; - test.request = JSON.parse(test.request); - } - this.apiCaseList = response.data; - this.addCase(); - }); - }, getResult(data) { if (RESULT_MAP.get(data)) { return RESULT_MAP.get(data); @@ -352,21 +335,27 @@ return bodyUploadFiles; }, getApiTest() { - if (this.currentRow) { - this.currentRow.cases = []; - } - let condition = {}; - condition.projectId = this.api.projectId; - condition.apiDefinitionId = this.api.id; - condition.priority = this.priorityValue; - condition.name = this.name; - this.$post("/api/testcase/list", condition, response => { - for (let index in response.data) { - let test = response.data[index]; - test.request = JSON.parse(test.request); + if (this.api) { + this.checkedCases = new Set(); + this.loading = true; + if (this.currentRow) { + this.currentRow.cases = []; } - this.apiCaseList = response.data; - }); + let condition = {}; + condition.projectId = this.projectId; + condition.apiDefinitionId = this.api.id; + condition.priority = this.priorityValue; + condition.name = this.name; + this.$post("/api/testcase/list", condition, response => { + for (let index in response.data) { + let test = response.data[index]; + test.checked = false; + test.request = JSON.parse(test.request); + } + this.loading = false; + this.apiCaseList = response.data; + }); + } }, validate(row) { if (!row.name) { @@ -383,7 +372,7 @@ }); let hasEnvironment = false; for (let i in this.environments) { - if (this.environments[i].id === this.api.environmentId) { + if (this.api && this.environments[i].id === this.api.environmentId) { hasEnvironment = true; break; } diff --git a/frontend/src/business/components/api/automation/scenario/api/ApiDefinition.vue b/frontend/src/business/components/api/automation/scenario/api/ApiDefinition.vue index 8241a6a026..25870b4891 100644 --- a/frontend/src/business/components/api/automation/scenario/api/ApiDefinition.vue +++ b/frontend/src/business/components/api/automation/scenario/api/ApiDefinition.vue @@ -50,8 +50,7 @@ }, props: { visible: { - type: Boolean, - default: false, + type: String, }, currentRow: { type: Object, diff --git a/frontend/src/business/components/api/automation/scenario/api/ApiList.vue b/frontend/src/business/components/api/automation/scenario/api/ApiList.vue index 7186684e2f..a4102bb1df 100644 --- a/frontend/src/business/components/api/automation/scenario/api/ApiList.vue +++ b/frontend/src/business/components/api/automation/scenario/api/ApiList.vue @@ -142,8 +142,7 @@ currentProtocol: String, currentModule: Object, visible: { - type: Boolean, - default: false, + type: String, }, currentRow: { type: Object, @@ -161,6 +160,10 @@ this.initApiTable(); this.apiCaseClose(); }, + visible() { + this.initApiTable(); + this.apiCaseClose(); + }, currentProtocol() { this.initApiTable(); this.apiCaseClose(); @@ -321,8 +324,8 @@ }); }, apiCaseClose() { + this.selectApi = {}; let h = window.screen.height; - let svgTop = document.getElementById("svgTop"); svgTop.style.height = h - 200 + "px";