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>
|
||||
|
||||
import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
|
||||
import MsApiModule from "../../../../../api/definition/components/module/ApiModule";
|
||||
import RelevanceApiList from "../../../../../api/automation/scenario/api/RelevanceApiList";
|
||||
import RelevanceCaseList from "../../../../../api/automation/scenario/api/RelevanceCaseList";
|
||||
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") : {};
|
||||
import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
|
||||
import MsApiModule from "../../../../../api/definition/components/module/ApiModule";
|
||||
import RelevanceApiList from "../../../../../api/automation/scenario/api/RelevanceApiList";
|
||||
import RelevanceCaseList from "../../../../../api/automation/scenario/api/RelevanceCaseList";
|
||||
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestCaseApiRelevance",
|
||||
components: {
|
||||
RelevanceCaseList,
|
||||
RelevanceApiList,
|
||||
MsApiModule,
|
||||
TestCaseRelevanceBase,
|
||||
'VersionSelect': VersionSelect.default,
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
|
||||
|
||||
export default {
|
||||
name: "TestCaseApiRelevance",
|
||||
components: {
|
||||
RelevanceCaseList,
|
||||
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() {
|
||||
return {
|
||||
showCasePage: true,
|
||||
currentProtocol: null,
|
||||
currentModule: null,
|
||||
selectNodeIds: [],
|
||||
moduleOptions: {},
|
||||
trashEnable: false,
|
||||
isApiListEnable: true,
|
||||
condition: {},
|
||||
currentRow: {},
|
||||
projectId: "",
|
||||
versionFilters: [],
|
||||
};
|
||||
versionEnable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
planId() {
|
||||
this.condition.planId = this.planId;
|
||||
},
|
||||
props: {
|
||||
planId: {
|
||||
type: String
|
||||
},
|
||||
versionEnable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
mounted() {
|
||||
this.getVersionOptions();
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.init();
|
||||
this.$refs.baseRelevance.open();
|
||||
if (this.$refs.apiList) {
|
||||
this.$refs.apiList.clear();
|
||||
}
|
||||
if (this.$refs.apiCaseList) {
|
||||
this.$refs.apiCaseList.clear();
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
planId() {
|
||||
this.condition.planId = this.planId;
|
||||
},
|
||||
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();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getVersionOptions();
|
||||
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;
|
||||
},
|
||||
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) {
|
||||
if (this.isApiListEnable) {
|
||||
this.$refs.apiList.initTable(data);
|
||||
} else {
|
||||
this.$refs.apiCaseList.initTable(data);
|
||||
}
|
||||
},
|
||||
refresh(data) {
|
||||
if (this.isApiListEnable) {
|
||||
this.$refs.apiList.initTable(data);
|
||||
} else {
|
||||
this.$refs.apiCaseList.initTable(data);
|
||||
}
|
||||
},
|
||||
|
||||
nodeChange(node, nodeIds, pNodes) {
|
||||
this.selectNodeIds = nodeIds;
|
||||
},
|
||||
handleProtocolChange(protocol) {
|
||||
this.currentProtocol = protocol;
|
||||
},
|
||||
setModuleOptions(data) {
|
||||
this.moduleOptions = data;
|
||||
},
|
||||
nodeChange(node, nodeIds, pNodes) {
|
||||
if (this.$refs.apiList) {
|
||||
this.$refs.apiList.condition.selectAll = false;
|
||||
}
|
||||
if (this.$refs.apiCaseList) {
|
||||
this.$refs.apiCaseList.condition.selectAll = false;
|
||||
}
|
||||
this.condition.selectAll = false;
|
||||
this.selectNodeIds = nodeIds;
|
||||
},
|
||||
handleProtocolChange(protocol) {
|
||||
this.currentProtocol = protocol;
|
||||
},
|
||||
setModuleOptions(data) {
|
||||
this.moduleOptions = data;
|
||||
},
|
||||
|
||||
saveCaseRelevance() {
|
||||
|
||||
|
||||
let url = '';
|
||||
let environmentId = undefined;
|
||||
let selectIds = [];
|
||||
if (this.isApiListEnable) {
|
||||
//查找所有数据
|
||||
let params = this.$refs.apiList.getConditions();
|
||||
this.result = this.$post("/api/definition/list/batch", params, (response) => {
|
||||
let apis = response.data;
|
||||
url = '/api/definition/relevance';
|
||||
environmentId = this.$refs.apiList.environmentId;
|
||||
selectIds = Array.from(apis).map(row => row.id);
|
||||
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();
|
||||
saveCaseRelevance() {
|
||||
let url = '';
|
||||
let environmentId = undefined;
|
||||
let selectIds = [];
|
||||
if (this.isApiListEnable) {
|
||||
//查找所有数据
|
||||
let params = this.$refs.apiList.getConditions();
|
||||
this.result = this.$post("/api/definition/list/batch", params, (response) => {
|
||||
let apis = response.data;
|
||||
url = '/api/definition/relevance';
|
||||
environmentId = this.$refs.apiList.environmentId;
|
||||
selectIds = Array.from(apis).map(row => row.id);
|
||||
let protocol = this.$refs.apiList.currentProtocol;
|
||||
this.postRelevance(url, environmentId, selectIds, protocol);
|
||||
});
|
||||
},
|
||||
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};
|
||||
});
|
||||
} 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();
|
||||
});
|
||||
},
|
||||
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') {
|
||||
this.$refs.apiList.condition.versionId = currentVersion || null;
|
||||
this.$refs.apiList.initTable();
|
||||
} else {
|
||||
this.$refs.apiCaseList.condition.versionId = currentVersion || null;
|
||||
this.$refs.apiCaseList.initTable();
|
||||
}
|
||||
},
|
||||
setSelectCounts(data) {
|
||||
this.$refs.baseRelevance.selectCounts = data;
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
changeVersion(currentVersion, type) {
|
||||
if (type == 'api') {
|
||||
this.$refs.apiList.condition.versionId = currentVersion || null;
|
||||
this.$refs.apiList.initTable();
|
||||
} else {
|
||||
this.$refs.apiCaseList.condition.versionId = currentVersion || null;
|
||||
this.$refs.apiCaseList.initTable();
|
||||
}
|
||||
},
|
||||
setSelectCounts(data) {
|
||||
this.$refs.baseRelevance.selectCounts = data;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
/deep/ .select-menu {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
/deep/ .select-menu {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
/deep/ .environment-select {
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
/deep/ .environment-select {
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -235,6 +235,8 @@ export default {
|
|||
this.save(param, this);
|
||||
},
|
||||
nodeChange(node, nodeIds, nodeNames) {
|
||||
this.page.condition.selectAll = false;
|
||||
this.$refs.table.condition.selectAll = false;
|
||||
this.selectNodeIds = nodeIds;
|
||||
this.selectNodeNames = nodeNames;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue