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

--user=郭雨琦 接口自动化手动对比版本在原来的弹框上加一个弹窗
This commit is contained in:
guoyuqi 2022-01-13 19:16:13 +08:00 committed by 刘瑞斌
parent 3313583e64
commit 154a4297d2
2 changed files with 138 additions and 13 deletions

View File

@ -0,0 +1,89 @@
<template>
<div class="compare-class">
<el-card ref="old" style="width: 50%">
<ms-component-config
:type="oldData.type"
:scenario="oldData"
:node="oldNode"
:env-map="oldProjectEnvMap"
:show-version="false"
/>
</el-card>
<el-card ref="new" style="width: 50%">
<ms-component-config
:type="newData.type"
:scenario="newData"
:node="newNode"
:env-map="newProjectEnvMap"
:show-version="false"
/>
</el-card>
</div>
</template>
<script>
import MsComponentConfig from "@/business/components/api/automation/scenario/component/ComponentConfig";
const {diff} = require("@/business/components/performance/v_node_diff");
export default{
name:"ScenarioChildDiff",
props:{
oldData:{
},
oldNode:{
},
oldProjectEnvMap:{
},
newData:{
},
newNode:{
},
newProjectEnvMap:{
},
oldVNode:{
},
newVNode:{}
},
components:{
MsComponentConfig,
},
data(){
return{
showData:false,
currentItervalID:'',
}
},
methods:{
getDiff(){
let oldVnode = this.$refs.old
let vnode = this.$refs.new
diff(oldVnode,vnode)
},
getVnode(){
let oldVnode = this.$refs.old
let vnode = this.$refs.new
if(oldVnode&&vnode){
window.clearInterval(this.currentItervalID);
this.getDiff()
}
}
},
created() {
},
mounted() {
this.$nextTick(function () {
this.currentItervalID = window.setInterval(this.getVnode, 1000);
})
}
}
</script>
<style scoped>
.compare-class{
display: flex;
justify-content:space-between;
}
</style>

View File

@ -327,6 +327,23 @@
</div> </div>
</el-card> </el-card>
</el-card> </el-card>
<el-dialog
:fullscreen="true"
:visible.sync="dialogVisible"
append-to-body
width="100%"
>
<scenario-child-diff
:old-data="leftChildData"
:new-data="rightChildData"
:old-node="leftChildNode"
:new-node="rightChildNode"
:old-project-env-map="projectEnvMap"
:new-project-env-map="newProjectEnvMap"
:old-v-node="leftChildVnode"
:new-v-node="rightChildVnode"
></scenario-child-diff>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -335,6 +352,7 @@ import {API_STATUS, PRIORITY} from "@/business/components/api/definition/model/J
import {ENV_TYPE} from "@/common/js/constants"; import {ENV_TYPE} from "@/common/js/constants";
import {ELEMENT_TYPE, STEP, TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting"; import {ELEMENT_TYPE, STEP, TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import MsComponentConfig from "@/business/components/api/automation/scenario/component/ComponentConfig"; import MsComponentConfig from "@/business/components/api/automation/scenario/component/ComponentConfig";
import ScenarioChildDiff from "@/business/components/api/automation/version/ScenarioChildDiff";
const {diff} = require("@/business/components/performance/v_node_diff"); const {diff} = require("@/business/components/performance/v_node_diff");
const {KeyValue} = require("@/business/components/api/definition/model/ApiTestModel"); const {KeyValue} = require("@/business/components/api/definition/model/ApiTestModel");
const {getUUID} = require("@/common/js/utils"); const {getUUID} = require("@/common/js/utils");
@ -384,11 +402,26 @@ export default{
type:{} type:{}
}, },
components:{ components:{
ScenarioChildDiff,
MsComponentConfig, MsComponentConfig,
MsSelectTree: () => import("@/business/components/common/select-tree/SelectTree"), MsSelectTree: () => import("@/business/components/common/select-tree/SelectTree"),
MsInputTag: () => import("@/business/components/api/automation/scenario/MsInputTag"), MsInputTag: () => import("@/business/components/api/automation/scenario/MsInputTag"),
EnvPopover: () => import("@/business/components/api/automation/scenario/EnvPopover"), EnvPopover: () => import("@/business/components/api/automation/scenario/EnvPopover"),
}, },
watch:{
'dialogVisible'(){
if(this.dialogVisible===false){
this.leftChildData = {};
this.leftChildNode = {};
this.leftChildVnode ={};
this.rightChildData = {};
this.rightChildNode = {};
this.rightChildVnode ={};
this.currentRightChild = undefined;
this.currentLeftChild = undefined;
}
}
},
data(){ data(){
return{ return{
options: API_STATUS, options: API_STATUS,
@ -416,8 +449,13 @@ export default{
stepEnable:true, stepEnable:true,
currentLeftChild:undefined, currentLeftChild:undefined,
currentRightChild:undefined, currentRightChild:undefined,
leftChildData:{},
rightChildData:{},
leftChildNode:{},
rightChildNode:{},
leftChildVnode:{},
rightChildVnode:{},
dialogVisible:false
} }
}, },
methods:{ methods:{
@ -562,22 +600,23 @@ export default{
}, },
nodeClick(data, node,source) { nodeClick(data, node,source) {
this.$store.state.selectStep = data; this.$store.state.selectStep = data;
console.log(source) this.rightChildData = data;
this.rightChildNode = node
this.rightChildVnode = source
this.currentRightChild = source; this.currentRightChild = source;
console.log(this.rightChildVnode)
if(this.currentLeftChild){ if(this.currentLeftChild){
diff(this.currentLeftChild,this.currentRightChild); this.dialogVisible = true;
this.currentLeftChild = undefined;
this.currentRightChild = undefined;
} }
}, },
oldNodeClick(data, node,source) { oldNodeClick(data, node,source) {
this.$store.state.selectStep = data; this.$store.state.selectStep = data;
console.log(source) this.leftChildData = data;
this.leftChildNode = node
this.leftChildVnode = source
this.currentLeftChild = source; this.currentLeftChild = source;
if(this.currentRightChild){ if(this.currentRightChild){
diff(this.currentLeftChild,this.currentRightChild); this.dialogVisible = true;
this.currentLeftChild = undefined;
this.currentRightChild = undefined;
} }
}, },
@ -598,7 +637,4 @@ export default{
display: flex; display: flex;
justify-content:space-between; justify-content:space-between;
} }
.border-config{
border: 1px solid red;
}
</style> </style>