fix(接口测试): 场景详情-批量展开/单独展开-步骤显示问题

--bug=1027706 --user=白奇 【接口测试】场景详情-批量展开/单独展开-步骤显示问题 https://www.tapd.cn/55049933/s/1392374
This commit is contained in:
baiqi 2023-07-12 17:13:30 +08:00 committed by 刘瑞斌
parent b0999ac7d9
commit 9c47ecac69
2 changed files with 37 additions and 32 deletions

View File

@ -275,7 +275,7 @@
node-key="id" node-key="id"
height="calc(100vh - 170px)" height="calc(100vh - 170px)"
:minItemSize="43" :minItemSize="43"
:sizeDependencies="['expanded']" :sizeDependencies="['expanded', 'checked']"
:props="props" :props="props"
:data="scenarioDefinition" :data="scenarioDefinition"
:buffer="300" :buffer="300"
@ -293,11 +293,12 @@
ref="stepTree" ref="stepTree"
:key="reloadTree"> :key="reloadTree">
<el-row <el-row
slot-scope="{ node, data }"
v-if="isNodeShow(node, data)"
class="custom-tree-node" class="custom-tree-node"
:gutter="10" :gutter="10"
type="flex" type="flex"
align="middle" align="middle"
slot-scope="{ node, data }"
style="width: 100%"> style="width: 100%">
<span <span
class="custom-tree-node-col" class="custom-tree-node-col"
@ -324,14 +325,7 @@
:show-size="false" :show-size="false"
style="margin-right: 10px" /> style="margin-right: 10px" />
</span> </span>
<span <span style="width: calc(100% - 40px)">
v-if="
stepFilter.get('ALlSamplerStep').indexOf(data.type) === -1 ||
!node.parent ||
!node.parent.data ||
stepFilter.get('AllSamplerProxy').indexOf(node.parent.data.type) === -1
"
style="width: calc(100% - 40px)">
<!-- 步骤组件--> <!-- 步骤组件-->
<ms-component-config <ms-component-config
:scenario-definition="scenarioDefinition" :scenario-definition="scenarioDefinition"
@ -357,6 +351,9 @@
ref="componentConfig" /> ref="componentConfig" />
</span> </span>
</el-row> </el-row>
<div v-else class="el-tree-node is-hidden is-focusable is-leaf" style="display: none">
{{ hideNode(node) }}
</div>
</vue-easy-tree> </vue-easy-tree>
</div> </div>
</el-row> </el-row>
@ -2393,39 +2390,51 @@ export default {
}, },
changeNodeStatus(resourceIds, nodes) { changeNodeStatus(resourceIds, nodes) {
for (let i in nodes) { for (let i in nodes) {
if (nodes[i] && !(nodes[i].type === 'scenario' && nodes[i].referenced === 'REF')) { const node = nodes[i];
if (resourceIds.indexOf(nodes[i].resourceId) !== -1) { if (node && !(node.type === 'scenario' && node.referenced === 'REF')) {
nodes[i].active = this.expandedStatus; if (
resourceIds.indexOf(node.resourceId) !== -1 &&
this.stepFilter.get('ALlSamplerStep').indexOf(node.type) === -1
) {
node.active = this.expandedStatus;
} }
if (nodes[i].hashTree && nodes[i].hashTree.length > 0 && !this.expandedStatus) { if (node.hashTree && node.hashTree.length > 0 && !this.expandedStatus) {
this.changeNodeStatus(resourceIds, nodes[i].hashTree); this.changeNodeStatus(resourceIds, node.hashTree);
} }
} }
} }
}, },
isNodeShow(node, data) {
const res =
this.stepFilter.get('ALlSamplerStep').indexOf(data.type) === -1 ||
!node.parent ||
!node.parent.data ||
this.stepFilter.get('AllSamplerProxy').indexOf(node.parent.data.type) === -1;
return res;
},
getAllResourceIds() { getAllResourceIds() {
let selectNodes = []; let selectNodes = [];
let selectIds = []; let selectIds = [];
if (this.$refs.stepTree) { if (this.$refs.stepTree) {
selectNodes = this.$refs.stepTree.getCheckedNodes(); selectNodes = this.$refs.stepTree.getCheckedNodes();
selectNodes.forEach(item => { selectNodes.forEach((item) => {
selectIds.push(item.resourceId) selectIds.push(item.resourceId);
}); });
} }
let resourceIds = []; let resourceIds = [];
this.filterAllStep(this.scenarioDefinition, resourceIds, selectIds); this.filterAllStep(this.scenarioDefinition, resourceIds, selectIds);
return resourceIds; return resourceIds;
}, },
filterAllStep(stepArray, resourceIds,selectIds) { filterAllStep(stepArray, resourceIds, selectIds) {
if (stepArray) { if (stepArray) {
stepArray.forEach(item =>{ stepArray.forEach((item) => {
if (selectIds && selectIds.includes(item.resourceId)) { if (selectIds && selectIds.includes(item.resourceId)) {
resourceIds.push(item.resourceId); resourceIds.push(item.resourceId);
} }
if(item.referenced !== 'REF' && item.hashTree){ if (item.referenced !== 'REF' && item.hashTree) {
this.filterAllStep(item.hashTree,resourceIds, selectIds); this.filterAllStep(item.hashTree, resourceIds, selectIds);
} }
}) });
} }
}, },
getAllCheckedNodes() { getAllCheckedNodes() {

View File

@ -72,7 +72,9 @@
<span <span
class="ms-step-debug-code" class="ms-step-debug-code"
@click="active" @click="active"
:class="request.requestResult && request.requestResult[0].success && reqSuccess ? 'ms-req-success' : 'ms-req-error'" :class="
request.requestResult && request.requestResult[0].success && reqSuccess ? 'ms-req-success' : 'ms-req-error'
"
v-else-if=" v-else-if="
!loading && !loading &&
!request.testing && !request.testing &&
@ -93,10 +95,7 @@
class="ms-btn" class="ms-btn"
size="mini" size="mini"
circle circle
v-permission="[ v-permission="['PROJECT_API_SCENARIO:READ+DEBUG', 'PROJECT_API_SCENARIO:READ+RUN']" />
'PROJECT_API_SCENARIO:READ+DEBUG',
'PROJECT_API_SCENARIO:READ+RUN'
]"/>
</el-tooltip> </el-tooltip>
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else> <el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
<el-button <el-button
@ -105,10 +104,7 @@
style="color: white; padding: 0 0.1px; width: 24px; height: 24px" style="color: white; padding: 0 0.1px; width: 24px; height: 24px"
class="stop-btn" class="stop-btn"
circle circle
v-permission="[ v-permission="['PROJECT_API_SCENARIO:READ+DEBUG', 'PROJECT_API_SCENARIO:READ+RUN']">
'PROJECT_API_SCENARIO:READ+DEBUG',
'PROJECT_API_SCENARIO:READ+RUN'
]">
<div style="transform: scale(0.66)"> <div style="transform: scale(0.66)">
<span style="margin-left: -4.5px; font-weight: bold">STOP</span> <span style="margin-left: -4.5px; font-weight: bold">STOP</span>
</div> </div>
@ -171,7 +167,7 @@
<el-tab-pane <el-tab-pane
v-for="(item, i) in request.requestResult" v-for="(item, i) in request.requestResult"
:label="'循环' + (i + 1)" :label="'循环' + (i + 1)"
:key="i" :key="`api-response${i}`"
style="margin-bottom: 5px"> style="margin-bottom: 5px">
<api-response-component :currentProtocol="request.protocol" :apiActive="true" :result="item" /> <api-response-component :currentProtocol="request.protocol" :apiActive="true" :result="item" />
</el-tab-pane> </el-tab-pane>