From 7fe7624ab060de0071f54f43eca5a221a2061cbd Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 12 Jan 2022 17:46:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=A7=E8=A1=8C=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E6=9F=A5=E7=9C=8B=E4=B8=80=E7=9B=B4=E8=BD=AC?= =?UTF-8?q?=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/detail/TestPlanReportContent.vue | 18 ++++++++++---- .../report/detail/component/ApiResult.vue | 24 +++++++++++-------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent.vue b/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent.vue index 57a9f2899f..0a9e39ac2a 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent.vue @@ -90,24 +90,32 @@ export default { }, computed: { overviewEnable() { - let disable = this.report.config && this.report.config.overview.enable === false; + let disable = this.report.config + && this.report.config.overview && this.report.config.overview.enable === false; return !disable; }, summaryEnable() { - let disable = this.report.config && this.report.config.summary.enable === false; + let disable = this.report.config && this.report.config.summary + && this.report.config.summary.enable === false; return !disable; }, functionalEnable() { let disable = this.report.config && this.report.config.functional.enable === false; - return !disable && this.report.functionResult && this.report.functionResult.caseData.length > 0 ; + return !disable && this.report.functionResult + && this.report.functionResult.caseData && this.report.functionResult.caseData.length > 0 ; }, apiEnable() { let disable = this.report.config && this.report.config.api.enable === false; - return !disable && this.report.apiResult && (this.report.apiResult.apiCaseData.length > 0 || this.report.apiResult.apiScenarioData.length) > 0; + return !disable && this.report.apiResult && + ( + (this.report.apiResult.apiCaseData && this.report.apiResult.apiCaseData.length > 0) + || (this.report.apiResult.apiScenarioData && this.report.apiResult.apiScenarioData.length > 0) + ); }, loadEnable() { let disable = this.report.config && this.report.config.load.enable === false; - return !disable && this.report.loadResult && this.report.loadResult.caseData.length > 0; + return !disable && this.report.loadResult + && this.report.loadResult.caseData && this.report.loadResult.caseData.length > 0; } }, methods: { diff --git a/frontend/src/business/components/track/plan/view/comonents/report/detail/component/ApiResult.vue b/frontend/src/business/components/track/plan/view/comonents/report/detail/component/ApiResult.vue index 1b46869294..0f07e1fa64 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/detail/component/ApiResult.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/detail/component/ApiResult.vue @@ -62,19 +62,23 @@ export default { methods: { getCaseCharData() { let caseCharData = []; - this.apiResult.apiCaseData.forEach(item => { - let data = this.getDataByStatus(item.status); - data.value = item.count; - caseCharData.push(data); - }); + if (this.apiResult.apiCaseData) { + this.apiResult.apiCaseData.forEach(item => { + let data = this.getDataByStatus(item.status); + data.value = item.count; + caseCharData.push(data); + }); + } this.caseCharData = caseCharData; let apiScenarioData = []; - this.apiResult.apiScenarioData.forEach(item => { - let data = this.getDataByStatus(item.status); - data.value = item.count; - apiScenarioData.push(data); - }); + if (this.apiResult.apiScenarioData) { + this.apiResult.apiScenarioData.forEach(item => { + let data = this.getDataByStatus(item.status); + data.value = item.count; + apiScenarioData.push(data); + }); + } let stepCharData = []; for (let i = 0; i < this.apiResult.apiScenarioStepData.length; i++) {