feat(测试跟踪、接口测试): 场景用例、接口用例、接口场景在点击模块节点时实时更新节点的数据统计数量
--bug=1016043 --user=宋天阳 【UI测试】场景模块总数和场景列表数量不一致 https://www.tapd.cn/55049933/s/1229521
This commit is contained in:
parent
17d94a74fe
commit
9215c1af1c
|
@ -259,13 +259,48 @@ export default {
|
|||
} else {
|
||||
this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
|
||||
}
|
||||
this.nohupReloadTree(node.data.id);
|
||||
},
|
||||
//后台更新节点数据
|
||||
nohupReloadTree(selectNodeId) {
|
||||
let url = undefined;
|
||||
if (this.isPlanModel) {
|
||||
url = '/api/automation/module/list/plan/' + this.planId;
|
||||
} else if (this.isRelevanceModel) {
|
||||
url = "/api/automation/module/list/" + this.relevanceProjectId;
|
||||
} else if (this.isTrashData) {
|
||||
if (!this.projectId) {
|
||||
return;
|
||||
}
|
||||
url = "/api/automation/module/trash/list/" + this.projectId;
|
||||
} else {
|
||||
if (!this.projectId) {
|
||||
return;
|
||||
}
|
||||
url = "/api/automation/module/list/" + this.projectId;
|
||||
}
|
||||
this.$get(url, response => {
|
||||
if (response.data != undefined && response.data != null) {
|
||||
this.data = response.data;
|
||||
this.data.forEach(node => {
|
||||
node.name = node.name === '未规划场景' ? this.$t('api_test.automation.unplanned_scenario') : node.name
|
||||
buildTree(node, {path: ''});
|
||||
});
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.nodeTree) {
|
||||
this.$refs.nodeTree.filter(this.condition.filterText);
|
||||
if (selectNodeId) {
|
||||
this.$refs.nodeTree.justSetCurrentKey(selectNodeId);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
exportAPI() {
|
||||
this.$emit('exportAPI', this.data);
|
||||
},
|
||||
// debug() {
|
||||
// this.$emit('debug');
|
||||
// },
|
||||
saveAsEdit(data) {
|
||||
this.$emit('saveAsEdit', data);
|
||||
},
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<slot name="header"></slot>
|
||||
|
||||
<ms-node-tree
|
||||
v-if="refreshDataOver"
|
||||
v-loading="result.loading"
|
||||
:tree-nodes="data"
|
||||
:type="isReadOnly ? 'view' : 'edit'"
|
||||
|
@ -70,6 +71,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
result: {},
|
||||
refreshDataOver: true,
|
||||
condition: {
|
||||
protocol: OPTIONS[0].value,
|
||||
filterText: "",
|
||||
|
@ -242,7 +244,6 @@ export default {
|
|||
param.protocol = this.condition.protocol;
|
||||
this.$post("/api/module/edit", param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.list();
|
||||
this.refresh();
|
||||
}, (error) => {
|
||||
this.list();
|
||||
|
@ -283,6 +284,47 @@ export default {
|
|||
} else {
|
||||
this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
|
||||
}
|
||||
this.nohupReloadTree(node.data.id);
|
||||
},
|
||||
nohupReloadTree(selectNodeId) {
|
||||
let url = undefined;
|
||||
if (this.isPlanModel) {
|
||||
url = '/api/module/list/plan/' + this.planId + '/' + this.condition.protocol;
|
||||
} else if (this.isRelevanceModel) {
|
||||
url = "/api/module/list/" + this.relevanceProjectId + "/" + this.condition.protocol +
|
||||
(this.currentVersion ? '/' + this.currentVersion : '');
|
||||
} else if (this.isTrashData) {
|
||||
if (!this.projectId) {
|
||||
return;
|
||||
}
|
||||
url = "/api/module/trash/list/" + this.projectId + "/" + this.condition.protocol +
|
||||
(this.currentVersion ? '/' + this.currentVersion : '');
|
||||
} else {
|
||||
if (!this.projectId) {
|
||||
return;
|
||||
}
|
||||
url = "/api/module/list/" + this.projectId + "/" + this.condition.protocol +
|
||||
(this.currentVersion ? '/' + this.currentVersion : '');
|
||||
}
|
||||
this.$get(url, response => {
|
||||
if (response.data != undefined && response.data != null) {
|
||||
let treeData = response.data;
|
||||
treeData.forEach(node => {
|
||||
node.name = node.name === '未规划接口' ? this.$t('api_test.definition.unplanned_api') : node.name
|
||||
buildTree(node, {path: ''});
|
||||
});
|
||||
this.data = treeData;
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.nodeTree) {
|
||||
this.$refs.nodeTree.filter(this.condition.filterText);
|
||||
if (selectNodeId) {
|
||||
this.$refs.nodeTree.justSetCurrentKey(selectNodeId);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
//创建根目录的模块---供父类使用
|
||||
createRootModel() {
|
||||
|
|
|
@ -209,7 +209,9 @@ export default {
|
|||
},
|
||||
filter(val) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tree.filter(val);
|
||||
if (this.$refs.tree) {
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
});
|
||||
},
|
||||
nodeExpand(data) {
|
||||
|
@ -352,6 +354,9 @@ export default {
|
|||
this.expandedNode.push(param.parentId);
|
||||
this.$emit('add', param);
|
||||
}
|
||||
if (!data.level) {
|
||||
data.level = param.level;
|
||||
}
|
||||
this.$set(data, 'isEdit', false);
|
||||
},
|
||||
remove(node, data) {
|
||||
|
@ -502,6 +507,13 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
justSetCurrentKey(id) {
|
||||
if (id) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tree.setCurrentKey(id);
|
||||
})
|
||||
}
|
||||
},
|
||||
isDefault(data) {
|
||||
return data.name === this.defaultLabel && data.level === 1;
|
||||
},
|
||||
|
|
|
@ -147,12 +147,12 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
addTestCase(){
|
||||
addTestCase() {
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
this.$refs.testCaseCreate.open(this.currentModule)
|
||||
this.$refs.testCaseCreate.open(this.currentModule)
|
||||
},
|
||||
filter() {
|
||||
this.$refs.nodeTree.filter(this.condition.filterText);
|
||||
|
@ -251,7 +251,7 @@ export default {
|
|||
openExport() {
|
||||
this.$refs.testCaseExport.open();
|
||||
},
|
||||
exportTestCase(type, param){
|
||||
exportTestCase(type, param) {
|
||||
this.$emit('exportTestCase', type, param);
|
||||
},
|
||||
remove(nodeIds) {
|
||||
|
@ -278,7 +278,6 @@ export default {
|
|||
this.$store.commit('setTestCaseModuleOptions', moduleOptions);
|
||||
},
|
||||
nodeChange(node, nodeIds, pNodes) {
|
||||
|
||||
this.$store.commit('setTestCaseSelectNode', node);
|
||||
this.$store.commit('setTestCaseSelectNodeIds', nodeIds);
|
||||
this.condition.trashEnable = false;
|
||||
|
@ -287,11 +286,32 @@ export default {
|
|||
this.currentNode = node;
|
||||
|
||||
this.$emit("nodeSelectEvent", node, node.data.id === 'root' ? [] : nodeIds, pNodes);
|
||||
this.nohupReloadTree(node.data.id);
|
||||
},
|
||||
nohupReloadTree(selectNodeId) {
|
||||
if (this.projectId) {
|
||||
this.caseCondition.casePublic = false;
|
||||
getTestCaseNodesByCaseFilter(this.projectId, this.caseCondition, data => {
|
||||
this.treeNodes = data;
|
||||
this.treeNodes.forEach(node => {
|
||||
node.name = node.name === '未规划用例' ? this.$t('api_test.unplanned_case') : node.name
|
||||
buildTree(node, {path: ''});
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.nodeTree) {
|
||||
this.$refs.nodeTree.filter(this.condition.filterText);
|
||||
if (selectNodeId) {
|
||||
this.$refs.nodeTree.justSetCurrentKey(selectNodeId);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
openMinderConfirm() {
|
||||
let isTestCaseMinderChanged = this.$store.state.isTestCaseMinderChanged;
|
||||
if (isTestCaseMinderChanged) {
|
||||
this.$refs.isChangeConfirm.open();
|
||||
this.$refs.isChangeConfirm.open();
|
||||
}
|
||||
return isTestCaseMinderChanged;
|
||||
},
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
<template>
|
||||
<ms-node-tree class="node-tree"
|
||||
v-loading="result.loading"
|
||||
local-suffix="test_case"
|
||||
default-label="未规划用例"
|
||||
@nodeSelectEvent="publicNodeChange"
|
||||
:tree-nodes="trashTreeNodes"
|
||||
ref="trashNodeTree"/>
|
||||
v-loading="result.loading"
|
||||
local-suffix="test_case"
|
||||
default-label="未规划用例"
|
||||
@nodeSelectEvent="publicNodeChange"
|
||||
:tree-nodes="trashTreeNodes"
|
||||
ref="trashNodeTree"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsNodeTree from "@/business/components/track/common/NodeTree";
|
||||
import {getTestCaseTrashNodes} from "@/network/testCase";
|
||||
|
||||
export default {
|
||||
name: "TestCaseTrashNodeTree",
|
||||
components: {MsNodeTree},
|
||||
|
@ -26,6 +27,26 @@ export default {
|
|||
methods: {
|
||||
publicNodeChange(node, nodeIds, pNodes) {
|
||||
this.$emit("nodeSelectEvent", node, node.data.id === 'root' ? [] : nodeIds, pNodes);
|
||||
this.nohupReloadTree(node.data.id);
|
||||
},
|
||||
nohupReloadTree(selectNodeId) {
|
||||
getTestCaseTrashNodes(this.caseCondition, data => {
|
||||
if (data && data.length > 0) {
|
||||
this.trashTreeNodes = data[0].children;
|
||||
} else {
|
||||
this.trashTreeNodes = [];
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.trashNodeTree) {
|
||||
this.trashTreeNodes.forEach(firstLevel => {
|
||||
this.$refs.trashNodeTree.nodeExpand(firstLevel);
|
||||
})
|
||||
}
|
||||
if (selectNodeId) {
|
||||
this.$refs.trashNodeTree.justSetCurrentKey(selectNodeId);
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
list() {
|
||||
this.result = getTestCaseTrashNodes(this.caseCondition, data => {
|
||||
|
@ -36,7 +57,7 @@ export default {
|
|||
}
|
||||
if (this.$refs.trashNodeTree) {
|
||||
this.trashTreeNodes.forEach(firstLevel => {
|
||||
this.$refs.trashNodeTree.nodeExpand(firstLevel);
|
||||
this.$refs.trashNodeTree.nodeExpand(firstLevel);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue