fix (接口自动化):修复引用步骤不能移动问题

This commit is contained in:
fit2-zhao 2021-07-30 16:35:23 +08:00 committed by fit2-zhao
parent 9ebb834878
commit e6bffa7436
1 changed files with 60 additions and 25 deletions

View File

@ -198,9 +198,22 @@
:allow-drop="allowDrop" @node-drag-end="allowDrag" @node-click="nodeClick" v-if="!loading" draggable ref="stepTree">
<span class="custom-tree-node father" slot-scope="{ node, data}" style="width: 96%">
<!-- 步骤组件-->
<ms-component-config :message="message" :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario" :expandedNode="expandedNode"
:currentEnvironmentId="currentEnvironmentId" :node="node" :project-list="projectList" :env-map="projectEnvMap"
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload" @openScenario="openScenario"/>
<ms-component-config
:message="message"
:type="data.type"
:scenario="data"
:response="response"
:currentScenario="currentScenario"
:expandedNode="expandedNode"
:currentEnvironmentId="currentEnvironmentId"
:node="node"
:project-list="projectList"
:env-map="projectEnvMap"
@remove="remove"
@copyRow="copyRow"
@suggestClick="suggestClick"
@refReload="refReload"
@openScenario="openScenario"/>
</span>
</el-tree>
</div>
@ -260,21 +273,43 @@
<!--步骤最大化-->
<ms-drawer :visible="drawer" :size="100" @close="close" direction="default" :show-full-screen="false" :is-show-close="false" style="overflow: hidden">
<template v-slot:header>
<scenario-header :currentScenario="currentScenario" :projectEnvMap="projectEnvMap"
:projectIds.sync="projectIds" :projectList="projectList"
:scenarioDefinition="scenarioDefinition" :enableCookieShare="enableCookieShare"
:onSampleError="onSampleError"
:execDebug="stopDebug"
:isFullUrl.sync="isFullUrl" @closePage="close" @unFullScreen="unFullScreen"
@showAllBtn="showAllBtn" @runDebug="runDebug" @handleCommand="handleCommand" @setProjectEnvMap="setProjectEnvMap"
@showScenarioParameters="showScenarioParameters"
@setCookieShare="setCookieShare" @setSampleError="setSampleError"
ref="maximizeHeader"/>
<scenario-header
:currentScenario="currentScenario"
:projectEnvMap="projectEnvMap"
:projectIds.sync="projectIds"
:projectList="projectList"
:scenarioDefinition="scenarioDefinition"
:enableCookieShare="enableCookieShare"
:onSampleError="onSampleError"
:execDebug="stopDebug"
:isFullUrl.sync="isFullUrl"
@closePage="close"
@unFullScreen="unFullScreen"
@showAllBtn="showAllBtn"
@runDebug="runDebug"
@handleCommand="handleCommand"
@setProjectEnvMap="setProjectEnvMap"
@showScenarioParameters="showScenarioParameters"
@setCookieShare="setCookieShare"
@setSampleError="setSampleError"
ref="maximizeHeader"/>
</template>
<maximize-scenario :scenario-definition="scenarioDefinition" :envMap="projectEnvMap" :moduleOptions="moduleOptions"
:req-error="reqError" :req-success="reqSuccess" :req-total="reqTotal" :req-total-time="reqTotalTime"
:currentScenario="currentScenario" :type="type" :debug="debug" :reloadDebug="reloadDebug" :stepReEnable="stepEnable" ref="maximizeScenario" @openScenario="openScenario"/>
<maximize-scenario
:scenario-definition="scenarioDefinition"
:envMap="projectEnvMap"
:moduleOptions="moduleOptions"
:req-error="reqError"
:req-success="reqSuccess"
:req-total="reqTotal"
:req-total-time="reqTotalTime"
:currentScenario="currentScenario"
:type="type"
:debug="debug"
:reloadDebug="reloadDebug"
:stepReEnable="stepEnable"
@openScenario="openScenario"
ref="maximizeScenario"/>
</ms-drawer>
<ms-change-history ref="changeHistory"/>
@ -468,30 +503,30 @@ export default {
})
}
},
editParent(node, status) {
evaluationParent(node, status) {
if (!status) {
node.data.code = "error";
}
node.data.debug = true;
if (node.parent && node.parent.data && node.parent.data.id) {
this.editParent(node.parent, status);
this.evaluationParent(node.parent, status);
}
},
findNodeChild(arr, resourceId, status) {
resultEvaluationChild(arr, resourceId, status) {
arr.forEach(item => {
if (item.data.resourceId === resourceId) {
this.editParent(item.parent, status);
this.evaluationParent(item.parent, status);
}
if (item.childNodes && item.childNodes.length > 0) {
this.findNodeChild(item.childNodes, resourceId, status);
this.resultEvaluationChild(item.childNodes, resourceId, status);
}
})
},
findNode(resourceId, status) {
resultEvaluation(resourceId, status) {
if (this.$refs.stepTree && this.$refs.stepTree.root) {
this.$refs.stepTree.root.childNodes.forEach(item => {
if (item.childNodes && item.childNodes.length > 0) {
this.findNodeChild(item.childNodes, resourceId, status);
this.resultEvaluationChild(item.childNodes, resourceId, status);
}
})
}
@ -779,7 +814,7 @@ export default {
stepArray[i].requestResult = this.debugResult.get(key);
stepArray[i].result = null;
stepArray[i].debug = this.debug;
this.findNode(key, stepArray[i].requestResult[0].success);
this.resultEvaluation(key, stepArray[i].requestResult[0].success);
}
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
this.stepSize += stepArray[i].hashTree.length;
@ -1010,7 +1045,7 @@ export default {
this.getEnvironments();
},
allowDrop(draggingNode, dropNode, dropType) {
if (dropType != "inner" && (draggingNode.data && !draggingNode.data.disabled)) {
if (dropType != "inner") {
return true;
} else if (dropType === "inner" && dropNode.data.referenced !== 'REF' && dropNode.data.referenced !== 'Deleted'
&& ELEMENTS.get(dropNode.data.type).indexOf(draggingNode.data.type) != -1 && !draggingNode.data.disabled) {