260330_02_ENH: 연도별 사례수 row에서 Column으로 이동
This commit is contained in:
@@ -55,28 +55,34 @@ const LGPurchasePage = () => {
|
||||
|
||||
const purchaseRows =
|
||||
data?.statisticsDataMap?.purchase
|
||||
.filter((r) => r.rowLabel == `구매` || r.rowLabel == `사례수`)
|
||||
.filter((r) => r.rowLabel == `구매`)
|
||||
.map((row) => {
|
||||
const rowLabel = row.rowLabel == `사례수`? `${formatRowLabel(row.year)} ${row.rowLabel}` : row.year;
|
||||
const rowSample = data?.statisticsDataMap?.purchase
|
||||
.find(r => r.rowLabel == '사례수' && r.year == row.year)?.total ?? 0;
|
||||
|
||||
return {
|
||||
...row,
|
||||
rowLabel: rowLabel,
|
||||
rowLabel: row.year,
|
||||
sample: `(${rowSample})`,
|
||||
}
|
||||
}) ?? [];
|
||||
|
||||
const purchaseLGRows =
|
||||
data?.statisticsDataMap?.purchase_lg
|
||||
.filter((row) => row.rowLabel === `구입` || row.rowLabel == `사례수`)
|
||||
.filter((row) => row.rowLabel === `구입`)
|
||||
.map((row) => {
|
||||
const rowLabel = row.rowLabel == `사례수`? `${formatRowLabel(row.year)} ${row.rowLabel}` : row.year;
|
||||
const rowSample = data?.statisticsDataMap?.purchase_lg
|
||||
.find(r => r.rowLabel == '사례수' && r.year == row.year)?.total ?? 0;
|
||||
|
||||
return {
|
||||
...row,
|
||||
rowLabel: rowLabel,
|
||||
rowLabel: row.year,
|
||||
sample: `(${rowSample})`,
|
||||
}
|
||||
}) ?? [];
|
||||
|
||||
const purchaseLGRowsWithGap = useMemo(() => {
|
||||
const withGap = withGapRow(wrapSampleRow(purchaseLGRows, false), calcGapProductRow, -1, -3);
|
||||
const withGap = withGapRow(wrapSampleRow(purchaseLGRows, false), calcGapProductRow, -1, -2);
|
||||
return withTotalBaseRow("구입율",purchaseRows, withGap, calcTotalBaseRow);
|
||||
}, [purchaseRows, purchaseLGRows]);
|
||||
|
||||
@@ -99,6 +105,7 @@ const LGPurchasePage = () => {
|
||||
const purchaseTableRows = useMemo<TopChartTableRow[]>(() => {
|
||||
return purchaseLGRowsWithGap.map((row) => ({
|
||||
label: formatRowLabel(row.rowLabel),
|
||||
sample: row.sample,
|
||||
total: row.total,
|
||||
values: includeProductKeys.map((k) => (row as any)[k] ?? null),
|
||||
}));
|
||||
@@ -146,7 +153,7 @@ const LGPurchasePage = () => {
|
||||
|
||||
useEffect(() => {
|
||||
registerExcelExporter(async () => {
|
||||
const excelHeader = buildHeader_ProductKeyMap(productKeyMap);
|
||||
const excelHeader = buildHeader_ProductKeyMap(productKeyMap, "sample");
|
||||
|
||||
await exportDashboardExcel({
|
||||
fileName: `${SITE_TITLE}(LG제품 구매율).xlsx`,
|
||||
|
||||
Reference in New Issue
Block a user