From 216bd9c0e60272b26f33aab3072bbdc688d015aa Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 20 May 2024 14:33:11 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20GH=E4=BE=8B=E4=BC=9A:=20=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E6=95=B0=E6=8D=AE:=20=E5=A5=BD=E8=AF=84=E6=80=BB?= =?UTF-8?q?=E6=95=B0,=20AH,=20GH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/MeetingData.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/stores/MeetingData.js b/src/stores/MeetingData.js index 77f0ae3..8640e77 100644 --- a/src/stores/MeetingData.js +++ b/src/stores/MeetingData.js @@ -310,13 +310,15 @@ class MeetingData { // 走团数 const { ordercountTotal1: { OrderCount: GroupCount } } = await getOrderCountByType({ ...serviceParam, 'DepartmentList': '1', OrderType: 'Form' }); const exceptCHDataWeek = await getDetailData({ ...serviceParam, 'DepartmentList': '28,33' }); - // 好评数 - const { total1: { GoodCount } } = await getAgentGroupInfoALL({ ...serviceParam, 'DepartmentList': '1', }); // 走团数 - 年 const yearStart = moment().startOf("year").format(DATE_FORMAT); const { ordercountTotal1: { OrderCount: GroupCountYear } } = await getOrderCountByType({ ...serviceParam, 'DepartmentList': '1', OrderType: 'Form', Date1: yearStart, }); const exceptCHDataYear = await getDetailData({ ...serviceParam, Date1: yearStart, 'DepartmentList': '28,33' }); + // 好评数 + const { total1: { GoodCount } } = await getAgentGroupInfoALL({ ...serviceParam, 'DepartmentList': '1', }); const { total1: { GoodCount: GoodCountYear } } = await getAgentGroupInfoALL({ ...serviceParam, Date1: yearStart, 'DepartmentList': '1', }); + const { total1: { GoodCount: GHGoodCountWeek } } = await getAgentGroupInfoALL({ ...serviceParam, 'DepartmentList': '28,33', }); + const { total1: { GoodCount: GHGoodCountYear } } = await getAgentGroupInfoALL({ ...serviceParam, Date1: yearStart, 'DepartmentList': '28,33', }); const rows = [ { key: 'ch', label: '中国', ...{GoodCount, GroupCount}, rowYear: { GroupCount: GroupCountYear, GoodCount: GoodCountYear } }, @@ -325,8 +327,10 @@ class MeetingData { { key: 'in', label: '印度+', ...dataSales('in', exceptCHDataWeek, exceptCHDataYear, []) }, { key: 'other', label: '其他GH', ...dataSalesGHOther(exceptCHDataWeek, exceptCHDataYear, []) }, ]; - const columnsSum = ['GoodCount', 'GroupCount'].reduce((r, col) => ({ ...r, [col]: rows.reduce((rr, row) => rr + (row[col] || 0), 0) }), {}); - const allYearData = rows.map(row => row.rowYear); + const GHRowWeek = { GoodCount: GHGoodCountWeek, GroupCount: 0 }; + const columnsSum = ['GoodCount', 'GroupCount'].reduce((r, col) => ({ ...r, [col]: [...rows, GHRowWeek].reduce((rr, row) => rr + (row[col] || 0), 0) }), {}); + const allYearData = rows.map((row) => row.rowYear).concat([{ GoodCount: GHGoodCountYear, GroupCount: 0 }]); + // console.log(allYearData); const rowYear = ['GoodCount', 'GroupCount', ].reduce((r, col) => ({ ...r, [col]: allYearData.reduce((rr, row) => rr + (row[col] || 0), 0) }), {}); rows.push({ key: 'columnSum', label: '合计', ...columnsSum, rowYear }); // console.log(rows);