fix: 【【测试计划】-关联场景用例时不能选用例版本】

https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001009870
This commit is contained in:
zhangdahai112 2022-01-24 00:34:25 +08:00 committed by 刘瑞斌
parent 14aec5da38
commit 612de7a615
6 changed files with 87 additions and 6 deletions

View File

@ -11,13 +11,18 @@
:show-config-button-with-out-permission="showConfigButtonWithOutPermission" :show-config-button-with-out-permission="showConfigButtonWithOutPermission"
:project-list="projectList" :project-list="projectList"
ref="envPopover" class="env-popover"/> ref="envPopover" class="env-popover"/>
<el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="search" <el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="search"
@keyup.enter.native="search" class="search-input" size="small" v-model="condition.name"/> @keyup.enter.native="search" class="search-input" size="small" v-model="condition.name"/>
<ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar" <ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar"
v-if="condition.components !== undefined && condition.components.length > 0" v-if="condition.components !== undefined && condition.components.length > 0"
@search="search"/> @search="search"/>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"
class="search-input"/>
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll" @select="handleSelect"> <el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll" @select="handleSelect" @filter-change="filter">
<el-table-column type="selection"/> <el-table-column type="selection"/>
<el-table-column v-if="!customNum" prop="num" label="ID" <el-table-column v-if="!customNum" prop="num" label="ID"
show-overflow-tooltip> show-overflow-tooltip>
@ -27,6 +32,17 @@
</el-table-column> </el-table-column>
<el-table-column prop="name" :label="$t('api_test.automation.scenario_name')" <el-table-column prop="name" :label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip/> show-overflow-tooltip/>
<el-table-column
v-if="versionEnable"
column-key="version_id"
:filters="versionFilters"
:label="$t('commons.version')"
min-width="120px">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</el-table-column>
<el-table-column prop="level" :label="$t('api_test.automation.case_level')" <el-table-column prop="level" :label="$t('api_test.automation.case_level')"
show-overflow-tooltip> show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
@ -77,6 +93,9 @@
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar"; import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components"; import {TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components";
import {ENV_TYPE} from "@/common/js/constants"; import {ENV_TYPE} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
import {hasLicense, getCurrentProjectID} from "@/common/js/utils";
export default { export default {
name: "RelevanceScenarioList", name: "RelevanceScenarioList",
@ -91,7 +110,8 @@
MsTag, MsTag,
MsApiReportDetail, MsApiReportDetail,
MsTestPlanList, MsTestPlanList,
MsTableAdvSearchBar MsTableAdvSearchBar,
'VersionSelect': VersionSelect.default,
}, },
props: { props: {
referenced: { referenced: {
@ -101,6 +121,7 @@
selectNodeIds: Array, selectNodeIds: Array,
projectId: String, projectId: String,
planId: String, planId: String,
versionEnable: Boolean,
}, },
data() { data() {
return { return {
@ -125,7 +146,8 @@
map: new Map(), map: new Map(),
customNum: false, customNum: false,
environmentType: ENV_TYPE.JSON, environmentType: ENV_TYPE.JSON,
envGroupId: "" envGroupId: "",
versionFilters: [],
} }
}, },
computed: { computed: {
@ -143,6 +165,7 @@
}, },
created() { created() {
this.getWsProjects(); this.getWsProjects();
this.getVersionOptions();
}, },
methods: { methods: {
search() { search() {
@ -154,8 +177,11 @@
this.getProject(this.projectId); this.getProject(this.projectId);
this.selectRows = new Set(); this.selectRows = new Set();
this.loading = true; this.loading = true;
if (this.condition.filters) {
this.condition.filters.status = ["Prepare", "Underway", "Completed"];
} else {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]}; this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
}
this.condition.moduleIds = this.selectNodeIds; this.condition.moduleIds = this.selectNodeIds;
@ -225,6 +251,23 @@
}, },
checkEnv() { checkEnv() {
return this.$refs.envPopover.checkEnv(); return this.$refs.envPopover.checkEnv();
},
changeVersion(currentVersion) {
this.condition.versionId = currentVersion || null;
this.search();
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
filter(field) {
this.condition.filters = field || null;
this.search();
} }
} }
} }

View File

@ -19,6 +19,7 @@
<relevance-scenario-list <relevance-scenario-list
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:trash-enable="trashEnable" :trash-enable="trashEnable"
:version-enable="versionEnable"
:plan-id="planId" :plan-id="planId"
:project-id="projectId" :project-id="projectId"
ref="apiScenarioList"/> ref="apiScenarioList"/>
@ -65,6 +66,10 @@
planId: { planId: {
type: String type: String
}, },
versionEnable: {
type: Boolean,
default: false
}
}, },
watch: { watch: {
planId() { planId() {

View File

@ -79,6 +79,7 @@
@refresh="refresh" @refresh="refresh"
:plan-id="planId" :plan-id="planId"
:model="model" :model="model"
:version-enable="versionEnable"
ref="scenarioCaseRelevance"/> ref="scenarioCaseRelevance"/>
</ms-test-plan-common-component> </ms-test-plan-common-component>

View File

@ -10,6 +10,17 @@
<el-table-column prop="name" :label="$t('api_test.automation.scenario_name')" <el-table-column prop="name" :label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip/> show-overflow-tooltip/>
<el-table-column
v-if="versionEnable"
prop="versionId"
:filters="versionFilters"
:label="$t('commons.version')"
min-width="120px">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</el-table-column>
<el-table-column prop="level" :label="$t('api_test.automation.case_level')" <el-table-column prop="level" :label="$t('api_test.automation.case_level')"
show-overflow-tooltip> show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
@ -56,6 +67,7 @@ import MsTag from "@/business/components/common/components/MsTag";
import EnvPopover from "@/business/components/track/common/EnvPopover"; import EnvPopover from "@/business/components/track/common/EnvPopover";
import MsTablePagination from "@/business/components/common/pagination/TablePagination"; import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import PriorityTableItem from "@/business/components/track/common/tableItems/planview/PriorityTableItem"; import PriorityTableItem from "@/business/components/track/common/tableItems/planview/PriorityTableItem";
import {hasLicense, getCurrentProjectID} from "@/common/js/utils";
export default { export default {
name: "ReviewRelevanceScenarioList", name: "ReviewRelevanceScenarioList",
@ -68,6 +80,7 @@ export default {
selectNodeIds: Array, selectNodeIds: Array,
projectId: String, projectId: String,
reviewId: String, reviewId: String,
versionEnable: Boolean,
}, },
data() { data() {
return { return {
@ -86,6 +99,7 @@ export default {
projectEnvMap: new Map(), projectEnvMap: new Map(),
projectList: [], projectList: [],
projectIds: new Set(), projectIds: new Set(),
versionFilters: []
} }
}, },
watch: { watch: {
@ -98,6 +112,7 @@ export default {
}, },
created() { created() {
this.getWsProjects(); this.getWsProjects();
this.getVersionOptions();
}, },
methods: { methods: {
search() { search() {
@ -159,7 +174,16 @@ export default {
}, },
checkEnv() { checkEnv() {
return this.$refs.envPopover.checkEnv(); return this.$refs.envPopover.checkEnv();
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
} }
},
} }
} }
</script> </script>

View File

@ -57,6 +57,7 @@
v-if="model === 'scenario'" v-if="model === 'scenario'"
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:trash-enable="trashEnable" :trash-enable="trashEnable"
:version-enable="versionEnable"
:review-id="reviewId" :review-id="reviewId"
:clickType="clickType" :clickType="clickType"
@refresh="refreshTree" @refresh="refreshTree"
@ -66,12 +67,14 @@
<test-review-relevance-api <test-review-relevance-api
@refresh="refresh" @refresh="refresh"
:review-id="reviewId" :review-id="reviewId"
:version-enable="versionEnable"
:model="model" :model="model"
ref="apiCaseRelevance" ref="apiCaseRelevance"
/> />
<test-review-relevance-scenario <test-review-relevance-scenario
@refresh="refresh" @refresh="refresh"
:review-id="reviewId" :review-id="reviewId"
:version-enable="versionEnable"
:model="model" :model="model"
ref="scenarioCaseRelevance" ref="scenarioCaseRelevance"
/> />

View File

@ -17,6 +17,7 @@
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:trash-enable="trashEnable" :trash-enable="trashEnable"
:review-id="reviewId" :review-id="reviewId"
:version-enable="versionEnable"
:project-id="projectId" :project-id="projectId"
ref="apiScenarioList"/> ref="apiScenarioList"/>
</test-case-relevance-base> </test-case-relevance-base>
@ -48,6 +49,10 @@ export default {
reviewId: { reviewId: {
type: String type: String
}, },
versionEnable: {
type: Boolean,
default: false
}
}, },
watch: { watch: {
reviewId() { reviewId() {