fix(接口自动化): 优化步骤全展开,当步骤过多时只展开数不展开详情 #1004907

This commit is contained in:
fit2-zhao 2021-07-13 17:26:02 +08:00 committed by fit2-zhao
parent 211348c6af
commit 3329a1c96e
1 changed files with 15 additions and 22 deletions

View File

@ -414,7 +414,8 @@ export default {
reqTotalTime: 0, reqTotalTime: 0,
reloadDebug: "", reloadDebug: "",
stopDebug: "", stopDebug: "",
isTop: false isTop: false,
stepSize: 0,
} }
}, },
created() { created() {
@ -714,6 +715,7 @@ export default {
} }
if (arr[i].hashTree !== undefined && arr[i].hashTree.length > 0) { if (arr[i].hashTree !== undefined && arr[i].hashTree.length > 0) {
this.stepSize += arr[i].hashTree.length;
this.recursiveSorting(arr[i].hashTree, arr[i].projectId); this.recursiveSorting(arr[i].hashTree, arr[i].projectId);
} }
// debug // debug
@ -727,6 +729,7 @@ export default {
} }
}, },
sort() { sort() {
this.stepSize = this.scenarioDefinition.length;
for (let i in this.scenarioDefinition) { for (let i in this.scenarioDefinition) {
// //
this.scenarioDefinition[i].index = Number(i) + 1; this.scenarioDefinition[i].index = Number(i) + 1;
@ -749,6 +752,7 @@ export default {
} }
if (this.scenarioDefinition[i].hashTree !== undefined && this.scenarioDefinition[i].hashTree.length > 0) { if (this.scenarioDefinition[i].hashTree !== undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.stepSize += this.scenarioDefinition[i].hashTree.length;
this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId); this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId);
} }
// debug // debug
@ -757,6 +761,7 @@ export default {
this.scenarioDefinition[i].requestResult = this.debugResult.get(this.scenarioDefinition[i].id + this.scenarioDefinition[i].name); this.scenarioDefinition[i].requestResult = this.debugResult.get(this.scenarioDefinition[i].id + this.scenarioDefinition[i].name);
this.scenarioDefinition[i].debug = this.debug; this.scenarioDefinition[i].debug = this.debug;
} }
} }
}, },
addCustomizeApi(request) { addCustomizeApi(request) {
@ -1199,14 +1204,13 @@ export default {
shrinkTreeNode() { shrinkTreeNode() {
// //
for (let i in this.scenarioDefinition) { for (let i in this.scenarioDefinition) {
if (i > 30 && this.expandedStatus) {
continue;
}
if (this.scenarioDefinition[i]) { if (this.scenarioDefinition[i]) {
if (this.expandedStatus && this.expandedNode.indexOf(this.scenarioDefinition[i].resourceId) === -1) { if (this.expandedStatus && this.expandedNode.indexOf(this.scenarioDefinition[i].resourceId) === -1) {
this.expandedNode.push(this.scenarioDefinition[i].resourceId); this.expandedNode.push(this.scenarioDefinition[i].resourceId);
} }
this.scenarioDefinition[i].active = this.expandedStatus; if (this.stepSize < 35) {
this.scenarioDefinition[i].active = this.expandedStatus;
}
if (this.scenarioDefinition[i].hashTree && this.scenarioDefinition[i].hashTree.length > 0) { if (this.scenarioDefinition[i].hashTree && this.scenarioDefinition[i].hashTree.length > 0) {
this.changeNodeStatus(this.scenarioDefinition[i].hashTree); this.changeNodeStatus(this.scenarioDefinition[i].hashTree);
} }
@ -1219,7 +1223,9 @@ export default {
if (this.expandedStatus) { if (this.expandedStatus) {
this.expandedNode.push(nodes[i].resourceId); this.expandedNode.push(nodes[i].resourceId);
} }
nodes[i].active = this.expandedStatus; if (this.stepSize < 35) {
nodes[i].active = this.expandedStatus;
}
if (nodes[i].hashTree != undefined && nodes[i].hashTree.length > 0) { if (nodes[i].hashTree != undefined && nodes[i].hashTree.length > 0) {
this.changeNodeStatus(nodes[i].hashTree); this.changeNodeStatus(nodes[i].hashTree);
} }
@ -1227,22 +1233,9 @@ export default {
} }
}, },
openExpansion() { openExpansion() {
if (this.scenarioDefinition && this.scenarioDefinition.length > 30) { this.expandedNode = [];
this.$alert(this.$t('api_test.definition.request.step_message'), '', { this.expandedStatus = true;
confirmButtonText: this.$t('commons.confirm'), this.shrinkTreeNode();
callback: (action) => {
if (action === 'confirm') {
this.expandedNode = [];
this.expandedStatus = true;
this.shrinkTreeNode();
}
}
});
} else {
this.expandedNode = [];
this.expandedStatus = true;
this.shrinkTreeNode();
}
}, },
closeExpansion() { closeExpansion() {
this.expandedStatus = false; this.expandedStatus = false;