diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index ac02e7729e..ec3be7af89 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -500,9 +500,11 @@ export default { changeVersion(currentVersion) { if (this.$refs.apiScenarioList) { this.$refs.apiScenarioList.condition.versionId = currentVersion || null; + this.$refs.apiScenarioList.getVersionOptions(currentVersion); } if (this.$refs.apiTrashScenarioList) { this.$refs.apiTrashScenarioList.condition.versionId = currentVersion || null; + this.$refs.apiTrashScenarioList.getVersionOptions(currentVersion); } this.refresh(); } diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index d17b7d69c4..5a0f44d6f4 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -814,12 +814,18 @@ export default { }); }); }, - getVersionOptions() { + getVersionOptions(currentVersion) { if (hasLicense()) { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); + if (currentVersion) { + this.versionFilters = response.data.filter(u => u.id === currentVersion).map(u => { + return {text: u.name, value: u.id}; + }); + } else { + this.versionFilters = response.data.map(u => { + return {text: u.name, value: u.id}; + }); + } }); } }, diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index 5df517584d..7e562c7124 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -54,6 +54,7 @@ :module-tree="nodeTree" :module-options="moduleOptions" :current-protocol="currentProtocol" + :current-version="currentVersion" :visible="visible" :currentRow="currentRow" :select-node-ids="selectNodeIds" @@ -251,14 +252,7 @@ import MsRunTestHttpPage from "./components/runtest/RunTestHTTPPage"; import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage"; import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage"; import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage"; -import { - getCurrentProjectID, - getCurrentUser, - getCurrentUserId, - getUUID, - hasLicense, - hasPermission -} from "@/common/js/utils"; +import {getCurrentProjectID, getCurrentUser, getCurrentUserId, getUUID, hasPermission} from "@/common/js/utils"; import MsApiModule from "./components/module/ApiModule"; import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList"; diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue index 69dce8246e..060a69a015 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -249,7 +249,7 @@ import MsApiCaseRunModeWithEnv from "./ApiCaseRunModeWithEnv"; import {API_METHOD_COLOUR, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData"; -import {getBodyUploadFiles, getCurrentProjectID, getUUID, hasLicense, strMapToObj} from "@/common/js/utils"; +import {getBodyUploadFiles, getCurrentProjectID, getUUID, hasLicense} from "@/common/js/utils"; import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem"; import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns"; import MsReferenceView from "../reference/ReferenceView"; @@ -500,6 +500,8 @@ export default { currentVersion() { this.condition.versionId = this.currentVersion; this.initTable(); + // 选择了版本过滤,版本列上的checkbox也进行过滤 + this.getVersionOptions(this.currentVersion); }, trashEnable() { if (this.trashEnable) { @@ -1191,12 +1193,18 @@ export default { this.$emit('runRefresh', {}); }); }, - getVersionOptions() { + getVersionOptions(currentVersion) { if (hasLicense()) { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); + if (currentVersion) { + this.versionFilters = response.data.filter(u => u.id === currentVersion).map(u => { + return {text: u.name, value: u.id}; + }); + } else { + this.versionFilters = response.data.map(u => { + return {text: u.name, value: u.id}; + }); + } }); } }, diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index 66a4cc5eb5..4e98645846 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -527,6 +527,8 @@ export default { currentVersion() { this.condition.versionId = this.currentVersion; this.initTable(); + // 选择了版本过滤,版本列上的checkbox也进行过滤 + this.getVersionOptions(this.currentVersion); }, trashEnable() { if (this.trashEnable) { @@ -641,12 +643,18 @@ export default { }); }); }, - getVersionOptions() { + getVersionOptions(currentVersion) { if (hasLicense()) { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); + if (currentVersion) { + this.versionFilters = response.data.filter(u => u.id === currentVersion).map(u => { + return {text: u.name, value: u.id}; + }); + } else { + this.versionFilters = response.data.map(u => { + return {text: u.name, value: u.id}; + }); + } }); } }, diff --git a/frontend/src/business/components/performance/test/PerformanceTestList.vue b/frontend/src/business/components/performance/test/PerformanceTestList.vue index d266349056..db0b45af05 100644 --- a/frontend/src/business/components/performance/test/PerformanceTestList.vue +++ b/frontend/src/business/components/performance/test/PerformanceTestList.vue @@ -288,13 +288,19 @@ export default { } this.$router.push('/performance/test/create'); }, - getVersionOptions() { + getVersionOptions(currentVersion) { if (hasLicense()) { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { this.versionOptions = response.data; - this.versionFilters = response.data.map(u => { - return {text: u.name, value: u.id}; - }); + if (currentVersion) { + this.versionFilters = response.data.filter(u => u.id === currentVersion).map(u => { + return {text: u.name, value: u.id}; + }); + } else { + this.versionFilters = response.data.map(u => { + return {text: u.name, value: u.id}; + }); + } }); } }, @@ -302,6 +308,7 @@ export default { this.currentVersion = value || null; this.condition.versionId = value || null; this.refresh(); + this.getVersionOptions(value); }, checkVersionEnable() { if (!this.projectId) {