260515_04_ENH: 조사 및 지역에 대한 노출 config 기준으로 되도록 수정
This commit is contained in:
@@ -11,7 +11,10 @@ import {
|
||||
CUSTOMER_SATISFACTION_DECIMAL_PLACES,
|
||||
CUSTOMER_SATISFACTION_GAP_SIGN_STYLE,
|
||||
DASHBOARD_METRIC_GROUP_LABEL_MAP,
|
||||
DASHBOARD_TOTAL_TITLE_BY_CATEGORY, getDashboardTotalTableLayout,
|
||||
DASHBOARD_TOTAL_TITLE_BY_CATEGORY,
|
||||
DIV_KEYS,
|
||||
SUMMARY_CATEGORY_KEYS,
|
||||
getDashboardTotalTableLayout,
|
||||
} from "@/config/kfpaConfig";
|
||||
import { useLayoutFilter } from "@/components/layout/LayoutCategoryContext";
|
||||
import { useCsiSummaryQuery } from "@/query/statistics";
|
||||
@@ -25,16 +28,13 @@ import {
|
||||
} from "@/lib/kfpa-util";
|
||||
import CsiFormulaNote from "@/components/kfpa/CsiFormulaNote";
|
||||
|
||||
const SUMMARY_REGION_KEYS = ["-1", "1", "3", "2", "5", "6", "4"] as const;
|
||||
const SUMMARY_CATEGORY_KEYS = ["2604005_E", "2604005_D", "2604005_C", "2604005_A", "2604005_B"] as const;
|
||||
const SUMMARY_COLUMNS = [...SUMMARY_REGION_KEYS, ...SUMMARY_CATEGORY_KEYS] as const;
|
||||
|
||||
const CustomerSatisfactionSummary = () => {
|
||||
const { statisticsParams } = useLayoutFilter();
|
||||
const { data, isLoading, isError } = useCsiSummaryQuery({ dt: statisticsParams.dt });
|
||||
const tableLayout = useMemo(() => getDashboardTotalTableLayout("-1"), ["-1"]);
|
||||
const tableLayout = getDashboardTotalTableLayout("-1");
|
||||
|
||||
const { columns, categories, rows, chartData } = useMemo(() => {
|
||||
const summaryColumns = [...DIV_KEYS, ...SUMMARY_CATEGORY_KEYS];
|
||||
const waves = Array.from(
|
||||
new Set(
|
||||
Object.values(data ?? {})
|
||||
@@ -48,15 +48,15 @@ const CustomerSatisfactionSummary = () => {
|
||||
const selectedWaves = latestWave == null ? [] : [latestWave - 1, latestWave];
|
||||
const currentWave = selectedWaves.at(-1);
|
||||
|
||||
const columns: DataColumn<Record<string, unknown>>[] = SUMMARY_COLUMNS.map((key) => ({
|
||||
const columns: DataColumn<Record<string, unknown>>[] = summaryColumns.map((key) => ({
|
||||
key,
|
||||
header: getSummaryColumnLabel(key),
|
||||
headerClassName: key === "-1" || SUMMARY_CATEGORY_KEYS.includes(key as (typeof SUMMARY_CATEGORY_KEYS)[number])
|
||||
headerClassName: key === "-1" || SUMMARY_CATEGORY_KEYS.includes(key)
|
||||
? "bg-summary"
|
||||
: undefined,
|
||||
align: "center",
|
||||
}));
|
||||
const categories = SUMMARY_COLUMNS.map(getSummaryColumnLabel);
|
||||
const categories = summaryColumns.map(getSummaryColumnLabel);
|
||||
|
||||
const rows: TopChartTableRow[] =
|
||||
selectedWaves.length === 0 || currentWave == null
|
||||
@@ -64,7 +64,7 @@ const CustomerSatisfactionSummary = () => {
|
||||
: [
|
||||
{
|
||||
label: "응답건수",
|
||||
values: SUMMARY_COLUMNS.map((key) => getSummarySampleCount(data, getSummaryDataKey(key), currentWave)),
|
||||
values: summaryColumns.map((key) => getSummarySampleCount(data, getSummaryDataKey(key), currentWave)),
|
||||
preAppendCells: [
|
||||
{
|
||||
content: "",
|
||||
@@ -79,7 +79,7 @@ const CustomerSatisfactionSummary = () => {
|
||||
},
|
||||
{
|
||||
label: GAP_WORDING,
|
||||
values: SUMMARY_COLUMNS.map((key) =>
|
||||
values: summaryColumns.map((key) =>
|
||||
getSummaryGapValue(data, getSummaryDataKey(key), selectedWaves[0], currentWave)
|
||||
),
|
||||
preAppendCells: [
|
||||
@@ -95,7 +95,7 @@ const CustomerSatisfactionSummary = () => {
|
||||
},
|
||||
...selectedWaves.map((wave) => ({
|
||||
label: getWaveLabel(wave),
|
||||
values: SUMMARY_COLUMNS.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave)),
|
||||
values: summaryColumns.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave)),
|
||||
labelClassName: "bg-csi text-center font-bold",
|
||||
labelWidth: 80,
|
||||
})),
|
||||
@@ -105,7 +105,7 @@ const CustomerSatisfactionSummary = () => {
|
||||
categories,
|
||||
series: selectedWaves.map((wave) => ({
|
||||
name: getWaveLabel(wave),
|
||||
data: SUMMARY_COLUMNS.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave) ?? null),
|
||||
data: summaryColumns.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave) ?? null),
|
||||
})),
|
||||
};
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ const MainLayout = ({ children }: MainLayoutProps) => {
|
||||
[pathname]
|
||||
);
|
||||
const activeTopMenuId = activeTopMenu?.id ?? "";
|
||||
const shouldShowFooter = activeTopMenuId === "-1";
|
||||
const sideMenus = useMemo(
|
||||
() => SIDE_MENUS_BY_TOP_MENU[activeTopMenuId] ?? [],
|
||||
[activeTopMenuId]
|
||||
|
||||
@@ -13,6 +13,7 @@ export const CUSTOMER_SATISFACTION_GAP_SIGN_STYLE: SignStyle<TopChartTableRow> =
|
||||
paint: "text",
|
||||
};
|
||||
|
||||
//조사에 대한 조정은 여기서
|
||||
export const CATEGORY_KEY_MAP: Record<string, string> = {
|
||||
"-1": "전체 현황",
|
||||
"2601009_A": "안전점검",
|
||||
@@ -41,10 +42,15 @@ const toKeyMap = <T extends KeyLabelEntries>(entries: T) =>
|
||||
const toKeys = <T extends KeyLabelEntries>(entries: T) =>
|
||||
entries.map(([key]) => key) as Array<T[number][0]>;
|
||||
|
||||
export const CATEGORY_KEYS = Object.keys(CATEGORY_KEY_MAP) as Array<keyof typeof CATEGORY_KEY_MAP>;
|
||||
export const CATEGORY_KEYS = Object.keys(CATEGORY_KEY_MAP);
|
||||
|
||||
export const CATEGORIES = Object.values(CATEGORY_KEY_MAP) as Array<string>;
|
||||
|
||||
export const SUMMARY_CATEGORY_KEYS = CATEGORY_KEYS.filter(
|
||||
(key) => key !== "-1" && key !== "2601009_A"
|
||||
);
|
||||
|
||||
//지역에 대한 조정은 여기서
|
||||
const DIV_KEY_ENTRIES = [
|
||||
["-1", "전체"],
|
||||
["1", "서울인천지역본부"],
|
||||
|
||||
Reference in New Issue
Block a user