fix(性能测试): 修复显示报告时测试详情空白的问题

This commit is contained in:
CaptainB 2022-11-08 14:20:18 +08:00 committed by 刘瑞斌
parent 8cf4fd444d
commit 313c4f0b27
2 changed files with 8 additions and 14 deletions

View File

@ -7,7 +7,7 @@
@change="getResource(currentInstance)"> @change="getResource(currentInstance)">
<el-option <el-option
v-for="item in instances" v-for="item in instances"
:key="item.ip+item.port" :key="item.ip+item.port+Math.random()"
:value="item.ip+':'+item.port"> :value="item.ip+':'+item.port">
{{ item.ip }} {{ item.name }} {{ item.ip }} {{ item.name }}
</el-option> </el-option>

View File

@ -339,7 +339,6 @@ export default {
children: 'children', children: 'children',
label: 'label' label: 'label'
}, },
init: false,
refresh: true, refresh: true,
tableData: [], tableData: [],
baseOption: { baseOption: {
@ -471,7 +470,6 @@ export default {
}, },
handleGetCheckOptions(data, reportKey) { handleGetCheckOptions(data, reportKey) {
if (!data || data.length === 0) { if (!data || data.length === 0) {
this.init = false;
return; return;
} }
let yAxisIndex0List = data.filter(m => m.yAxis2 === -1).map(m => m.groupName); let yAxisIndex0List = data.filter(m => m.yAxis2 === -1).map(m => m.groupName);
@ -479,8 +477,6 @@ export default {
this.checkOptions[reportKey] = ['ALL'].concat(yAxisIndex0List); this.checkOptions[reportKey] = ['ALL'].concat(yAxisIndex0List);
}, },
getTotalChart() { getTotalChart() {
this.result.loading = true;
this.totalOption = {}; this.totalOption = {};
this.seriesData = []; this.seriesData = [];
this.baseOption.yAxis = []; this.baseOption.yAxis = [];
@ -497,11 +493,9 @@ export default {
for (let name in this.checkList) { for (let name in this.checkList) {
promises.push(this.getChart(name, this.checkList[name])); promises.push(this.getChart(name, this.checkList[name]));
} }
Promise.all(promises).then((res) => { this.result.loading = Promise.all(promises).then((res) => {
this.handleGetTotalChart(res); this.handleGetTotalChart(res);
}).catch(() => { })
this.result.loading = false;
});
} }
}, },
handleTemplateGetTotalChart() { handleTemplateGetTotalChart() {
@ -695,11 +689,14 @@ export default {
return Array.from(new Set(arr)); return Array.from(new Set(arr));
} }
}, },
created() {
this.id = this.$route.path.split('/')[4];
this.initTableData();
},
watch: { watch: {
'$route'(to) { '$route'(to) {
if (to.name === "perReportView") { if (to.path.startsWith("/performance/report/view/")) {
this.id = to.path.split('/')[4]; this.id = to.path.split('/')[4];
this.init = false;
this.initTableData(); this.initTableData();
} }
}, },
@ -710,9 +707,6 @@ export default {
} }
let status = val.status; let status = val.status;
this.id = val.id; this.id = val.id;
if (this.init) {
return;
}
if (status === "Running") { if (status === "Running") {
this.getTotalChart(); this.getTotalChart();
} else if (status === "Completed") { } else if (status === "Completed") {