diff --git a/frontend/src/business/components/api/automation/report/ApiReportDetail.vue b/frontend/src/business/components/api/automation/report/ApiReportDetail.vue index 6eae8054ab..c79a39a221 100644 --- a/frontend/src/business/components/api/automation/report/ApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/ApiReportDetail.vue @@ -360,20 +360,22 @@ export default { }, computeTotalTime() { if (this.content.scenarios) { - let startTime = 99991611737506593; + let startTime = 0; let endTime = 0; + let requestTime = 0; this.content.scenarios.forEach((scenario) => { scenario.requestResults.forEach((request) => { - if (request.startTime && Number(request.startTime) < startTime) { + if (request.startTime && Number(request.startTime)) { startTime = request.startTime; } - if (request.endTime && Number(request.endTime) > endTime) { + if (request.endTime && Number(request.endTime)) { endTime = request.endTime; } + requestTime = requestTime + (endTime - startTime); }) }) if (startTime < endTime) { - this.totalTime = endTime - startTime + 100; + this.totalTime = requestTime } } }, diff --git a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue index c2ec7beb30..016affa43f 100644 --- a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue @@ -300,8 +300,9 @@ export default { }, formatResult(res) { let resMap = new Map; - this.startTime = 99991611737506593; + this.startTime = 0; this.endTime = 0; + let requestTime = 0; this.clearDebug(); if (res && res.scenarios) { res.scenarios.forEach(item => { @@ -330,20 +331,20 @@ export default { } else { this.reqError++; } - if (req.startTime && Number(req.startTime) < this.startTime) { + if (req.startTime && Number(req.startTime)) { this.startTime = req.startTime; } - if (req.endTime && Number(req.endTime) > this.endTime) { + if (req.endTime && Number(req.endTime)) { this.endTime = req.endTime; } + requestTime = requestTime + (this.endTime - this.startTime) } } } }) } - if (this.startTime < this.endTime) { - this.totalTime = this.endTime - this.startTime + 100; - } + this.totalTime = requestTime; + this.debugResult = resMap; this.setTreeValue(this.fullTreeNodes); this.reload(); diff --git a/frontend/src/business/components/api/automation/report/components/MetricChart.vue b/frontend/src/business/components/api/automation/report/components/MetricChart.vue index bd17bc1e32..e5d83cb300 100644 --- a/frontend/src/business/components/api/automation/report/components/MetricChart.vue +++ b/frontend/src/business/components/api/automation/report/components/MetricChart.vue @@ -134,17 +134,16 @@ }, methods: { initTime() { - this.time = this.totalTime - this.seconds = Math.floor(this.time / 1000) + this.time = this.totalTime; + this.seconds = (this.time) / 1000; if (this.seconds >= 1) { - if (this.seconds > 60) { - this.minutes = Math.round(this.time / 60) - this.seconds = Math.round(this.time % 60) - this.time = this.minutes + "min" + this.seconds + "s" + if (this.seconds < 60) { + this.seconds = Math.round(this.seconds * 100 / 1) / 100; + this.time = this.seconds + "s" } if (this.seconds > 60) { - this.minutes = Math.round(this.time / 60) - this.seconds = Math.round(this.time % 60) + this.minutes = Math.round(this.seconds / 60) + this.seconds = Math.round(this.seconds * 100 % 60) / 100; this.time = this.minutes + "min" + this.seconds + "s" } if (this.minutes > 60) { @@ -153,7 +152,6 @@ this.time = this.hour + "hour" + this.minutes + "min" + this.seconds + "s" } - this.time = (this.seconds) + "s" } else { this.time = this.totalTime + "ms" }