From 9ace668e32158300a86eb24c32ac74bdebb9bc81 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 19 Jan 2022 18:03:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=89=88=E6=9C=AC=E5=AF=B9=E6=AF=94):=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=AF=B9=E6=AF=94=E7=AE=97=E6=B3=95=E5=8A=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 版本对比算法加类型 --- .../automation/scenario/EditApiScenario.vue | 18 +++++++--- .../api/automation/scenario/MsInputTag.vue | 5 ++- .../api/automation/version/ScenarioDiff.vue | 35 ++++++++++--------- .../components/performance/v_node_diff.js | 2 +- 4 files changed, 37 insertions(+), 23 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 834831f229..e669cca026 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -1406,8 +1406,12 @@ export default { getApiScenario() { this.loading = true; this.stepEnable = true; - if (this.currentScenario.tags != undefined && this.currentScenario.tags && !(this.currentScenario.tags instanceof Array)) { - this.currentScenario.tags = JSON.parse(this.currentScenario.tags); + if (this.currentScenario.tags !== undefined && this.currentScenario.tags ) { + if(!(this.currentScenario.tags instanceof Array)){ + this.currentScenario.tags = JSON.parse(this.currentScenario.tags); + } + }else{ + this.$set(this.currentScenario,'tags',[]) } if (!this.currentScenario.variables) { this.currentScenario.variables = []; @@ -1771,14 +1775,20 @@ export default { } } res.data.userName = response.data.userName + this.dealWithTag(res.data); this.newData = res.data; - this.dealWithTag(); + this.closeExpansion() this.dialogVisible = true; } }); }) }, - dealWithTag(){ + dealWithTag(newScenario){ + if(newScenario.tags){ + if(Object.prototype.toString.call(newScenario.tags)==="[object String]"){ + newScenario.tags = JSON.parse(newScenario.tags); + } + } if(this.currentScenario.tags){ if(Object.prototype.toString.call(this.currentScenario.tags)==="[object String]"){ this.currentScenario.tags = JSON.parse(this.currentScenario.tags); diff --git a/frontend/src/business/components/api/automation/scenario/MsInputTag.vue b/frontend/src/business/components/api/automation/scenario/MsInputTag.vue index 21e438a6f2..1838254353 100644 --- a/frontend/src/business/components/api/automation/scenario/MsInputTag.vue +++ b/frontend/src/business/components/api/automation/scenario/MsInputTag.vue @@ -69,7 +69,10 @@ export default { watch: { innerTags() { this.currentScenario[this.prop] = this.innerTags; - } + }, + 'currentScenario.tags'() { + this.innerTags = this.currentScenario.tags + }, }, methods: { foucusTagInput() { diff --git a/frontend/src/business/components/api/automation/version/ScenarioDiff.vue b/frontend/src/business/components/api/automation/version/ScenarioDiff.vue index 4b9a8c99d4..3686806de8 100644 --- a/frontend/src/business/components/api/automation/version/ScenarioDiff.vue +++ b/frontend/src/business/components/api/automation/version/ScenarioDiff.vue @@ -138,7 +138,7 @@ -
+
@@ -302,21 +302,21 @@
-
+
- + draggable ref="newStepTree" > 0) { - this.changeNodeStatus(nodes[i].hashTree); + this.changeNodeStatus(nodes[i].hashTree,source); } } } }, openExpansion(source) { - this.expandedNode = []; + this.newExpandedNode = []; + this.oldExpandedNode = []; this.expandedStatus = true; - let scenarioDefinition; if(source==="new"){ - scenarioDefinition = this.newScenarioDefinition; + this.changeNodeStatus(this.newScenarioDefinition,source); }else { - scenarioDefinition = this.oldScenarioDefinition; + this.changeNodeStatus(this.oldScenarioDefinition,source); } - this.changeNodeStatus(scenarioDefinition,source); + }, closeExpansion(source) { this.expandedStatus = false; - this.expandedNode = []; - let scenarioDefinition; + this.newExpandedNode = []; + this.oldExpandedNode = []; if(source==="new"){ - scenarioDefinition = this.newScenarioDefinition; + this.changeNodeStatus( this.newScenarioDefinition,source); }else { - scenarioDefinition = this.oldScenarioDefinition; + this.changeNodeStatus( this.oldScenarioDefinition,source); } - this.changeNodeStatus(scenarioDefinition,source); this.showHide(); }, showHide() { diff --git a/frontend/src/business/components/performance/v_node_diff.js b/frontend/src/business/components/performance/v_node_diff.js index c7850fbd29..b5683dc45a 100644 --- a/frontend/src/business/components/performance/v_node_diff.js +++ b/frontend/src/business/components/performance/v_node_diff.js @@ -288,7 +288,7 @@ function diffDetail(oldVnode,newVnode,diffNode){ diffNode.nodeArray.push(newVnode.elm); } }else if(isDef(oldVnode.tag)&&isDef(newVnode.tag)){ - if(oldVnode.tag==='input'&&newVnode.tag==='input'){ + if((oldVnode.tag==='input'&&newVnode.tag==='input')||(oldVnode.tag==='textarea'&&newVnode.tag==='textarea')){ if(oldVnode.elm.value!==newVnode.elm.value){ diffNode.oldNodeArray.push(oldVnode.elm); diffNode.nodeArray.push(newVnode.elm);