refactor(接口测试): 默认环境去除详情展示

--bug=1028768 --user=赵勇 【接口测试】场景列表-批量执行-默认环境展示了环境明细 https://www.tapd.cn/55049933/s/1403943

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-08-15 16:48:15 +08:00 committed by fit2-zhao
parent 7c5367234e
commit 1d6e4ef4a8
1 changed files with 31 additions and 31 deletions

View File

@ -2,7 +2,9 @@
<div> <div>
<el-radio-group v-model="radio" style="width: 100%" @change="radioChange" class="radio-change"> <el-radio-group v-model="radio" style="width: 100%" @change="radioChange" class="radio-change">
<el-radio :label="ENV_TYPE.JSON">{{ $t('workspace.env_group.env_list') }}</el-radio> <el-radio :label="ENV_TYPE.JSON">{{ $t('workspace.env_group.env_list') }}</el-radio>
<el-radio :label="ENV_TYPE.GROUP" v-if="isScenario">{{ $t('workspace.env_group.name') }}<i class="el-icon-tickets mode-span" @click="viewGroup"></i></el-radio> <el-radio :label="ENV_TYPE.GROUP" v-if="isScenario"
>{{ $t('workspace.env_group.name') }}<i class="el-icon-tickets mode-span" @click="viewGroup"></i
></el-radio>
</el-radio-group> </el-radio-group>
<div v-for="(pe, pIndex) in eventData" :key="pe.id" v-show="!radio || radio === ENV_TYPE.JSON"> <div v-for="(pe, pIndex) in eventData" :key="pe.id" v-show="!radio || radio === ENV_TYPE.JSON">
<el-card shadow="never" style="margin-top: 8px; background: #f5f6f7; border-radius: 4px"> <el-card shadow="never" style="margin-top: 8px; background: #f5f6f7; border-radius: 4px">
@ -26,14 +28,6 @@
$t('api_test.environment.choose_new_environment') $t('api_test.environment.choose_new_environment')
}}</el-radio> }}</el-radio>
</el-radio-group> </el-radio-group>
<el-tag
v-show="!pe.showEnvSelect"
v-for="(itemName, index) in selectedEnvName.get(pe.id)"
:key="index"
size="mini"
style="margin-left: 0; margin-right: 2px; margin-top: 8px"
>{{ itemName }}</el-tag
>
<el-select <el-select
v-show="pe.showEnvSelect" v-show="pe.showEnvSelect"
v-model="pe['selectEnv']" v-model="pe['selectEnv']"
@ -51,20 +45,27 @@
</div> </div>
</el-card> </el-card>
</div> </div>
<div v-show="radio === ENV_TYPE.GROUP "> <div v-show="radio === ENV_TYPE.GROUP">
<div > <div>
<el-select v-show="!hasOptionGroup" v-model="envGroupId" :placeholder="$t('workspace.env_group.select')" @change="chooseEnvGroup" <el-select
style="margin-top: 8px;width: 100%;" size="small"> v-show="!hasOptionGroup"
<el-option v-for="(group, index) in groups" :key="index" v-model="envGroupId"
:disabled="group.disabled" :placeholder="$t('workspace.env_group.select')"
:label="group.name" @change="chooseEnvGroup"
:value="group.id"/> style="margin-top: 8px; width: 100%"
size="small">
<el-option
v-for="(group, index) in groups"
:key="index"
:disabled="group.disabled"
:label="group.name"
:value="group.id" />
</el-select> </el-select>
<el-select <el-select
v-show="hasOptionGroup" v-show="hasOptionGroup"
v-model="envGroupId" v-model="envGroupId"
:placeholder="$t('workspace.env_group.select')" :placeholder="$t('workspace.env_group.select')"
style="margin-top: 8px;width: 100%;" style="margin-top: 8px; width: 100%"
size="small" size="small"
@change="chooseEnvGroup" @change="chooseEnvGroup"
clearable> clearable>
@ -79,33 +80,33 @@
</el-option-group> </el-option-group>
</el-select> </el-select>
</div> </div>
<el-dialog :visible="visible" append-to-body :title="$t('workspace.env_group.name')" @close="visible = false" <el-dialog
style="height: 800px;"> :visible="visible"
append-to-body
:title="$t('workspace.env_group.name')"
@close="visible = false"
style="height: 800px">
<template> <template>
<environment-group style="overflow-y: auto;" <environment-group style="overflow-y: auto" :screen-height="'350px'" :read-only="true"></environment-group>
:screen-height="'350px'"
:read-only="true"
></environment-group>
</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,getEnvironmentOptions } 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"; import EnvGroupWithOption from '@/business/automation/scenario/EnvGroupWithOption';
export default { export default {
name: 'EnvSelectPopover', name: 'EnvSelectPopover',
components: { EnvironmentGroup,MsTag,EnvGroupWithOption}, components: { EnvironmentGroup, MsTag, EnvGroupWithOption },
data() { data() {
return { return {
radio: this.environmentType, radio: this.environmentType,
@ -170,8 +171,8 @@ export default {
this.initDefaultEnv(); this.initDefaultEnv();
this.getgroups(); this.getgroups();
}, },
chooseEnvGroup(envGroupId){ chooseEnvGroup(envGroupId) {
this.$emit("setEnvGroup", envGroupId); this.$emit('setEnvGroup', envGroupId);
}, },
radioChange(val) { radioChange(val) {
this.$emit('update:environmentType', val); this.$emit('update:environmentType', val);
@ -280,7 +281,6 @@ export default {
this.eventData[index].expendStatus = 'open'; this.eventData[index].expendStatus = 'open';
} }
}, },
}, },
}; };
</script> </script>