From c2e342792eb9a384e949a913c0c714e6e4104738 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 26 Jan 2022 17:47:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9C=BA=E6=99=AF=E5=AF=B9=E6=AF=94=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=B2=A1=E5=9B=9E=E6=98=BE=E5=85=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1009769--user=郭雨琦 解决场景对比数据没回显全的问题 --- .../automation/scenario/EditApiScenario.vue | 12 +++ .../api/automation/version/ScenarioDiff.vue | 92 +++++++++++-------- 2 files changed, 67 insertions(+), 37 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 0b9ed3f30c..6a4702e076 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -356,6 +356,10 @@ :new-scenario-definition="newScenarioDefinition" :project-env-map="projectEnvMap" :new-project-env-map="newProjectEnvMap" + :old-enable-cookie-share="enableCookieShare" + :new-enable-cookie-share="newEnableCookieShare" + :old-on-sample-error="onSampleError" + :new-on-sample-error="newOnSampleError" :project-list="projectList" :type ="type" > @@ -427,6 +431,7 @@ export default { data() { return { onSampleError: true, + newOnSampleError: true, showConfigButtonWithOutPermission: false, props: { label: "label", @@ -474,6 +479,7 @@ export default { debugData: {}, reportId: "", enableCookieShare: false, + newEnableCookieShare: false, globalOptions: { spacing: 30 }, @@ -1767,6 +1773,12 @@ export default { obj.hashTree[i].requestResult = [{responseResult: {}}]; } } + this.newEnableCookieShare = obj.enableCookieShare; + if (obj.onSampleError === undefined) { + this.newOnSampleError = true; + } else { + this.newOnSampleError = obj.onSampleError; + } } for (let i = 0; i < this.scenarioDefinition.length; i++) { this.scenarioDefinition[i].disabled = true; diff --git a/frontend/src/business/components/api/automation/version/ScenarioDiff.vue b/frontend/src/business/components/api/automation/version/ScenarioDiff.vue index 37b731cfbc..847e2e5cc5 100644 --- a/frontend/src/business/components/api/automation/version/ScenarioDiff.vue +++ b/frontend/src/business/components/api/automation/version/ScenarioDiff.vue @@ -115,7 +115,7 @@ {{ $t('api_test.automation.scenario_total') }} - :{{ oldVariableSize }} + :{{ getOldVariableSize() }} {{ $t('api_test.scenario.share_cookie') }} @@ -269,7 +269,7 @@ {{ $t('api_test.automation.scenario_total') }} - :{{ newVariableSize }} + :{{ getNewVariableSize() }} {{ $t('api_test.scenario.share_cookie') }} @@ -459,19 +459,19 @@ export default{ newColor:"" } }, - methods:{ - getDiff(){ + methods: { + getDiff() { let oldVnode = this.$refs.old let vnode = this.$refs.new //oldVnode.style.backgroundColor = "rgb(241,200,196)"; - if(this.oldData.createTime>this.newData.createTime){ + if (this.oldData.createTime > this.newData.createTime) { this.oldColor = "rgb(121, 225, 153,0.3)"; this.newColor = "rgb(241,200,196,0.45)" - }else{ + } else { this.oldColor = "rgb(241,200,196,0.45)" this.newColor = "rgb(121, 225, 153,0.3)"; } - diff(oldVnode,vnode,this.oldColor,this.newColor); + diff(oldVnode, vnode, this.oldColor, this.newColor); this.isReloadData = false }, showAll() { @@ -482,7 +482,7 @@ export default{ this.$store.state.selectStep = undefined; } }, - oldShowPopover(){ + oldShowPopover() { let definition = JSON.parse(JSON.stringify(this.oldData)); definition.hashTree = this.oldScenarioDefinition; this.oldEnvResult.loading = true; @@ -491,7 +491,7 @@ export default{ this.oldEnvResult.loading = false; }) }, - newShowPopover(){ + newShowPopover() { let definition = JSON.parse(JSON.stringify(this.newData)); definition.hashTree = this.newScenarioDefinition; this.newEnvResult.loading = true; @@ -500,13 +500,13 @@ export default{ this.newEnvResult.loading = false; }) }, - changeNodeStatus(nodes,source) { + changeNodeStatus(nodes, source) { for (let i in nodes) { if (nodes[i]) { if (this.expandedStatus) { - if(source==="new"){ + if (source === "new") { this.newExpandedNode.push(nodes[i].resourceId); - }else { + } else { this.oldExpandedNode.push(nodes[i].resourceId); } } @@ -515,7 +515,7 @@ export default{ nodes[i].active = false; } if (nodes[i].hashTree !== undefined && nodes[i].hashTree.length > 0) { - this.changeNodeStatus(nodes[i].hashTree,source); + this.changeNodeStatus(nodes[i].hashTree, source); } } } @@ -524,10 +524,10 @@ export default{ this.newExpandedNode = []; this.oldExpandedNode = []; this.expandedStatus = true; - if(source==="new"){ - this.changeNodeStatus(this.newScenarioDefinition,source); - }else { - this.changeNodeStatus(this.oldScenarioDefinition,source); + if (source === "new") { + this.changeNodeStatus(this.newScenarioDefinition, source); + } else { + this.changeNodeStatus(this.oldScenarioDefinition, source); } }, @@ -535,10 +535,10 @@ export default{ this.expandedStatus = false; this.newExpandedNode = []; this.oldExpandedNode = []; - if(source==="new"){ - this.changeNodeStatus( this.newScenarioDefinition,source); - }else { - this.changeNodeStatus( this.oldScenarioDefinition,source); + if (source === "new") { + this.changeNodeStatus(this.newScenarioDefinition, source); + } else { + this.changeNodeStatus(this.oldScenarioDefinition, source); } this.showHide(); }, @@ -561,9 +561,9 @@ export default{ enableAll(source) { this.stepEnable = true; let scenarioDefinition; - if(source==="new"){ + if (source === "new") { scenarioDefinition = this.newScenarioDefinition; - }else { + } else { scenarioDefinition = this.oldScenarioDefinition; } this.stepStatus(scenarioDefinition); @@ -571,59 +571,77 @@ export default{ disableAll(source) { this.stepEnable = false; let scenarioDefinition; - if(source==="new"){ + if (source === "new") { scenarioDefinition = this.newScenarioDefinition; - }else { + } else { scenarioDefinition = this.oldScenarioDefinition; } this.stepStatus(scenarioDefinition); }, - nodeExpand(data, node,source) { - if(source==="new"){ + nodeExpand(data, node, source) { + if (source === "new") { if (data && data.resourceId && this.newExpandedNode.indexOf(data.resourceId) === -1) { this.newExpandedNode.push(data.resourceId); } - }else{ + } else { if (data && data.resourceId && this.oldExpandedNode.indexOf(data.resourceId) === -1) { this.oldExpandedNode.push(data.resourceId); } } }, - nodeCollapse(data, node,source) { + nodeCollapse(data, node, source) { if (data && data.resourceId) { - if(source==="new"){ + if (source === "new") { this.newExpandedNode.splice(this.newExpandedNode.indexOf(data.resourceId), 1); - }else { + } else { this.oldExpandedNode.splice(this.oldExpandedNode.indexOf(data.resourceId), 1); } } }, - nodeClick(data, node,source) { + nodeClick(data, node, source) { this.$store.state.selectStep = data; this.rightChildData = data; this.rightChildNode = node this.rightChildVnode = source this.currentRightChild = source; console.log(this.rightChildVnode) - if(this.currentLeftChild){ + if (this.currentLeftChild) { this.dialogVisible = true; } }, - oldNodeClick(data, node,source) { + oldNodeClick(data, node, source) { this.$store.state.selectStep = data; this.leftChildData = data; this.leftChildNode = node this.leftChildVnode = source this.currentLeftChild = source; - if(this.currentRightChild){ + if (this.currentRightChild) { this.dialogVisible = true; } }, - + getOldVariableSize() { + let size = 0; + if (this.oldData.variables) { + size += this.oldData.variables.length; + } + if (this.oldData.headers && this.oldData.headers.length > 1) { + size += this.oldData.headers.length - 1; + } + return size; + }, + getNewVariableSize(){ + let size = 0; + if (this.newData.variables) { + size += this.newData.variables.length; + } + if (this.newData.headers && this.newData.headers.length > 1) { + size += this.newData.headers.length - 1; + } + return size; + } }, created() { - }, mounted() { this.$nextTick(function () {