refactor: 列表上用版本过滤后,版本列上的checkbox也要过滤

--bug=1009671 --user=刘瑞斌 【接口CASE】-选中了当前版本是v1.0.0,版本列表字段应该不支持筛选了 https://www.tapd.cn/55049933/s/1092989
This commit is contained in:
CaptainB 2022-01-17 16:52:24 +08:00 committed by 刘瑞斌
parent a0cdee29c1
commit 42751c515a
6 changed files with 50 additions and 25 deletions

View File

@ -500,9 +500,11 @@ export default {
changeVersion(currentVersion) { changeVersion(currentVersion) {
if (this.$refs.apiScenarioList) { if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.condition.versionId = currentVersion || null; this.$refs.apiScenarioList.condition.versionId = currentVersion || null;
this.$refs.apiScenarioList.getVersionOptions(currentVersion);
} }
if (this.$refs.apiTrashScenarioList) { if (this.$refs.apiTrashScenarioList) {
this.$refs.apiTrashScenarioList.condition.versionId = currentVersion || null; this.$refs.apiTrashScenarioList.condition.versionId = currentVersion || null;
this.$refs.apiTrashScenarioList.getVersionOptions(currentVersion);
} }
this.refresh(); this.refresh();
} }

View File

@ -814,12 +814,18 @@ export default {
}); });
}); });
}, },
getVersionOptions() { getVersionOptions(currentVersion) {
if (hasLicense()) { if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => { if (currentVersion) {
return {text: u.name, value: u.id}; 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};
});
}
}); });
} }
}, },

View File

@ -54,6 +54,7 @@
:module-tree="nodeTree" :module-tree="nodeTree"
:module-options="moduleOptions" :module-options="moduleOptions"
:current-protocol="currentProtocol" :current-protocol="currentProtocol"
:current-version="currentVersion"
:visible="visible" :visible="visible"
:currentRow="currentRow" :currentRow="currentRow"
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
@ -251,14 +252,7 @@ import MsRunTestHttpPage from "./components/runtest/RunTestHTTPPage";
import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage"; import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage";
import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage"; import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage";
import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage"; import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage";
import { import {getCurrentProjectID, getCurrentUser, getCurrentUserId, getUUID, hasPermission} from "@/common/js/utils";
getCurrentProjectID,
getCurrentUser,
getCurrentUserId,
getUUID,
hasLicense,
hasPermission
} from "@/common/js/utils";
import MsApiModule from "./components/module/ApiModule"; import MsApiModule from "./components/module/ApiModule";
import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList"; import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";

View File

@ -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 {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 PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns"; import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
import MsReferenceView from "../reference/ReferenceView"; import MsReferenceView from "../reference/ReferenceView";
@ -500,6 +500,8 @@ export default {
currentVersion() { currentVersion() {
this.condition.versionId = this.currentVersion; this.condition.versionId = this.currentVersion;
this.initTable(); this.initTable();
// checkbox
this.getVersionOptions(this.currentVersion);
}, },
trashEnable() { trashEnable() {
if (this.trashEnable) { if (this.trashEnable) {
@ -1191,12 +1193,18 @@ export default {
this.$emit('runRefresh', {}); this.$emit('runRefresh', {});
}); });
}, },
getVersionOptions() { getVersionOptions(currentVersion) {
if (hasLicense()) { if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => { if (currentVersion) {
return {text: u.name, value: u.id}; 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};
});
}
}); });
} }
}, },

View File

@ -527,6 +527,8 @@ export default {
currentVersion() { currentVersion() {
this.condition.versionId = this.currentVersion; this.condition.versionId = this.currentVersion;
this.initTable(); this.initTable();
// checkbox
this.getVersionOptions(this.currentVersion);
}, },
trashEnable() { trashEnable() {
if (this.trashEnable) { if (this.trashEnable) {
@ -641,12 +643,18 @@ export default {
}); });
}); });
}, },
getVersionOptions() { getVersionOptions(currentVersion) {
if (hasLicense()) { if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => { if (currentVersion) {
return {text: u.name, value: u.id}; 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};
});
}
}); });
} }
}, },

View File

@ -288,13 +288,19 @@ export default {
} }
this.$router.push('/performance/test/create'); this.$router.push('/performance/test/create');
}, },
getVersionOptions() { getVersionOptions(currentVersion) {
if (hasLicense()) { if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionOptions = response.data; this.versionOptions = response.data;
this.versionFilters = response.data.map(u => { if (currentVersion) {
return {text: u.name, value: u.id}; 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.currentVersion = value || null;
this.condition.versionId = value || null; this.condition.versionId = value || null;
this.refresh(); this.refresh();
this.getVersionOptions(value);
}, },
checkVersionEnable() { checkVersionEnable() {
if (!this.projectId) { if (!this.projectId) {