refactor(性能测试): 修改测试报告展示压力配置的逻辑

This commit is contained in:
Captain.B 2020-08-10 18:31:53 +08:00
parent 88a9807dfb
commit 92667da369
1 changed files with 20 additions and 13 deletions

View File

@ -151,20 +151,27 @@ export default {
this.calculateChart(); this.calculateChart();
}, },
getLoadConfig() { getLoadConfig() {
if (!this.report.loadConfiguration) { if (!this.report.id) {
if (!this.report.testId) {
return; return;
} }
this.$get("/performance/report/" + this.report.id, res => {
let data = res.data;
if (data) {
if (data.loadConfiguration) {
let d = JSON.parse(data.loadConfiguration);
this.calculateLoadConfiguration(d);
} else {
this.$get('/performance/get-load-config/' + this.report.testId, (response) => { this.$get('/performance/get-load-config/' + this.report.testId, (response) => {
if (response.data) { if (response.data) {
let data = JSON.parse(response.data); let data = JSON.parse(response.data);
this.calculateLoadConfiguration(data); this.calculateLoadConfiguration(data);
} }
}); });
} else {
let data = JSON.parse(this.report.loadConfiguration);
this.calculateLoadConfiguration(data);
} }
} else {
this.$error(this.$t('report.not_exist'))
}
});
}, },
calculateChart() { calculateChart() {
if (this.duration < this.rampUpTime) { if (this.duration < this.rampUpTime) {