fix(接口定义): 修复步骤中的结果显示错误

refactor: 优化项目创建相关代码
This commit is contained in:
fit2-zhao 2021-06-07 11:34:00 +08:00 committed by fit2-zhao
parent 09d957ddae
commit 3182e52b4f
4 changed files with 2343 additions and 2345 deletions

View File

@ -106,7 +106,7 @@
res.scenarios.forEach(item => {
if (item && item.requestResults) {
item.requestResults.forEach(req => {
resMap.set(req.id, req);
resMap.set(req.id + req.name, req);
req.name = item.name + "^@~@^" + req.name + "UUID=" + getUUID();
array.push(req);
})

View File

@ -667,12 +667,12 @@
}
}
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
if (arr[i].hashTree !== undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree, arr[i].projectId);
}
// debug
if (this.debugResult && this.debugResult.get(arr[i].id)) {
arr[i].requestResult = this.debugResult.get(arr[i].id);
if (this.debugResult && this.debugResult.get(arr[i].id + arr[i].name)) {
arr[i].requestResult = this.debugResult.get(arr[i].id + arr[i].name);
}
}
},
@ -698,19 +698,19 @@
}
}
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.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId);
}
// debug
if (this.debugResult && this.debugResult.get(this.scenarioDefinition[i].id)) {
this.scenarioDefinition[i].requestResult = this.debugResult.get(this.scenarioDefinition[i].id);
if (this.debugResult && 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);
}
}
},
addCustomizeApi(request) {
this.customizeVisible = false;
request.enable === undefined ? request.enable = true : request.enable;
if (this.selectedTreeNode != undefined) {
if (this.selectedTreeNode !== undefined) {
this.selectedTreeNode.hashTree.push(request);
} else {
this.scenarioDefinition.push(request);
@ -730,7 +730,7 @@
item.hashTree = [];
}
item.enable === undefined ? item.enable = true : item.enable;
if (this.selectedTreeNode != undefined) {
if (this.selectedTreeNode !== undefined) {
this.selectedTreeNode.hashTree.push(item);
} else {
this.scenarioDefinition.push(item);
@ -768,7 +768,7 @@
if (referenced === 'REF' || !request.hashTree) {
request.hashTree = [];
}
if (this.selectedTreeNode != undefined) {
if (this.selectedTreeNode !== undefined) {
this.selectedTreeNode.hashTree.push(request);
} else {
this.scenarioDefinition.push(request);
@ -802,7 +802,7 @@
if (action === 'confirm') {
const parent = node.parent
const hashTree = parent.data.hashTree || parent.data;
const index = hashTree.findIndex(d => d.resourceId != undefined && row.resourceId != undefined && d.resourceId === row.resourceId)
const index = hashTree.findIndex(d => d.resourceId !== undefined && row.resourceId !== undefined && d.resourceId === row.resourceId)
hashTree.splice(index, 1);
this.sort();
this.reload();
@ -820,7 +820,7 @@
obj.name = obj.name + '_copy';
}
const index = hashTree.findIndex(d => d.resourceId === row.resourceId);
if (index != -1) {
if (index !== -1) {
hashTree.splice(index + 1, 0, obj);
} else {
hashTree.push(obj);
@ -912,8 +912,7 @@
allowDrop(draggingNode, dropNode, dropType) {
if (dropType != "inner") {
return true;
}
else if (dropType === "inner" && dropNode.data.referenced != 'REF' && dropNode.data.referenced != 'Deleted'
} else if (dropType === "inner" && dropNode.data.referenced !== 'REF' && dropNode.data.referenced !== 'Deleted'
&& ELEMENTS.get(dropNode.data.type).indexOf(draggingNode.data.type) != -1) {
return true;
}

View File

@ -336,10 +336,10 @@ export default {
if (this.node) {
this.node.expanded = this.request.active;
}
if (this.node.expanded && this.expandedNode.indexOf(this.request.resourceId) === -1) {
if (this.node.expanded && this.expandedNode && this.expandedNode.indexOf(this.request.resourceId) === -1) {
this.expandedNode.push(this.request.resourceId);
} else {
if (this.expandedNode.indexOf(this.request.resourceId) !== -1) {
if (this.expandedNode && this.expandedNode.indexOf(this.request.resourceId) !== -1) {
this.expandedNode.splice(this.expandedNode.indexOf(this.request.resourceId), 1);
}
}

View File

@ -516,8 +516,8 @@
this.recursiveSorting(arr[i].hashTree, arr[i].projectId);
}
// debug
if (this.debugResult && this.debugResult.get(arr[i].id)) {
arr[i].requestResult = this.debugResult.get(arr[i].id);
if (this.debugResult && this.debugResult.get(arr[i].id + arr[i].name)) {
arr[i].requestResult = this.debugResult.get(arr[i].id + arr[i].name);
}
}
},
@ -539,8 +539,8 @@
this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId);
}
// debug
if (this.debugResult && this.debugResult.get(this.scenarioDefinition[i].id)) {
this.scenarioDefinition[i].requestResult = this.debugResult.get(this.scenarioDefinition[i].id);
if (this.debugResult && 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);
}
}
},
@ -740,8 +740,7 @@
allowDrop(draggingNode, dropNode, dropType) {
if (dropType != "inner") {
return true;
}
else if (dropType === "inner" && dropNode.data.referenced != 'REF' && dropNode.data.referenced != 'Deleted'
} else if (dropType === "inner" && dropNode.data.referenced !== 'REF' && dropNode.data.referenced !== 'Deleted'
&& ELEMENTS.get(dropNode.data.type).indexOf(draggingNode.data.type) != -1) {
return true;
}