fix: 修改 statistics 显示
This commit is contained in:
parent
1154b3ce80
commit
5cc8399e15
|
@ -5,8 +5,6 @@
|
||||||
stripe
|
stripe
|
||||||
border
|
border
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
show-summary
|
|
||||||
:summary-method="getSummaries"
|
|
||||||
>
|
>
|
||||||
<el-table-column label="Requests" fixed width="450" align="center">
|
<el-table-column label="Requests" fixed width="450" align="center">
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
@ -107,57 +105,6 @@
|
||||||
this.tableData = [];
|
this.tableData = [];
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getSummaries(param) {
|
|
||||||
const {data} = param;
|
|
||||||
const sums = [];
|
|
||||||
let allSamples = data.reduce(function (total, currentValue) {
|
|
||||||
return total + parseFloat(currentValue.samples);
|
|
||||||
}, 0);
|
|
||||||
let failSize = data.reduce(function (total, currentValue) {
|
|
||||||
return total + parseFloat(currentValue.ko);
|
|
||||||
}, 0);
|
|
||||||
let averageTimeTotal = data.reduce(function (total, currentValue) {
|
|
||||||
return total + parseFloat(currentValue.average) * parseFloat(currentValue.samples);
|
|
||||||
}, 0);
|
|
||||||
let tp90Total = data.reduce(function (total, currentValue) {
|
|
||||||
return total + parseFloat(currentValue.tp90) * parseFloat(currentValue.samples);
|
|
||||||
}, 0);
|
|
||||||
let tp95Total = data.reduce(function (total, currentValue) {
|
|
||||||
return total + parseFloat(currentValue.tp95) * parseFloat(currentValue.samples);
|
|
||||||
}, 0);
|
|
||||||
let tp99Total = data.reduce(function (total, currentValue) {
|
|
||||||
return total + parseFloat(currentValue.tp99) * parseFloat(currentValue.samples);
|
|
||||||
}, 0);
|
|
||||||
let transactions = data.reduce(function (total, currentValue) {
|
|
||||||
return total + parseFloat(currentValue.transactions);
|
|
||||||
}, 0);
|
|
||||||
transactions = transactions.toFixed(2);
|
|
||||||
let received = data.reduce(function (total, currentValue) {
|
|
||||||
return total + parseFloat(currentValue.received);
|
|
||||||
}, 0);
|
|
||||||
received = received.toFixed(2);
|
|
||||||
let sent = data.reduce(function (total, currentValue) {
|
|
||||||
return total + parseFloat(currentValue.sent);
|
|
||||||
}, 0);
|
|
||||||
sent = sent.toFixed(2);
|
|
||||||
|
|
||||||
let error = (Math.round(failSize / allSamples * 10000) / 100) + '%';
|
|
||||||
let averageTime = (averageTimeTotal / allSamples).toFixed(2);
|
|
||||||
let tp90 = (tp90Total / allSamples).toFixed(2);
|
|
||||||
let tp95 = (tp95Total / allSamples).toFixed(2);
|
|
||||||
let tp99 = (tp99Total / allSamples).toFixed(2);
|
|
||||||
let min = Math.min.apply(Math, data.map(function (o) {
|
|
||||||
return parseFloat(o.min)
|
|
||||||
}));
|
|
||||||
let max = Math.max.apply(Math, data.map(function (o) {
|
|
||||||
return parseFloat(o.max)
|
|
||||||
}));
|
|
||||||
|
|
||||||
sums.push('Total', allSamples, failSize, error, averageTime, min, max, tp90, tp95, tp99, transactions, received, sent);
|
|
||||||
|
|
||||||
return sums;
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
report: {
|
report: {
|
||||||
|
|
Loading…
Reference in New Issue