From 2efd2e26695550ee842e8fc125ba758e7b50a871 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 9 Oct 2023 14:14:27 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=B8=9A=E7=BB=A9=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3:=20=E7=A1=AE=E4=BF=9D=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/Trade.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/stores/Trade.js b/src/stores/Trade.js index c1bea7d..88c0e4b 100644 --- a/src/stores/Trade.js +++ b/src/stores/Trade.js @@ -61,10 +61,9 @@ class Trade { Object.assign(queryData, { groupDateType: this.timeLineKey }); this.fetchTradeData(queryData).then((json) => { if (json.errcode === 0) { + const data = json.result1.sort(sortBy('groupDateVal')); runInAction(() => { - const data = json.result1; // 标注KPI - this.timeData.loading = false; this.timeData.dataSource = data; }); @@ -80,8 +79,8 @@ class Trade { Object.assign(queryData, { groupType: 'bu', groupDateType: 'year' }); this.fetchTradeData(queryData).then((json) => { if (json.errcode === 0) { + const data = json.result1; runInAction(() => { - const data = json.result1; // 标注KPI this.BuData.loading = false; @@ -117,14 +116,14 @@ class Trade { Object.assign(queryData, { groupType: 'bizarea', groupDateType: 'month' }); this.fetchTradeData(queryData).then((json) => { if (json.errcode === 0) { + const sortResult = json.result1.sort(sortBy('groupDateVal')); + const groupsData = sortResult.reduce((r, v) => { + if (v.groupsLabel ) { // && ['91001', '91006'].includes(v.groupsKey) + (r[v.groupsLabel] || (r[v.groupsLabel] = [])).push(v); + } + return r; + }, {}); runInAction(() => { - const sortResult = json.result1.sort(sortBy('groupDateVal')); - const groupsData = sortResult.reduce((r, v) => { - if (v.groupsLabel ) { // && ['91001', '91006'].includes(v.groupsKey) - (r[v.groupsLabel] || (r[v.groupsLabel] = [])).push(v); - } - return r; - }, {}); this.sideData.loading = false; this.sideData.dataSource = groupsData; this.sideData.monthData = sortResult;