From 75700557c8ff4cd44327e721df579e719e164d35 Mon Sep 17 00:00:00 2001 From: zhangdahai112 Date: Sun, 23 Jan 2022 22:47:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/TestPlanScenarioRequest.java | 2 + .../ext/ExtTestPlanScenarioCaseMapper.xml | 80 +++++++++++++++---- .../common/components/IsChangeConfirm.vue | 2 +- .../comonents/api/TestPlanApiScenarioList.vue | 35 +++++++- .../api/TestPlanScenarioListHeader.vue | 9 ++- .../review/view/components/TestReviewApi.vue | 17 +++- .../view/components/TestReviewFunction.vue | 2 + .../view/components/TestReviewRelevance.vue | 9 ++- .../src/common/js/default-table-header.js | 1 + 9 files changed, 129 insertions(+), 28 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/TestPlanScenarioRequest.java b/backend/src/main/java/io/metersphere/api/dto/automation/TestPlanScenarioRequest.java index 789e64e057..845a2fb3fb 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/TestPlanScenarioRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/TestPlanScenarioRequest.java @@ -27,6 +27,8 @@ public class TestPlanScenarioRequest { private Map combine; private List ids; private String reviewId; + private String versionId; + private String refId; /** * 是否选中所有数据 diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanScenarioCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanScenarioCaseMapper.xml index 54f85ed6eb..a3aec675aa 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanScenarioCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanScenarioCaseMapper.xml @@ -24,20 +24,48 @@ - + @@ -165,6 +193,12 @@ #{value} + + and c.version_id in + + #{value} + + @@ -275,4 +309,16 @@ order by `order` desc limit 1; + + + + and ${versionTable}.version_id = #{request.versionId} + + + and ${versionTable}.ref_id = #{request.refId} + + + AND ${versionTable}.latest = 1 + + diff --git a/frontend/src/business/components/common/components/IsChangeConfirm.vue b/frontend/src/business/components/common/components/IsChangeConfirm.vue index 4416a310b2..d903a1a0b1 100644 --- a/frontend/src/business/components/common/components/IsChangeConfirm.vue +++ b/frontend/src/business/components/common/components/IsChangeConfirm.vue @@ -24,7 +24,7 @@ export default { data: {} } }, - props: ['title','tip'], + props: ['title','tip', 'versionEnable'], methods: { open(item) { this.visible = true; diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue index 1389c7a92a..8a5383da55 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue @@ -4,6 +4,8 @@ @@ -40,6 +42,18 @@ :label="$t('api_test.automation.scenario_name')" min-width="120px" sortable/> + + + + { + this.versionFilters = response.data.map(u => { + return {text: u.name, value: u.id}; + }); + }); + } + }, } } diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanScenarioListHeader.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanScenarioListHeader.vue index b88165be17..432639287d 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanScenarioListHeader.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanScenarioListHeader.vue @@ -11,6 +11,7 @@ + @@ -20,11 +21,15 @@ import MsTableHeader from "../../../../../common/components/MsTableHeader"; import MsTableButton from "../../../../../common/components/MsTableButton"; import MsEnvironmentSelect from "../../../../../api/definition/components/case/MsEnvironmentSelect"; +const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); +const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {}; export default { name: "TestPlanScenarioListHeader", - components: {MsEnvironmentSelect, MsTableButton, MsTableHeader}, - props: ['condition', 'isReadOnly'], + components: { + MsEnvironmentSelect, MsTableButton, MsTableHeader, 'VersionSelect': VersionSelect.default, + }, + props: ['condition', 'isReadOnly', 'projectId'], methods: {} }; diff --git a/frontend/src/business/components/track/review/view/components/TestReviewApi.vue b/frontend/src/business/components/track/review/view/components/TestReviewApi.vue index ce7d8f30f9..5c031ba0c9 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewApi.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewApi.vue @@ -25,6 +25,7 @@ @nodeSelectEvent="nodeChange" @refreshTable="refreshTable" @setModuleOptions="setModuleOptions" + :version-enable="versionEnable" :is-read-only="true" :review-id="reviewId" ref="scenarioNodeTree"> @@ -41,6 +42,7 @@ v-if="model === 'api'" :current-protocol="currentProtocol" :currentRow="currentRow" + :version-enable="versionEnable" :select-node-ids="selectNodeIds" :trash-enable="trashEnable" :is-case-relevance="true" @@ -88,6 +90,7 @@ import MsApiModule from "../../../../api/definition/components/module/ApiModule" import TestReviewRelevanceApi from "@/business/components/track/review/view/components/TestReviewRelevanceApi"; import TestReviewRelevanceScenario from "@/business/components/track/review/view/components/TestReviewRelevanceScenario"; +import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; export default { name: "TestReviewApi", @@ -112,7 +115,8 @@ export default { currentModule: null, selectNodeIds: [], moduleOptions: {}, - model: 'api' + model: 'api', + versionEnable: false, } }, props: [ @@ -122,6 +126,7 @@ export default { ], mounted() { this.checkRedirectCharType(); + this.checkVersionEnable(); }, watch: { model() { @@ -182,6 +187,16 @@ export default { this.$refs.apiCaseRelevance.open(); } }, + checkVersionEnable() { + if (!getCurrentProjectID()) { + return; + } + if (hasLicense()) { + this.$get('/project/version/enable/' + getCurrentProjectID(), response => { + this.versionEnable = response.data; + }); + } + }, } } diff --git a/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue b/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue index ff872dd93a..a5b499e084 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue @@ -45,11 +45,13 @@ diff --git a/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue b/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue index e3f4eec2f2..1bc4e8d4b1 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue @@ -49,7 +49,7 @@