From 63802feb0733db42521ef74dde30b4388b6706f3 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 23 Nov 2022 21:45:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=B9=E9=87=8F=E6=89=A7=E8=A1=8C=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E7=BB=84=E7=B1=BB=E5=9E=8B=E7=BB=91=E5=AE=9A=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001020186 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001020183 --- .../automation/scenario/EnvSelectPopover.vue | 70 +++++++++++++++---- .../automation/scenario/common/ApiRunMode.vue | 1 + .../plan/common/TestPlanRunModeWithEnv.vue | 2 + .../business/plan/env/EnvSelectPopover.vue | 60 +++++++++++++--- 4 files changed, 113 insertions(+), 20 deletions(-) diff --git a/api-test/frontend/src/business/automation/scenario/EnvSelectPopover.vue b/api-test/frontend/src/business/automation/scenario/EnvSelectPopover.vue index 4081fe8c28..d39d179fa7 100644 --- a/api-test/frontend/src/business/automation/scenario/EnvSelectPopover.vue +++ b/api-test/frontend/src/business/automation/scenario/EnvSelectPopover.vue @@ -50,15 +50,33 @@ -
-
- +
+ - + + + + + +
@@ -70,25 +88,30 @@
+ +
diff --git a/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue b/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue index 9d3f6076bd..64692005ee 100644 --- a/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue +++ b/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue @@ -12,6 +12,7 @@ :project-ids="projectIds" :project-list="projectList" :case-id-env-name-map="caseIdEnvNameMap" + :environment-type.sync="runConfig.environmentType" :is-scenario="isScenario" :has-option-group="true" :project-env-map="projectEnvListMap" diff --git a/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue b/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue index 2eccaae681..161512b047 100644 --- a/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue +++ b/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue @@ -13,6 +13,8 @@
- + + + + + +
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants"; -import {environmentGetALL} from "metersphere-frontend/src/api/environment"; +import {environmentGetALL,getEnvironmentOptions} from "metersphere-frontend/src/api/environment"; import MsTag from "metersphere-frontend/src/components/MsTag"; import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList"; import {getEnvironmentByProjectId} from "@/api/remote/api/api-environment"; @@ -67,9 +82,11 @@ export default { components: {MsTag,EnvironmentGroup}, data(){ return { - radio:ENV_TYPE.JSON, + radio: this.environmentType, visible: false, groups:[], + disabledGroups: [], + notDisabledGroups: [], selectedEnvName:new Map(), showEnvName:false, eventData:[], @@ -82,6 +99,9 @@ export default { groupId(val) { this.envGroupId = val; }, + environmentType(val) { + this.radio = val; + } }, computed: { ENV_TYPE() { @@ -93,12 +113,19 @@ export default { projectList:Array, projectEnvMap:Object, envMap: Map, + environmentType: String, groupId: { type: String, default() { return ""; } }, + hasOptionGroup: { + type: Boolean, + default() { + return false; + } + }, }, methods: { open(){ @@ -107,7 +134,7 @@ export default { this.getgroups(); }, radioChange(val){ - this.radio = val; + this.$emit("update:environmentType", val); }, getProjectName(id) { const project = this.projectList.find(p => p.id === id); @@ -121,10 +148,27 @@ export default { this.visible = true; }, getgroups(){ - environmentGetALL().then(res => { - let data = res.data; - this.groups = data ? data : []; - }) + if (!this.hasOptionGroup){ + environmentGetALL().then(res => { + let data = res.data; + this.groups = data ? data : []; + }) + } else { + getEnvironmentOptions({projectIds: [...this.projectIds]}).then(res => { + let groups = res.data; + this.disabledGroups = groups.filter(group => group.disabled === true); + this.notDisabledGroups = groups.filter(group => group.disabled === false); + this.$set(this.groups, 0, { + label: this.$t('workspace.env_group.available_group'), + options: this.notDisabledGroups + }); + this.$set(this.groups, 1, { + label: this.$t('workspace.env_group.not_available_group'), + options: this.disabledGroups + }); + }) + } + }, chooseEnv(val){ let filter = this.evnList.filter(e => e.id === val);