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);