From 5f276b5f6de3bf302f3b1acfcf2d3cdda27c6c5c Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Thu, 12 Jan 2023 12:44:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3=E5=9C=BA=E6=99=AF=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=AF=B9=E6=AF=94=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1021907 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001021907 --- .../automation/version/ScenarioDiff.vue | 151 ++++++++++++++++-- 1 file changed, 139 insertions(+), 12 deletions(-) diff --git a/api-test/frontend/src/business/automation/version/ScenarioDiff.vue b/api-test/frontend/src/business/automation/version/ScenarioDiff.vue index 198cd737ca..890e8f4f6b 100644 --- a/api-test/frontend/src/business/automation/version/ScenarioDiff.vue +++ b/api-test/frontend/src/business/automation/version/ScenarioDiff.vue @@ -178,7 +178,16 @@ :node="node" :env-map="projectEnvMap" :project-list="projectList" - :show-version="false" /> + :show-version="false" + v-if=" + stepFilter.get('ALlSamplerStep').indexOf(data.type) === -1 || + !node.parent || + !node.parent.data || + stepFilter.get('AllSamplerProxy').indexOf(node.parent.data.type) === -1 + "/> + @@ -354,7 +363,16 @@ :node="node" :env-map="newProjectEnvMap" :project-list="projectList" - :show-version="false" /> + :show-version="false" + v-if=" + stepFilter.get('ALlSamplerStep').indexOf(data.type) === -1 || + !node.parent || + !node.parent.data || + stepFilter.get('AllSamplerProxy').indexOf(node.parent.data.type) === -1 + "/> + @@ -391,7 +409,8 @@ import MsComponentConfig from '../scenario/component/ComponentConfig'; import ScenarioChildDiff from '../version/ScenarioChildDiff'; import { objToStrMap } from 'metersphere-frontend/src/utils'; import { getScenarioWithBLOBsById } from '@/api/scenario'; -import { useApiStore } from '@/store'; +import {useApiStore} from '@/store'; +import {STEP} from "@/business/automation/scenario/Setting"; const store = useApiStore(); const { diff } = require('./v_node_diff'); @@ -501,6 +520,7 @@ export default { newOnSampleError: {}, newProjectEnvMap: new Map(), showDiff: false, + stepFilter: new STEP(), }; }, methods: { @@ -515,19 +535,56 @@ export default { } } this.oldData = response.data; - getFollowByScenarioId(this.currentScenarioId).then((response) => { - this.oldData.follows = response.data; - for (let i = 0; i < response.data.length; i++) { - if (response.data[i] === this.currentUser().id) { - this.showFollow = true; - break; - } - } - }); + this.sort(); } }); } }, + sort() { + this.recursionStep(this.oldScenarioDefinition); + }, + recursionStep(stepArray, scenarioProjectId, fullPath, isGeneric) { + for (let i in stepArray) { + let step = stepArray[i]; + step.index = !isGeneric ? Number(i) + 1 : step.index; + if (step.type === 'GenericController') { + this.pluginOrder(step); + } + step.resourceId = step.resourceId || getUUID(); + // 历史数据处理 + if (step.type === 'HTTPSamplerProxy' && !step.headers) { + step.headers = [new KeyValue()]; + } + if ( + step.type === ELEMENT_TYPE.LoopController && + step.loopType === 'LOOP_COUNT' && + step.hashTree && + step.hashTree.length > 1 + ) { + step.countController.proceed = true; + } + step.clazzName = step.clazzName || TYPE_TO_C.get(step.type); + if (step && step.authManager && !step.authManager.clazzName) { + step.authManager.clazzName = TYPE_TO_C.get(step.authManager.type); + } + // 如果自身没有ID并且场景有ID则赋值场景ID,否则赋值当前项目ID + step.projectId = step.projectId || scenarioProjectId || this.projectId; + // 添加debug结果 + step.parentIndex = fullPath ? fullPath + '_' + step.index : step.index; + if (step.hashTree && step.hashTree.length > 0) { + this.recursionStep(step.hashTree, step.projectId, step.parentIndex, step.type === 'GenericController'); + } + } + }, + pluginOrder(nodes) { + // 兼容历史数据 + if (nodes && nodes.type === 'GenericController' && nodes.hashTree) { + let data = nodes.hashTree.filter((v) => v.type !== 'Assertions'); + for (let i = 0; i < data.length; i++) { + data[i].index = i + 1; + } + } + }, getDffScenario() { getScenarioById(this.dffScenarioId + '/' + this.scenarioRefId).then((response) => { getScenarioWithBLOBsById(response.data.id).then((res) => { @@ -757,6 +814,10 @@ export default { } return size; }, + hideNode(node) { + node.isLeaf = true; + node.visible = false; + }, }, created() { this.getCurrentScenario(); @@ -774,4 +835,70 @@ export default { display: flex; justify-content: space-between; } + +:deep(.el-tree-node__content) { + height: 100%; + margin-top: 3px; + vertical-align: center; +} + +:deep(.el-card__body) { + padding: 6px 10px; +} + +:deep(.el-drawer__body) { + overflow: auto; +} + +:deep(.el-step__icon.is-text) { + border: 1px solid; +} + +:deep(.el-drawer__header) { + margin-bottom: 0px; +} + +:deep(.el-link) { + font-weight: normal; +} + +:deep(.el-checkbox) { + color: #303133; + font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', Arial, sans-serif; + font-size: 13px; + font-weight: normal; +} + +:deep(.el-checkbox__label) { + padding-left: 5px; +} + +.ms-tree :deep(.el-tree-node__expand-icon.expanded) { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); +} + +.ms-tree :deep(.el-tree-node__content > .el-tree-node__expand-icon) { + padding: 3px; +} + +.ms-tree :deep(.el-icon-caret-right:before) { + padding: 0; + content: ''; +} + +.ms-tree :deep(.el-tree-node__expand-icon.is-leaf) { + color: transparent; +} + +.ms-tree :deep(.el-tree-node__expand-icon) { + color: #7c3985; +} + +.ms-tree :deep(.el-tree-node__expand-icon.expanded.el-icon-caret-right:before) { + color: #7c3985; + /* content: "\e722";*/ + padding: 0; + content: ''; +}