fix(接口测试): 修复批量执行环境组类型绑定问题
--user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001020186 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001020183
This commit is contained in:
parent
f2b3a11699
commit
6bb7dcd375
|
@ -52,13 +52,31 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-show="radio === ENV_TYPE.GROUP ">
|
<div v-show="radio === ENV_TYPE.GROUP ">
|
||||||
<div >
|
<div >
|
||||||
<el-select v-model="envGroupId" :placeholder="$t('workspace.env_group.select')" @change="chooseEnvGroup"
|
<el-select v-show="!hasOptionGroup" v-model="envGroupId" :placeholder="$t('workspace.env_group.select')" @change="chooseEnvGroup"
|
||||||
style="margin-top: 8px;width: 100%;" size="small">
|
style="margin-top: 8px;width: 100%;" size="small">
|
||||||
<el-option v-for="(group, index) in groups" :key="index"
|
<el-option v-for="(group, index) in groups" :key="index"
|
||||||
|
:disabled="group.disabled"
|
||||||
:label="group.name"
|
:label="group.name"
|
||||||
:value="group.id"/>
|
:value="group.id"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<el-select
|
||||||
|
v-show="hasOptionGroup"
|
||||||
|
v-model="envGroupId"
|
||||||
|
:placeholder="$t('workspace.env_group.select')"
|
||||||
|
style="margin-top: 8px;width: 100%;"
|
||||||
|
size="small"
|
||||||
|
@change="chooseEnvGroup"
|
||||||
|
clearable>
|
||||||
|
<el-option-group v-for="group in groups" :key="group.label" :label="group.label">
|
||||||
|
<el-option
|
||||||
|
v-for="item in group.options"
|
||||||
|
:key="item.name"
|
||||||
|
:label="item.name"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
:value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-option-group>
|
||||||
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog :visible="visible" append-to-body :title="$t('workspace.env_group.name')" @close="visible = false"
|
<el-dialog :visible="visible" append-to-body :title="$t('workspace.env_group.name')" @close="visible = false"
|
||||||
style="height: 800px;">
|
style="height: 800px;">
|
||||||
|
@ -70,25 +88,30 @@
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 对环境组选项进行分类 可用|不可用 -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ENV_TYPE } from 'metersphere-frontend/src/utils/constants';
|
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 MsTag from 'metersphere-frontend/src/components/MsTag';
|
||||||
import { parseEnvironment } from 'metersphere-frontend/src/model/EnvironmentModel';
|
import { parseEnvironment } from 'metersphere-frontend/src/model/EnvironmentModel';
|
||||||
import { getEnvironmentByProjectId } from '@/api/api-environment';
|
import { getEnvironmentByProjectId } from '@/api/api-environment';
|
||||||
import EnvironmentGroup from '@/business/commons/EnvironmentGroupList';
|
import EnvironmentGroup from '@/business/commons/EnvironmentGroupList';
|
||||||
|
import EnvGroupWithOption from "@/business/automation/scenario/EnvGroupWithOption";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'EnvSelectPopover',
|
name: 'EnvSelectPopover',
|
||||||
components: { EnvironmentGroup,MsTag },
|
components: { EnvironmentGroup,MsTag,EnvGroupWithOption},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
radio: ENV_TYPE.JSON,
|
radio: this.environmentType,
|
||||||
visible: false,
|
visible: false,
|
||||||
groups: [],
|
groups: [],
|
||||||
|
disabledGroups: [],
|
||||||
|
notDisabledGroups: [],
|
||||||
selectedEnvName: new Map(),
|
selectedEnvName: new Map(),
|
||||||
showEnvName: false,
|
showEnvName: false,
|
||||||
eventData: [],
|
eventData: [],
|
||||||
|
@ -108,6 +131,7 @@ export default {
|
||||||
projectEnvMap: Object,
|
projectEnvMap: Object,
|
||||||
caseIdEnvNameMap: Object,
|
caseIdEnvNameMap: Object,
|
||||||
envMap: Map,
|
envMap: Map,
|
||||||
|
environmentType: String,
|
||||||
groupId: {
|
groupId: {
|
||||||
type: String,
|
type: String,
|
||||||
default() {
|
default() {
|
||||||
|
@ -135,6 +159,9 @@ export default {
|
||||||
groupId(val) {
|
groupId(val) {
|
||||||
this.envGroupId = val;
|
this.envGroupId = val;
|
||||||
},
|
},
|
||||||
|
environmentType(val) {
|
||||||
|
this.radio = val;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open() {
|
open() {
|
||||||
|
@ -146,7 +173,7 @@ export default {
|
||||||
this.$emit("setEnvGroup", envGroupId);
|
this.$emit("setEnvGroup", envGroupId);
|
||||||
},
|
},
|
||||||
radioChange(val) {
|
radioChange(val) {
|
||||||
this.radio = val;
|
this.$emit('update:environmentType', val);
|
||||||
},
|
},
|
||||||
getProjectName(id) {
|
getProjectName(id) {
|
||||||
const project = this.projectList.find((p) => p.id === id);
|
const project = this.projectList.find((p) => p.id === id);
|
||||||
|
@ -160,10 +187,28 @@ export default {
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
},
|
},
|
||||||
getgroups() {
|
getgroups() {
|
||||||
|
if (this.hasOptionGroup) {
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
environmentGetALL().then((res) => {
|
environmentGetALL().then((res) => {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
this.groups = data ? data : [];
|
this.groups = data ? data : [];
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
chooseEnv(val) {
|
chooseEnv(val) {
|
||||||
let filter = this.evnList.filter((e) => e.id === val);
|
let filter = this.evnList.filter((e) => e.id === val);
|
||||||
|
@ -234,6 +279,7 @@ export default {
|
||||||
this.eventData[index].expendStatus = 'open';
|
this.eventData[index].expendStatus = 'open';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
:project-ids="projectIds"
|
:project-ids="projectIds"
|
||||||
:project-list="projectList"
|
:project-list="projectList"
|
||||||
:case-id-env-name-map="caseIdEnvNameMap"
|
:case-id-env-name-map="caseIdEnvNameMap"
|
||||||
|
:environment-type.sync="runConfig.environmentType"
|
||||||
:is-scenario="isScenario"
|
:is-scenario="isScenario"
|
||||||
:has-option-group="true"
|
:has-option-group="true"
|
||||||
:project-env-map="projectEnvListMap"
|
:project-env-map="projectEnvListMap"
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
<env-select-popover :project-ids="projectIds"
|
<env-select-popover :project-ids="projectIds"
|
||||||
:project-list="projectList"
|
:project-list="projectList"
|
||||||
:project-env-map="projectEnvListMap"
|
:project-env-map="projectEnvListMap"
|
||||||
|
:environment-type.sync="runConfig.environmentType"
|
||||||
|
:has-option-group="true"
|
||||||
:group-id="runConfig.environmentGroupId"
|
:group-id="runConfig.environmentGroupId"
|
||||||
@setProjectEnvMap="setProjectEnvMap"
|
@setProjectEnvMap="setProjectEnvMap"
|
||||||
@setEnvGroup="setEnvGroup"
|
@setEnvGroup="setEnvGroup"
|
||||||
|
|
|
@ -31,12 +31,27 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-show="radio === ENV_TYPE.GROUP">
|
<div v-show="radio === ENV_TYPE.GROUP">
|
||||||
<div>
|
<div>
|
||||||
<el-select v-model="envGroupId" :placeholder="$t('workspace.env_group.select')" @change="chooseEnvGroup"
|
<el-select v-show="!hasOptionGroup" v-model="envGroupId" :placeholder="$t('workspace.env_group.select')" @change="chooseEnvGroup"
|
||||||
style="margin-top: 8px;width: 100%;" size="small">
|
style="margin-top: 8px;width: 100%;" size="small">
|
||||||
<el-option v-for="(group, index) in groups" :key="index"
|
<el-option v-for="(group, index) in groups" :key="index"
|
||||||
:label="group.name"
|
:label="group.name"
|
||||||
:value="group.id"/>
|
:value="group.id"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<el-select v-show="hasOptionGroup" v-model="envGroupId" :placeholder="$t('workspace.env_group.select')"
|
||||||
|
style="margin-top: 8px;width: 100%;" size="small" clearable>
|
||||||
|
<el-option-group
|
||||||
|
v-for="group in groups"
|
||||||
|
:key="group.label"
|
||||||
|
:label="group.label">
|
||||||
|
<el-option
|
||||||
|
v-for="item in group.options"
|
||||||
|
:key="item.name"
|
||||||
|
:label="item.name"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
:value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-option-group>
|
||||||
|
</el-select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<el-dialog :visible="visible" append-to-body :title="$t('workspace.env_group.name')" @close="visible = false"
|
<el-dialog :visible="visible" append-to-body :title="$t('workspace.env_group.name')" @close="visible = false"
|
||||||
|
@ -56,7 +71,7 @@
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
|
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 MsTag from "metersphere-frontend/src/components/MsTag";
|
||||||
import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList";
|
import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList";
|
||||||
import {getEnvironmentByProjectId} from "@/api/remote/api/api-environment";
|
import {getEnvironmentByProjectId} from "@/api/remote/api/api-environment";
|
||||||
|
@ -67,9 +82,11 @@ export default {
|
||||||
components: {MsTag,EnvironmentGroup},
|
components: {MsTag,EnvironmentGroup},
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
radio:ENV_TYPE.JSON,
|
radio: this.environmentType,
|
||||||
visible: false,
|
visible: false,
|
||||||
groups:[],
|
groups:[],
|
||||||
|
disabledGroups: [],
|
||||||
|
notDisabledGroups: [],
|
||||||
selectedEnvName:new Map(),
|
selectedEnvName:new Map(),
|
||||||
showEnvName:false,
|
showEnvName:false,
|
||||||
eventData:[],
|
eventData:[],
|
||||||
|
@ -82,6 +99,9 @@ export default {
|
||||||
groupId(val) {
|
groupId(val) {
|
||||||
this.envGroupId = val;
|
this.envGroupId = val;
|
||||||
},
|
},
|
||||||
|
environmentType(val) {
|
||||||
|
this.radio = val;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
ENV_TYPE() {
|
ENV_TYPE() {
|
||||||
|
@ -93,12 +113,19 @@ export default {
|
||||||
projectList:Array,
|
projectList:Array,
|
||||||
projectEnvMap:Object,
|
projectEnvMap:Object,
|
||||||
envMap: Map,
|
envMap: Map,
|
||||||
|
environmentType: String,
|
||||||
groupId: {
|
groupId: {
|
||||||
type: String,
|
type: String,
|
||||||
default() {
|
default() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
hasOptionGroup: {
|
||||||
|
type: Boolean,
|
||||||
|
default() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open(){
|
open(){
|
||||||
|
@ -107,7 +134,7 @@ export default {
|
||||||
this.getgroups();
|
this.getgroups();
|
||||||
},
|
},
|
||||||
radioChange(val){
|
radioChange(val){
|
||||||
this.radio = val;
|
this.$emit("update:environmentType", val);
|
||||||
},
|
},
|
||||||
getProjectName(id) {
|
getProjectName(id) {
|
||||||
const project = this.projectList.find(p => p.id === id);
|
const project = this.projectList.find(p => p.id === id);
|
||||||
|
@ -121,10 +148,27 @@ export default {
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
},
|
},
|
||||||
getgroups(){
|
getgroups(){
|
||||||
|
if (!this.hasOptionGroup){
|
||||||
environmentGetALL().then(res => {
|
environmentGetALL().then(res => {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
this.groups = data ? 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){
|
chooseEnv(val){
|
||||||
let filter = this.evnList.filter(e => e.id === val);
|
let filter = this.evnList.filter(e => e.id === val);
|
||||||
|
|
Loading…
Reference in New Issue