From 6822146dd46718994975091a6b79270b2dd09eac Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 21 Jun 2022 10:18:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/components/LogDetails.vue | 38 +++++++------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/frontend/src/business/components/performance/report/components/LogDetails.vue b/frontend/src/business/components/performance/report/components/LogDetails.vue index 994a278bb5..ca4a17d3dd 100644 --- a/frontend/src/business/components/performance/report/components/LogDetails.vue +++ b/frontend/src/business/components/performance/report/components/LogDetails.vue @@ -13,9 +13,9 @@ -
+
    -
  • {{ log.content }}
  • @@ -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) {