From 0e8958132888d6b049908fb23122bd5761acdaa0 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Mon, 17 Jan 2022 16:52:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=88=97=E8=A1=A8=E4=B8=8A?= =?UTF-8?q?=E7=94=A8=E7=89=88=E6=9C=AC=E8=BF=87=E6=BB=A4=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=88=97=E4=B8=8A=E7=9A=84checkbox=E4=B9=9F?= =?UTF-8?q?=E8=A6=81=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1009671 --user=刘瑞斌 【接口CASE】-选中了当前版本是v1.0.0,版本列表字段应该不支持筛选了 https://www.tapd.cn/55049933/s/1092989 --- .../api/automation/ApiAutomation.vue | 2 ++ .../automation/scenario/ApiScenarioList.vue | 14 ++++++++++---- .../api/definition/ApiDefinition.vue | 10 ++-------- .../components/list/ApiCaseSimpleList.vue | 18 +++++++++++++----- .../api/definition/components/list/ApiList.vue | 16 ++++++++++++---- .../performance/test/PerformanceTestList.vue | 15 +++++++++++---- 6 files changed, 50 insertions(+), 25 deletions(-) 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) {