From 997559105be81886ec1ab106c94824e51db2ef14 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Thu, 13 Apr 2023 01:13:08 +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=E6=94=B9=E8=8A=82=E7=82=B9=E4=B8=8B=E5=90=AB=E6=9C=89?= =?UTF-8?q?=E5=A4=A7=E9=87=8F=E8=AF=B7=E6=B1=82=E7=9A=84=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E5=B1=95=E7=A4=BA=E9=80=BB=E8=BE=91=EF=BC=9A?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E3=80=81=E5=A4=B1=E8=B4=A5=E3=80=81=E8=AF=AF?= =?UTF-8?q?=E6=8A=A5=E3=80=81=E6=9C=AA=E6=89=A7=E8=A1=8C=E7=9A=84=E6=A0=91?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E4=BD=BF=E7=94=A8=E6=BB=9A=E5=8A=A8=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=A0=91=E7=BB=84=E4=BB=B6=EF=BC=8C=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AD=9B=E9=80=89=E6=97=B6=E6=94=BE=E5=BC=83?= =?UTF-8?q?el-tree=E6=9C=AC=E8=BA=AB=E7=9A=84filter=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E6=8D=A2=E4=B8=BAjs=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1024901 --user=宋天阳 [接口测试]github#23144场景中请求很多时,查看报告时浏览器崩溃 https://www.tapd.cn/55049933/s/1362059 --- .../automation/report/ApiReportDetail.vue | 76 ++++++++++++++++--- .../tree/InfiniteScrollTreeNode.vue | 2 +- 2 files changed, 68 insertions(+), 10 deletions(-) diff --git a/api-test/frontend/src/business/automation/report/ApiReportDetail.vue b/api-test/frontend/src/business/automation/report/ApiReportDetail.vue index 5fdc55e313..51eefaf1d1 100644 --- a/api-test/frontend/src/business/automation/report/ApiReportDetail.vue +++ b/api-test/frontend/src/business/automation/report/ApiReportDetail.vue @@ -38,13 +38,13 @@ - @@ -53,13 +53,13 @@ - @@ -67,13 +67,13 @@ - @@ -164,6 +164,9 @@ export default { reportExportVisible: false, requestType: undefined, fullTreeNodes: [], + errorTreeNodes: [], + unExecuteTreeNodes: [], + fakeErrorTreeNodes: [], showRerunButton: false, stepFilter: new STEP(), exportReportIsOk: false, @@ -210,13 +213,68 @@ export default { methods: { filter(index) { if (index === '1') { - this.$refs.failsTree.filter(index); + //查询失败的步骤 + this.initFilterTreeNodes('ERROR'); } else if (this.activeName === 'errorReport') { - this.$refs.errorReportTree.filter('FAKE_ERROR'); + this.initFilterTreeNodes('FAKE_ERROR'); } else if (this.activeName === 'unExecute') { - this.$refs.unExecuteTree.filter('PENDING'); + this.initFilterTreeNodes('UN_EXECUTE'); } }, + initFilterTreeNodes(status) { + if (this.fullTreeNodes.length > 0) { + let filteredTreeNodeArr = []; + for (let i = 0; i < this.fullTreeNodes.length; i++) { + let node = this.filterNodes(this.fullTreeNodes[i], status); + if (node) { + filteredTreeNodeArr.push(node); + } + } + if (status === 'ERROR') { + this.errorTreeNodes = filteredTreeNodeArr; + } else if (status === 'FAKE_ERROR') { + this.fakeErrorTreeNodes = filteredTreeNodeArr; + } else if (status === 'UN_EXECUTE') { + this.unExecuteTreeNodes = filteredTreeNodeArr; + } + } + }, + filterNodes(node, status) { + if (status === 'ERROR' || status === 'FAKE_ERROR' || status === 'UN_EXECUTE') { + let data = { ...node }; + if (!data.value && (!data.children || data.children.length === 0)) { + return null; + } + if (data.children.length > 0) { + let filteredChildren = []; + for (let i = 0; i < data.children.length; i++) { + let filteredNode = this.filterNodes(data.children[i], status); + if (filteredNode) { + filteredChildren.push(filteredNode); + } + } + data.children = filteredChildren; + } + if (data.children.length > 0) { + return data; + } else { + if (status === 'FAKE_ERROR') { + if (data.errorCode && data.errorCode !== '' && data.value.status === 'FAKE_ERROR') { + return data; + } + } else if (status === 'UN_EXECUTE') { + if (data.value.status === 'PENDING') { + return data; + } + } else if (status === 'ERROR') { + if (data.totalStatus !== 'FAKE_ERROR' && data.value && data.value.error > 0) { + return data; + } + } + } + } + return null; + }, init() { this.loading = true; this.projectEnvMap = {}; diff --git a/api-test/frontend/src/business/automation/report/components/tree/InfiniteScrollTreeNode.vue b/api-test/frontend/src/business/automation/report/components/tree/InfiniteScrollTreeNode.vue index 329eb3dfdf..8542153d3b 100644 --- a/api-test/frontend/src/business/automation/report/components/tree/InfiniteScrollTreeNode.vue +++ b/api-test/frontend/src/business/automation/report/components/tree/InfiniteScrollTreeNode.vue @@ -75,7 +75,7 @@ v-infinite-scroll="loadInfiniteScrollTreeNode" infinite-scroll-distance="50" infinite-scroll-delay="0" - style="height: 400px; overflow: auto"> + style="height: 400px; margin-top: 5px; margin-bottom: 5px; overflow: auto">