fix(测试计划): 时间修改

This commit is contained in:
wenyann 2020-08-12 10:58:10 +08:00
parent 59c9cdfef2
commit 0222b053b0
2 changed files with 28 additions and 5 deletions

View File

@ -115,8 +115,9 @@
getFails() {
if (this.isNotRunning) {
this.fails = [];
this.content.scenarios.forEach((scenario) => {
this.totalTime = scenario.responseTime + scenario.responseTime
this.totalTime = this.totalTime + scenario.responseTime
let failScenario = Object.assign({}, scenario);
if (scenario.error > 0) {
this.fails.push(failScenario);

View File

@ -4,7 +4,7 @@
<div style="width: 50%">
<el-row type="flex" justify="center" align="middle">
<div class="metric-time">
<div class="value" style="margin-left: -150px">{{this.minutes}}min{{this.seconds}}s</div>
<div class="value" style="margin-left: -150px">{{time}}</div>
</div>
<chart id="chart" ref="chart" :options="options" :autoresize="true"></chart>
<el-row type="flex" justify="center" align="middle">
@ -52,14 +52,36 @@
props: {
content: Object,
totalTime: Number
totalTime: String
},
data() {
return {
minutes: Math.floor((this.totalTime % (1000 * 60 * 60)) / (1000 * 60)),
seconds: Math.round((this.totalTime % (1000 * 60)) / 1000),
hour:0,
minutes: 0,
seconds: 0,
time: 0
}
},
created() {
this.initTime()
},
methods: {
initTime() {
this.time=this.totalTime
this.seconds = Math.floor(this.time / 1000);
if (this.seconds > 60) {
this.minutes = Math.floor(this.time/60)
this.seconds=Math.floor(this.time%60)
this.time=this.minutes+"min"+this.seconds+"s"
}
if(this.minutes>60){
this.hour=Math.floor(this.minutes/60)
this.minutes = Math.floor(this.minutes%60)
this.time=this.hour+"hour"+this.minutes+"min"+this.seconds+"s"
}
this.time=this.seconds+"s"
},
},
computed: {
options() {
return {