260330_02_ENH: 연도별 사례수 row에서 Column으로 이동
This commit is contained in:
@@ -55,22 +55,26 @@ const PurchasePage = () => {
|
||||
|
||||
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 purchaseRowsWithGap = useMemo(() => {
|
||||
return withGapRow(wrapSampleRow(purchaseRows, false), calcGapProductRow, -1, -3);
|
||||
return withGapRow(wrapSampleRow(purchaseRows, false), calcGapProductRow, -1, -2);
|
||||
}, [purchaseRows]);
|
||||
|
||||
const purchaseTableRows = useMemo<TopChartTableRow[]>(() => {
|
||||
return purchaseRowsWithGap.map((row) => ({
|
||||
label: formatRowLabel(row.rowLabel),
|
||||
sample: row.sample,
|
||||
total: row.total,
|
||||
values: PRODUCT_KEYS.map((k) => (row as any)[k] ?? null),
|
||||
}));
|
||||
@@ -100,7 +104,7 @@ const PurchasePage = () => {
|
||||
|
||||
useEffect(() => {
|
||||
registerExcelExporter(async () => {
|
||||
const excelHeader = buildHeader_ProductKeyMap(PRODUCT_KEY_MAP);
|
||||
const excelHeader = buildHeader_ProductKeyMap(PRODUCT_KEY_MAP, "sample");
|
||||
|
||||
await exportDashboardExcel({
|
||||
fileName: `${SITE_TITLE}(구매율).xlsx`,
|
||||
|
||||
Reference in New Issue
Block a user