refactor(性能测试): 修改日志详情查询

This commit is contained in:
CaptainB 2022-06-21 10:18:50 +08:00 committed by f2c-ci-robot[bot]
parent 282aafb231
commit 6822146dd4
1 changed files with 13 additions and 25 deletions

View File

@ -13,9 +13,9 @@
</el-select>
</el-col>
<el-col :span="20">
<div v-if="currentInstance" class="logging-content">
<div class="logging-content" v-loading="loading">
<ul class="infinite-list">
<li class="infinite-list-item" v-for="(log, index) in logContent[currentInstance]"
<li class="infinite-list-item" v-for="(log, index) in logContent"
:key="currentInstance+index">
{{ log.content }}
</li>
@ -44,13 +44,12 @@ export default {
data() {
return {
resource: [],
logContent: {},
logContent: [],
result: {},
id: '',
page: {},
page: 1,
pageCount: 5,
loading: false,
logStatus: {},
currentInstance: ''
};
},
@ -74,54 +73,43 @@ export default {
if (!this.currentInstance) {
this.currentInstance = this.resource[0]?.resourceId;
}
this.page = data.map(item => item.resourceId).reduce((result, curr) => {
result[curr] = 1;
return result;
}, {});
this.logContent = data.map(item => item.resourceId).reduce((result, curr) => {
result[curr] = [];
return result;
}, {});
//
if (this.currentInstance) {
this.changeInstance(this.currentInstance);
}
},
load(resourceId) {
if (this.loading || this.page[resourceId] > this.pageCount) {
if (this.loading || this.page > this.pageCount) {
return;
}
this.logStatus[resourceId] = true;
this.loading = true;
if (this.planReportTemplate) {
// this.handleGetLogResourceDetail(this.planReportTemplate.logResourceDetail, resourceId);
} else if (this.isShare) {
getSharePerformanceReportLogResourceDetail(this.shareId, this.id, resourceId, this.page[resourceId] || 1, data => {
getSharePerformanceReportLogResourceDetail(this.shareId, this.id, resourceId, this.page || 1, data => {
this.handleGetLogResourceDetail(data, resourceId);
});
} else {
getPerformanceReportLogResourceDetail(this.id, resourceId, this.page[resourceId] || 1, data => {
getPerformanceReportLogResourceDetail(this.id, resourceId, this.page || 1, data => {
this.handleGetLogResourceDetail(data, resourceId);
});
}
},
handleGetLogResourceDetail(data, resourceId) {
data.listObject.forEach(log => {
if (this.logContent[resourceId]) {
this.logContent[resourceId].push(log);
if (this.logContent) {
this.logContent.push(log);
}
});
this.page[resourceId]++;
this.page++;
this.loading = false;
},
changeInstance(instance) {
this.currentInstance = instance;
if (this.logStatus[instance]) {
return;
}
this.loading = false;
this.page[instance] = 1;
this.logContent[instance] = [];
this.page = 1;
this.logContent = [];
this.load(instance);
},
downloadLogFile(resourceId) {