fix(测试跟踪): 关联测试用例全选时切换模块没有状态没改变
--user=郭雨琦 --bug=1013988 【测试跟踪】github#14657,测试计划关联用例问题汇总 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001013988
This commit is contained in:
parent
8050ef6edc
commit
f979a31549
|
@ -60,194 +60,200 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
|
import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
|
||||||
import MsApiModule from "../../../../../api/definition/components/module/ApiModule";
|
import MsApiModule from "../../../../../api/definition/components/module/ApiModule";
|
||||||
import RelevanceApiList from "../../../../../api/automation/scenario/api/RelevanceApiList";
|
import RelevanceApiList from "../../../../../api/automation/scenario/api/RelevanceApiList";
|
||||||
import RelevanceCaseList from "../../../../../api/automation/scenario/api/RelevanceCaseList";
|
import RelevanceCaseList from "../../../../../api/automation/scenario/api/RelevanceCaseList";
|
||||||
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
|
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
|
||||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
|
||||||
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
|
|
||||||
|
|
||||||
export default {
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
name: "TestCaseApiRelevance",
|
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
|
||||||
components: {
|
|
||||||
RelevanceCaseList,
|
export default {
|
||||||
RelevanceApiList,
|
name: "TestCaseApiRelevance",
|
||||||
MsApiModule,
|
components: {
|
||||||
TestCaseRelevanceBase,
|
RelevanceCaseList,
|
||||||
'VersionSelect': VersionSelect.default,
|
RelevanceApiList,
|
||||||
|
MsApiModule,
|
||||||
|
TestCaseRelevanceBase,
|
||||||
|
'VersionSelect': VersionSelect.default,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showCasePage: true,
|
||||||
|
currentProtocol: null,
|
||||||
|
currentModule: null,
|
||||||
|
selectNodeIds: [],
|
||||||
|
moduleOptions: {},
|
||||||
|
trashEnable: false,
|
||||||
|
isApiListEnable: true,
|
||||||
|
condition: {},
|
||||||
|
currentRow: {},
|
||||||
|
projectId: "",
|
||||||
|
versionFilters: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
planId: {
|
||||||
|
type: String
|
||||||
},
|
},
|
||||||
data() {
|
versionEnable: {
|
||||||
return {
|
type: Boolean,
|
||||||
showCasePage: true,
|
default: false
|
||||||
currentProtocol: null,
|
}
|
||||||
currentModule: null,
|
},
|
||||||
selectNodeIds: [],
|
watch: {
|
||||||
moduleOptions: {},
|
planId() {
|
||||||
trashEnable: false,
|
this.condition.planId = this.planId;
|
||||||
isApiListEnable: true,
|
|
||||||
condition: {},
|
|
||||||
currentRow: {},
|
|
||||||
projectId: "",
|
|
||||||
versionFilters: [],
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
props: {
|
},
|
||||||
planId: {
|
mounted() {
|
||||||
type: String
|
this.getVersionOptions();
|
||||||
},
|
},
|
||||||
versionEnable: {
|
methods: {
|
||||||
type: Boolean,
|
open() {
|
||||||
default: false
|
this.init();
|
||||||
|
this.$refs.baseRelevance.open();
|
||||||
|
if (this.$refs.apiList) {
|
||||||
|
this.$refs.apiList.clear();
|
||||||
|
}
|
||||||
|
if (this.$refs.apiCaseList) {
|
||||||
|
this.$refs.apiCaseList.clear();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
init() {
|
||||||
planId() {
|
if (this.$refs.apiList) {
|
||||||
this.condition.planId = this.planId;
|
this.$refs.apiList.initTable();
|
||||||
},
|
}
|
||||||
|
if (this.$refs.apiCaseList) {
|
||||||
|
this.$refs.apiCaseList.initTable();
|
||||||
|
}
|
||||||
|
if (this.$refs.nodeTree) {
|
||||||
|
this.$refs.nodeTree.list();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
setProject(projectId) {
|
||||||
this.getVersionOptions();
|
// 切换项目 清空环境和选中行
|
||||||
|
if (this.$refs.apiList) {
|
||||||
|
this.$refs.apiList.clearEnvAndSelect();
|
||||||
|
}
|
||||||
|
if (this.$refs.apiCaseList) {
|
||||||
|
this.$refs.apiCaseList.clearEnvAndSelect();
|
||||||
|
}
|
||||||
|
this.projectId = projectId;
|
||||||
|
},
|
||||||
|
isApiListEnableChange(data) {
|
||||||
|
this.isApiListEnable = data;
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
open() {
|
|
||||||
this.init();
|
|
||||||
this.$refs.baseRelevance.open();
|
|
||||||
if (this.$refs.apiList) {
|
|
||||||
this.$refs.apiList.clear();
|
|
||||||
}
|
|
||||||
if (this.$refs.apiCaseList) {
|
|
||||||
this.$refs.apiCaseList.clear();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
init() {
|
|
||||||
if (this.$refs.apiList) {
|
|
||||||
this.$refs.apiList.initTable();
|
|
||||||
}
|
|
||||||
if (this.$refs.apiCaseList) {
|
|
||||||
this.$refs.apiCaseList.initTable();
|
|
||||||
}
|
|
||||||
if (this.$refs.nodeTree) {
|
|
||||||
this.$refs.nodeTree.list();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setProject(projectId) {
|
|
||||||
// 切换项目 清空环境和选中行
|
|
||||||
if (this.$refs.apiList) {
|
|
||||||
this.$refs.apiList.clearEnvAndSelect();
|
|
||||||
}
|
|
||||||
if (this.$refs.apiCaseList) {
|
|
||||||
this.$refs.apiCaseList.clearEnvAndSelect();
|
|
||||||
}
|
|
||||||
this.projectId = projectId;
|
|
||||||
},
|
|
||||||
isApiListEnableChange(data) {
|
|
||||||
this.isApiListEnable = data;
|
|
||||||
},
|
|
||||||
|
|
||||||
refresh(data) {
|
refresh(data) {
|
||||||
if (this.isApiListEnable) {
|
if (this.isApiListEnable) {
|
||||||
this.$refs.apiList.initTable(data);
|
this.$refs.apiList.initTable(data);
|
||||||
} else {
|
} else {
|
||||||
this.$refs.apiCaseList.initTable(data);
|
this.$refs.apiCaseList.initTable(data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeChange(node, nodeIds, pNodes) {
|
nodeChange(node, nodeIds, pNodes) {
|
||||||
this.selectNodeIds = nodeIds;
|
if (this.$refs.apiList) {
|
||||||
},
|
this.$refs.apiList.condition.selectAll = false;
|
||||||
handleProtocolChange(protocol) {
|
}
|
||||||
this.currentProtocol = protocol;
|
if (this.$refs.apiCaseList) {
|
||||||
},
|
this.$refs.apiCaseList.condition.selectAll = false;
|
||||||
setModuleOptions(data) {
|
}
|
||||||
this.moduleOptions = data;
|
this.condition.selectAll = false;
|
||||||
},
|
this.selectNodeIds = nodeIds;
|
||||||
|
},
|
||||||
|
handleProtocolChange(protocol) {
|
||||||
|
this.currentProtocol = protocol;
|
||||||
|
},
|
||||||
|
setModuleOptions(data) {
|
||||||
|
this.moduleOptions = data;
|
||||||
|
},
|
||||||
|
|
||||||
saveCaseRelevance() {
|
saveCaseRelevance() {
|
||||||
|
let url = '';
|
||||||
|
let environmentId = undefined;
|
||||||
let url = '';
|
let selectIds = [];
|
||||||
let environmentId = undefined;
|
if (this.isApiListEnable) {
|
||||||
let selectIds = [];
|
//查找所有数据
|
||||||
if (this.isApiListEnable) {
|
let params = this.$refs.apiList.getConditions();
|
||||||
//查找所有数据
|
this.result = this.$post("/api/definition/list/batch", params, (response) => {
|
||||||
let params = this.$refs.apiList.getConditions();
|
let apis = response.data;
|
||||||
this.result = this.$post("/api/definition/list/batch", params, (response) => {
|
url = '/api/definition/relevance';
|
||||||
let apis = response.data;
|
environmentId = this.$refs.apiList.environmentId;
|
||||||
url = '/api/definition/relevance';
|
selectIds = Array.from(apis).map(row => row.id);
|
||||||
environmentId = this.$refs.apiList.environmentId;
|
let protocol = this.$refs.apiList.currentProtocol;
|
||||||
selectIds = Array.from(apis).map(row => row.id);
|
this.postRelevance(url, environmentId, selectIds, protocol);
|
||||||
let protocol = this.$refs.apiList.currentProtocol;
|
|
||||||
this.postRelevance(url, environmentId, selectIds, protocol);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
let params = this.$refs.apiCaseList.getConditions();
|
|
||||||
this.result = this.$post("/api/testcase/get/caseBLOBs/request", params, (response) => {
|
|
||||||
let apiCases = response.data;
|
|
||||||
url = '/api/testcase/relevance';
|
|
||||||
environmentId = this.$refs.apiCaseList.environmentId;
|
|
||||||
selectIds = Array.from(apiCases).map(row => row.id);
|
|
||||||
let protocol = this.$refs.apiCaseList.currentProtocol;
|
|
||||||
this.postRelevance(url, environmentId, selectIds, protocol);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
postRelevance(url, environmentId, selectIds, protocol) {
|
|
||||||
let param = {};
|
|
||||||
if (protocol !== 'DUBBO') {
|
|
||||||
if (!environmentId) {
|
|
||||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
param.planId = this.planId;
|
|
||||||
param.selectIds = selectIds;
|
|
||||||
param.environmentId = environmentId;
|
|
||||||
|
|
||||||
this.result = this.$post(url, param, () => {
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
this.$emit('refresh');
|
|
||||||
this.refresh();
|
|
||||||
this.$refs.baseRelevance.close();
|
|
||||||
});
|
});
|
||||||
},
|
} else {
|
||||||
getVersionOptions() {
|
let params = this.$refs.apiCaseList.getConditions();
|
||||||
if (hasLicense()) {
|
this.result = this.$post("/api/testcase/get/caseBLOBs/request", params, (response) => {
|
||||||
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
|
let apiCases = response.data;
|
||||||
this.versionOptions = response.data;
|
url = '/api/testcase/relevance';
|
||||||
this.versionFilters = response.data.map(u => {
|
environmentId = this.$refs.apiCaseList.environmentId;
|
||||||
return {text: u.name, value: u.id};
|
selectIds = Array.from(apiCases).map(row => row.id);
|
||||||
});
|
let protocol = this.$refs.apiCaseList.currentProtocol;
|
||||||
|
this.postRelevance(url, environmentId, selectIds, protocol);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
postRelevance(url, environmentId, selectIds, protocol) {
|
||||||
|
let param = {};
|
||||||
|
if (protocol !== 'DUBBO') {
|
||||||
|
if (!environmentId) {
|
||||||
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
param.planId = this.planId;
|
||||||
|
param.selectIds = selectIds;
|
||||||
|
param.environmentId = environmentId;
|
||||||
|
|
||||||
|
this.result = this.$post(url, param, () => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.$emit('refresh');
|
||||||
|
this.refresh();
|
||||||
|
this.$refs.baseRelevance.close();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getVersionOptions() {
|
||||||
|
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};
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
},
|
}
|
||||||
changeVersion(currentVersion, type) {
|
},
|
||||||
if (type == 'api') {
|
changeVersion(currentVersion, type) {
|
||||||
this.$refs.apiList.condition.versionId = currentVersion || null;
|
if (type == 'api') {
|
||||||
this.$refs.apiList.initTable();
|
this.$refs.apiList.condition.versionId = currentVersion || null;
|
||||||
} else {
|
this.$refs.apiList.initTable();
|
||||||
this.$refs.apiCaseList.condition.versionId = currentVersion || null;
|
} else {
|
||||||
this.$refs.apiCaseList.initTable();
|
this.$refs.apiCaseList.condition.versionId = currentVersion || null;
|
||||||
}
|
this.$refs.apiCaseList.initTable();
|
||||||
},
|
}
|
||||||
setSelectCounts(data) {
|
},
|
||||||
this.$refs.baseRelevance.selectCounts = data;
|
setSelectCounts(data) {
|
||||||
},
|
this.$refs.baseRelevance.selectCounts = data;
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
/deep/ .select-menu {
|
/deep/ .select-menu {
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .environment-select {
|
/deep/ .environment-select {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -235,6 +235,8 @@ export default {
|
||||||
this.save(param, this);
|
this.save(param, this);
|
||||||
},
|
},
|
||||||
nodeChange(node, nodeIds, nodeNames) {
|
nodeChange(node, nodeIds, nodeNames) {
|
||||||
|
this.page.condition.selectAll = false;
|
||||||
|
this.$refs.table.condition.selectAll = false;
|
||||||
this.selectNodeIds = nodeIds;
|
this.selectNodeIds = nodeIds;
|
||||||
this.selectNodeNames = nodeNames;
|
this.selectNodeNames = nodeNames;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue