From d430e509dcede5c138ffc38bd278f4d1a271801e Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 24 Dec 2020 12:59:48 +0800 Subject: [PATCH] =?UTF-8?q?refacotr:=20=E5=9C=BA=E6=99=AF=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E5=88=97=E8=A1=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/scenario/EditApiScenario.vue | 17 +-- .../scenario/api/ScenarioApiRelevance.vue | 33 ----- .../scenario/api/ScenarioRelevance.vue | 138 ++++++++++++++++++ 3 files changed, 145 insertions(+), 43 deletions(-) create mode 100644 frontend/src/business/components/api/automation/scenario/api/ScenarioRelevance.vue diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 564b195bff..1331ad4ea3 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -208,9 +208,7 @@ - - - + @@ -241,7 +239,6 @@ import MsIfController from "./IfController"; import MsApiAssertions from "../../definition/components/assertion/ApiAssertions"; import MsApiExtract from "../../definition/components/extract/ApiExtract"; - import MsApiDefinition from "./api/ApiDefinition"; import MsApiComponent from "./ApiComponent"; import {ELEMENTS, ELEMENT_TYPE} from "./Setting"; import MsApiCustomize from "./ApiCustomize"; @@ -257,6 +254,7 @@ import InputTag from 'vue-input-tag' import "@/common/css/material-icons.css" import ScenarioApiRelevance from "./api/ScenarioApiRelevance"; + import ScenarioRelevance from "./api/ScenarioRelevance"; export default { name: "EditApiScenario", @@ -265,13 +263,13 @@ currentScenario: {}, }, components: { + ScenarioRelevance, ScenarioApiRelevance, ApiEnvironmentConfig, MsScenarioParameters, MsApiReportDetail, MsInputTag, MsRun, MsApiScenarioComponent, - MsImportApiScenario, MsJsr233Processor, MsConstantTimer, MsIfController, @@ -488,7 +486,8 @@ this.customizeVisible = true; break; case ELEMENT_TYPE.scenario: - this.scenarioVisible = true; + // this.scenarioVisible = true; + this.$refs.scenarioRelevance.open(); break; default: this.$refs.apiImport.open(); @@ -546,8 +545,7 @@ this.customizeRequest = {}; this.sort(); this.reload(); - } - , + }, addScenario(arr) { if (arr && arr.length > 0) { arr.forEach(item => { @@ -562,8 +560,7 @@ this.sort(); this.reload(); this.scenarioVisible = false; - } - , + }, setApiParameter(item, refType, referenced) { let request = {}; if (Object.prototype.toString.call(item.request).indexOf("String") > 0) { diff --git a/frontend/src/business/components/api/automation/scenario/api/ScenarioApiRelevance.vue b/frontend/src/business/components/api/automation/scenario/api/ScenarioApiRelevance.vue index 185fc3df58..c840464a00 100644 --- a/frontend/src/business/components/api/automation/scenario/api/ScenarioApiRelevance.vue +++ b/frontend/src/business/components/api/automation/scenario/api/ScenarioApiRelevance.vue @@ -108,38 +108,6 @@ setModuleOptions(data) { this.moduleOptions = data; }, - - saveCaseRelevance() { - - let param = {}; - let url = ''; - let environmentId = undefined; - let selectIds = []; - if (this.isApiListEnable) { - url = '/api/definition/relevance'; - environmentId = this.$refs.apiList.environmentId; - selectIds = Array.from(this.$refs.apiList.selectRows).map(row => row.id); - } else { - url = '/api/testcase/relevance'; - environmentId = this.$refs.apiCaseList.environmentId; - selectIds = Array.from(this.$refs.apiCaseList.selectRows).map(row => row.id); - } - - if (!environmentId) { - this.$warning(this.$t('api_test.environment.select_environment')); - return; - } - param.planId = this.planId; - param.selectIds = selectIds; - param.environmentId = environmentId; - this.result = this.$post(url, param, () => { - this.$success(this.$t('commons.save_success')); - this.$emit('refresh'); - this.refresh(); - this.$refs.baseRelevance.close(); - }); - }, - refresh() { if (this.isApiListEnable) { this.$refs.apiList.initTable(); @@ -147,7 +115,6 @@ this.$refs.apiCaseList.initTable(); } }, - } } diff --git a/frontend/src/business/components/api/automation/scenario/api/ScenarioRelevance.vue b/frontend/src/business/components/api/automation/scenario/api/ScenarioRelevance.vue new file mode 100644 index 0000000000..bbc912908f --- /dev/null +++ b/frontend/src/business/components/api/automation/scenario/api/ScenarioRelevance.vue @@ -0,0 +1,138 @@ + + + + +