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"> :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%"> <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" <ms-component-config
:currentEnvironmentId="currentEnvironmentId" :node="node" :project-list="projectList" :env-map="projectEnvMap" :message="message"
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload" @openScenario="openScenario"/> :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> </span>
</el-tree> </el-tree>
</div> </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"> <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> <template v-slot:header>
<scenario-header :currentScenario="currentScenario" :projectEnvMap="projectEnvMap" <scenario-header
:projectIds.sync="projectIds" :projectList="projectList" :currentScenario="currentScenario"
:scenarioDefinition="scenarioDefinition" :enableCookieShare="enableCookieShare" :projectEnvMap="projectEnvMap"
:projectIds.sync="projectIds"
:projectList="projectList"
:scenarioDefinition="scenarioDefinition"
:enableCookieShare="enableCookieShare"
:onSampleError="onSampleError" :onSampleError="onSampleError"
:execDebug="stopDebug" :execDebug="stopDebug"
:isFullUrl.sync="isFullUrl" @closePage="close" @unFullScreen="unFullScreen" :isFullUrl.sync="isFullUrl"
@showAllBtn="showAllBtn" @runDebug="runDebug" @handleCommand="handleCommand" @setProjectEnvMap="setProjectEnvMap" @closePage="close"
@unFullScreen="unFullScreen"
@showAllBtn="showAllBtn"
@runDebug="runDebug"
@handleCommand="handleCommand"
@setProjectEnvMap="setProjectEnvMap"
@showScenarioParameters="showScenarioParameters" @showScenarioParameters="showScenarioParameters"
@setCookieShare="setCookieShare" @setSampleError="setSampleError" @setCookieShare="setCookieShare"
@setSampleError="setSampleError"
ref="maximizeHeader"/> ref="maximizeHeader"/>
</template> </template>
<maximize-scenario :scenario-definition="scenarioDefinition" :envMap="projectEnvMap" :moduleOptions="moduleOptions" <maximize-scenario
:req-error="reqError" :req-success="reqSuccess" :req-total="reqTotal" :req-total-time="reqTotalTime" :scenario-definition="scenarioDefinition"
:currentScenario="currentScenario" :type="type" :debug="debug" :reloadDebug="reloadDebug" :stepReEnable="stepEnable" ref="maximizeScenario" @openScenario="openScenario"/> :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-drawer>
<ms-change-history ref="changeHistory"/> <ms-change-history ref="changeHistory"/>
@ -468,30 +503,30 @@ export default {
}) })
} }
}, },
editParent(node, status) { evaluationParent(node, status) {
if (!status) { if (!status) {
node.data.code = "error"; node.data.code = "error";
} }
node.data.debug = true; node.data.debug = true;
if (node.parent && node.parent.data && node.parent.data.id) { 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 => { arr.forEach(item => {
if (item.data.resourceId === resourceId) { if (item.data.resourceId === resourceId) {
this.editParent(item.parent, status); this.evaluationParent(item.parent, status);
} }
if (item.childNodes && item.childNodes.length > 0) { 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) { if (this.$refs.stepTree && this.$refs.stepTree.root) {
this.$refs.stepTree.root.childNodes.forEach(item => { this.$refs.stepTree.root.childNodes.forEach(item => {
if (item.childNodes && item.childNodes.length > 0) { 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].requestResult = this.debugResult.get(key);
stepArray[i].result = null; stepArray[i].result = null;
stepArray[i].debug = this.debug; 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) { if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
this.stepSize += stepArray[i].hashTree.length; this.stepSize += stepArray[i].hashTree.length;
@ -1010,7 +1045,7 @@ export default {
this.getEnvironments(); this.getEnvironments();
}, },
allowDrop(draggingNode, dropNode, dropType) { allowDrop(draggingNode, dropNode, dropType) {
if (dropType != "inner" && (draggingNode.data && !draggingNode.data.disabled)) { if (dropType != "inner") {
return true; 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 && !draggingNode.data.disabled) { && ELEMENTS.get(dropNode.data.type).indexOf(draggingNode.data.type) != -1 && !draggingNode.data.disabled) {