feat(版本对比): 接口自动化手动对比版本

--user=郭雨琦 接口自动化手动对比版本
This commit is contained in:
guoyuqi 2022-01-13 17:41:13 +08:00 committed by 刘瑞斌
parent c1f48bdbdd
commit aa0f3d2d26
2 changed files with 35 additions and 55 deletions

View File

@ -266,7 +266,7 @@ export default {
font-size: 13px; font-size: 13px;
margin: 0 5px; margin: 0 5px;
/*overflow-x: hidden;*/ /*overflow-x: hidden;*/
overflow-x: scroll; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;
padding-bottom: 0; padding-bottom: 0;
/*text-overflow: ellipsis;*/ /*text-overflow: ellipsis;*/
@ -274,6 +274,10 @@ export default {
white-space: nowrap; white-space: nowrap;
width: calc(100% - 25rem); width: calc(100% - 25rem);
height: auto; height: auto;
scrollbar-width: thin;
scrollbar-color: transparent transparent;
scrollbar-track-color: transparent;
-ms-scrollbar-track-color: transparent;
} }
.scenario-name::-webkit-scrollbar .scenario-name::-webkit-scrollbar
{ {

View File

@ -142,6 +142,7 @@
highlight-current highlight-current
@node-expand="nodeExpand(oldScenarioDefinition,null,'old')" @node-expand="nodeExpand(oldScenarioDefinition,null,'old')"
@node-collapse="nodeCollapse(oldScenarioDefinition,null,'old')" @node-collapse="nodeCollapse(oldScenarioDefinition,null,'old')"
@node-click="oldNodeClick"
draggable ref="stepTree"> 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%">
<!-- 步骤组件--> <!-- 步骤组件-->
@ -298,13 +299,14 @@
<el-tooltip :content="$t('api_test.automation.close_expansion')" placement="top" effect="light"> <el-tooltip :content="$t('api_test.automation.close_expansion')" placement="top" effect="light">
<i class="el-icon-remove-outline ms-open-btn" size="mini" @click="closeExpansion('new')"/> <i class="el-icon-remove-outline ms-open-btn" size="mini" @click="closeExpansion('new')"/>
</el-tooltip> </el-tooltip>
<el-tree node-key="resourceId" :props="props" :data="newScenarioDefinition" class="ms-tree" <el-tree node-key="newResourceId" :props="props" :data="newScenarioDefinition" class="ms-tree"
:default-expanded-keys="newExpandedNode"
:expand-on-click-node="false" :expand-on-click-node="false"
:default-expanded-keys="newExpandedNode"
highlight-current highlight-current
@node-expand="nodeExpand" @node-expand="nodeExpand"
@node-collapse="nodeCollapse" @node-collapse="nodeCollapse"
draggable ref="stepTree" > @node-click="nodeClick"
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 <ms-component-config
@ -412,6 +414,8 @@ export default{
oldExpandedNode:[], oldExpandedNode:[],
newExpandedNode:[], newExpandedNode:[],
stepEnable:true, stepEnable:true,
currentLeftChild:undefined,
currentRightChild:undefined,
} }
@ -535,57 +539,6 @@ export default{
} }
this.stepStatus(scenarioDefinition); this.stepStatus(scenarioDefinition);
}, },
sort(stepArray, scenarioProjectId, fullPath,source) {
if (!stepArray) {
if(source==='new'){
stepArray = this.newScenarioDefinition;
}else {
stepArray = this.oldScenarioDefinition;
}
}
for (let i in stepArray) {
stepArray[i].index = Number(i) + 1;
if (!stepArray[i].resourceId) {
stepArray[i].resourceId = getUUID();
}
//
if (stepArray[i].type === "HTTPSamplerProxy" && !stepArray[i].headers) {
stepArray[i].headers = [new KeyValue()];
}
if (stepArray[i].type === ELEMENT_TYPE.LoopController
&& stepArray[i].loopType === "LOOP_COUNT"
&& stepArray[i].hashTree
&& stepArray[i].hashTree.length > 1) {
stepArray[i].countController.proceed = true;
}
if (!stepArray[i].clazzName) {
stepArray[i].clazzName = TYPE_TO_C.get(stepArray[i].type);
}
if (stepArray[i] && stepArray[i].authManager && !stepArray[i].authManager.clazzName) {
stepArray[i].authManager.clazzName = TYPE_TO_C.get(stepArray[i].authManager.type);
}
if (!stepArray[i].projectId) {
// IDIDIDID
stepArray[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
} else {
const project = this.projectList.find(p => p.id === stepArray[i].projectId);
if (!project) {
stepArray[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
}
}
// debug
stepArray[i].parentIndex = fullPath ? fullPath + "_" + stepArray[i].index : stepArray[i].index;
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
this.stepSize += stepArray[i].hashTree.length;
this.sort(stepArray[i].hashTree, stepArray[i].projectId, stepArray[i].parentIndex);
}
}
},
allowDrag(draggingNode, dropNode, dropType,source) {
if (dropNode && draggingNode && dropType) {
this.sort(null,null,null,source);
}
},
nodeExpand(data, node,source) { nodeExpand(data, node,source) {
if(source==="new"){ if(source==="new"){
if (data && data.resourceId && this.newExpandedNode.indexOf(data.resourceId) === -1) { if (data && data.resourceId && this.newExpandedNode.indexOf(data.resourceId) === -1) {
@ -607,6 +560,26 @@ export default{
} }
} }
}, },
nodeClick(data, node,source) {
this.$store.state.selectStep = data;
console.log(source)
this.currentRightChild = source;
if(this.currentLeftChild){
diff(this.currentLeftChild,this.currentRightChild);
this.currentLeftChild = undefined;
this.currentRightChild = undefined;
}
},
oldNodeClick(data, node,source) {
this.$store.state.selectStep = data;
console.log(source)
this.currentLeftChild = source;
if(this.currentRightChild){
diff(this.currentLeftChild,this.currentRightChild);
this.currentLeftChild = undefined;
this.currentRightChild = undefined;
}
},
}, },
created() { created() {
@ -625,4 +598,7 @@ export default{
display: flex; display: flex;
justify-content:space-between; justify-content:space-between;
} }
.border-config{
border: 1px solid red;
}
</style> </style>