Compare commits

...
Author SHA1 Message Date
rsone001 ba2ccf6f97 feat: 입력 > 02. 하수관로 시설별 설치 현황관리 버튼 추가
- tab 6. 시설별 현황 관리 탭에서만 필요한 버튼
2026-02-19 10:21:26 +09:00
chanii8 0149f489a7 Merge branch 'main' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2026-02-19 09:34:30 +09:00
chanii8 b644281348 [st] feat: 검증 항목 상세 다이얼로그 작업 2026-02-13 14:57:20 +09:00
chanii8 1572711749 [common/components] feat: Header 컴포넌트 중앙 네비게이션 ScrollArea 적용 2026-02-13 14:16:18 +09:00
chanii8 93d4cb57e6 Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2026-02-12 17:00:45 +09:00
chanii8 a256379633 [st] feat: 검증 항목 관리 페이지 작업 2026-02-12 16:54:07 +09:00
rsone001 2873d1b0b9 st: fix & refactor: TabDataGrid에서 텝 전환시 컬럼 포맷 및 footer 사라지는 오류 수정, 통계 검토 - 하수 관로 검색 로직 추가 2026-02-12 16:40:03 +09:00
rsone001 12bed29eb9 fix: any type수정중 2026-02-12 13:42:17 +09:00
rsone001 6817d34bc3 Merge remote-tracking branch 'origin/feature/review-skeleton-sein' into iipbs/st/dev 2026-02-12 11:20:26 +09:00
rsone001 efbef8283b feat: 02.하수관로 tab2 시설별 시설현황 컬럼 매칭 2026-02-12 11:10:46 +09:00
rsone001 af7c2a4f6f Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2026-02-12 10:50:13 +09:00
rsone001 60c515a654 st: fix & refactor: 하수도 보급률 입력 조회 response 수정 및 TadaGrid 컴포넌트 Tab state 부모 컴포넌트에서 prop로 전달하도록 수정, grid 데이터를 가져오기 위한 ref prop 수정(TabDataGrid.tsx는 아직 미구현) 2026-02-12 10:50:07 +09:00
chanii8 78e3e8e20e [st] design: 디자인 수정 2026-02-12 10:22:35 +09:00
chanii8 3b23113955 [st] chore: 검증 항목 관리 테이블 컬럼 수정 2026-02-11 15:45:51 +09:00
chanii8 fbe355f6cf [st] feat: DataGrid 컴포넌트에 행 클릭 이벤트 설정 2026-02-11 15:45:38 +09:00
chanii8 c439d3e58a [st] feat: 검증 항목 관리 레이아웃 작업 2026-02-11 15:42:01 +09:00
chanii8 057175b65c [st] rename: 파일명 변경 2026-02-11 15:41:49 +09:00
32 changed files with 3093 additions and 750 deletions
@@ -1,3 +1,3 @@
import { statisticsPage } from "@/pages/statistics";
import { StatisticsPage } from "@/pages/statistics";
export default statisticsPage;
export default StatisticsPage;
+43
View File
@@ -0,0 +1,43 @@
@tailwind components;
@layer components {
.rg-grid .rg-header .rg-table .rg-header-group-cell {
@apply !bg-[#466995] !text-[#fff];
}
.rg-grid .rg-header .rg-table .rg-header-cell {
@apply !bg-[#5987bf] !text-[#fff];
}
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell {
@apply !bg-white;
}
[data-theme="black"] {
.rg-grid .rg-header .rg-table .rg-header-group-cell {
@apply !bg-[#3C4043] !text-[#fff];
}
.rg-grid .rg-header .rg-table .rg-header-cell {
@apply !bg-[#62686d] !text-[#fff];
}
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell {
@apply !bg-[#545556] !text-[#fff];
}
}
[data-theme="red"] {
.rg-grid .rg-header .rg-table .rg-header-group-cell {
@apply !bg-[#646469] !text-[#fff];
}
.rg-grid .rg-header .rg-table .rg-header-cell {
@apply !bg-[#8d8d94] !text-[#fff];
}
}
[data-theme="green"] {
.rg-grid .rg-header .rg-table .rg-header-group-cell {
@apply !bg-[#518585] !text-[#fff];
}
.rg-grid .rg-header .rg-table .rg-header-cell {
@apply !bg-[#6bafae] !text-[#fff];
}
}
}
File diff suppressed because it is too large Load Diff
+122 -18
View File
@@ -162,7 +162,7 @@ function createOnSortingHandler(
const mergeCellCols = columns.filter((c) => c.mergeCells === true && c.fieldName);
const mergeCellCol = mergeCellCols.find((c) => c.fieldName === 'gugun') || mergeCellCols[0];
const groupField = mergeCellCol?.fieldName || null;
const orderByField = 'rgnNm'; // 고정값 또는 설정 가능하게 할 수 있음
const orderByField = 'displayYear'; // 고정값 또는 설정 가능하게 할 수 있음
const hasMergeCells = mergeCellCols.length > 0;
return function onSorting(g: unknown, fields: unknown[], _directions: unknown[]) {
@@ -306,7 +306,7 @@ function createNumberComparer(dp: RealGridDataProviderComparer): (field: string
};
}
const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, rows = [], showHeaderCheckbox = false, rowDataMap, setRowDataMap }: TabDataGridProps) => {
const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, rows = [], showHeaderCheckbox = false, rowDataMap, setRowDataMap, activeTab: activeTabProp, onActiveTabChange }: TabDataGridProps) => {
// 각 탭별로 그리드 ref와 데이터를 관리
const gridRefs = useRef<Map<string, RealGridReact>>(new Map());
const fileInputRefs = useRef<Map<string, HTMLInputElement>>(new Map());
@@ -316,11 +316,14 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r
const { setMessage: alert } = useAlertStore((state) => state);
const activeTabId = useTabStore((state) => state.activeTabId);
const menuList = useTabStore((state) => state.menuList);
const [activeTab, setActiveTab] = useState<string>(() => {
// 초기 활성 탭을 첫 번째 tabKey로 설정
const [internalActiveTab, setInternalActiveTab] = useState<string>(() => {
const firstTab = columnInfo[0];
return firstTab?.tabKey || '';
});
const isControlled = activeTabProp !== undefined;
const activeTab = isControlled ? activeTabProp : internalActiveTab;
const setActiveTab = isControlled ? (onActiveTabChange ?? (() => {})) : setInternalActiveTab;
const exportExcel = (tabKey: string) => {
const currentRowData = rowDataMap.get(tabKey) || [];
@@ -653,22 +656,115 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r
}, [rowDataMap, columnInfo]);
// 활성 탭이 변경될 때마다 fitStyle 재적용 (그리드가 보일 때)
// 탭 전환 시 그리드 레이아웃·푸터·포맷 재적용 (여러 시점 + ResizeObserver)
const appliedTabRef = useRef<string | null>(null);
useEffect(() => {
const gridRef = gridRefs.current.get(activeTab);
if (!gridRef?.gridView) return;
appliedTabRef.current = null;
const currentInfo = columnInfo.find(info => info.tabKey === activeTab);
const columns = currentInfo?.columns;
const columnLayout = currentInfo?.columnLayout;
if (!columns?.length || !columnLayout) return;
const gridView = gridRef.gridView;
// 약간의 지연을 두고 설정 (그리드 렌더링 완료 후)
const timer = setTimeout(() => {
gridView.setDisplayOptions({
fitStyle: GridFitStyle.EVEN
const tryApply = () => {
if (appliedTabRef.current === activeTab) return;
const gridRef = gridRefs.current.get(activeTab);
if (!gridRef?.gridView || !gridRef?.dataProvider) return;
const gridView = gridRef.gridView;
const dp = gridRef.dataProvider as { setFields?: (fields: unknown[]) => void; setRows?: (rows: Record<string, string | number>[]) => void } | undefined;
const tabRowData = rowDataMap.get(activeTab) || [];
try {
if (dp?.setFields) dp.setFields(buildFieldsFromColumns(columns));
gridView.setDisplayOptions({ fitStyle: GridFitStyle.EVEN });
gridView.setColumnLayout?.(columnLayout as ColumnLayoutItem[]);
const hasFooter = columns.some(col => col.footer);
if (hasFooter) {
const hasArrayFooter = columns.some(col => col.footer && Array.isArray(col.footer));
const hasMultiRowFooter = columns.some(col => {
const f = col.footer;
return f && !Array.isArray(f) && 'multiRow' in f && (f as { multiRow?: boolean }).multiRow === true;
});
if (hasArrayFooter || hasMultiRowFooter) {
const lengths = columns.filter(col => col.footer && Array.isArray(col.footer)).map(col => (col.footer as unknown[]).length);
const maxLen = lengths.length ? Math.max(...lengths) : 2;
gridView.setFooters?.(Array.from({ length: maxLen }, () => ({ height: 40 })));
} else {
gridView.footer.height = 40;
}
}
gridView.setOptions?.({ summaryMode: "aggregate" });
if (columns.some(col => col.footer && Array.isArray(col.footer))) {
const columnsWithFooter: RealGridColumnInfo[] = columns.map(col => {
const c: RealGridColumnInfo = {
name: col.name,
fieldName: col.fieldName,
header: col.header,
editable: col.editable,
valueType: col.valueType,
dataFormat: col.dataFormat,
...(col.styleName != null && { styleName: col.styleName }),
...(col.mergeCells && { mergeRule: { criteria: 'value' as const } }),
};
if (col.footer) {
if (Array.isArray(col.footer)) c.footer = col.footer;
else c.footer = { text: col.footer.text, expression: col.footer.expression, numberFormat: col.footer.numberFormat };
}
return c;
});
(gridView as GridViewWithSetColumns).setColumns?.(columnsWithFooter);
columns.forEach(col => {
if (!col.footer || !Array.isArray(col.footer)) return;
try {
const column = gridView.columnByName(col.name);
const footerArr = column?.footer as unknown[] | undefined;
if (footerArr && Array.isArray(footerArr))
col.footer.forEach((item, i) => {
if (item.valueCallback && footerArr[i])
(footerArr[i] as FooterItemWithCallback).valueCallback = item.valueCallback;
});
} catch (_) {}
});
}
columns.forEach(col => {
if (!col.footer || Array.isArray(col.footer)) return;
try {
const column = gridView.columnByName(col.name);
const fo = col.footer as { valueCallback?: (g: unknown, col: unknown, fi: number, cf: unknown, v: unknown) => unknown };
if (column?.footer && fo.valueCallback)
(column.footer as { valueCallback?: typeof fo.valueCallback }).valueCallback = fo.valueCallback;
} catch (_) {}
});
if (dp?.setRows && tabRowData.length) dp.setRows(tabRowData);
gridView.refresh();
appliedTabRef.current = activeTab;
} catch (e) {
console.warn('TabDataGrid activeTab layout re-apply:', e);
}
};
const delays = [200, 500, 1000, 1500];
const timers = delays.map(d => setTimeout(tryApply, d));
const container = document.querySelector(`[data-tab-key="${activeTab}"]`);
let observer: ResizeObserver | null = null;
if (container && typeof ResizeObserver !== 'undefined') {
observer = new ResizeObserver(() => {
if ((container as HTMLElement).offsetWidth > 0) tryApply();
});
gridView.refresh();
}, 50);
observer.observe(container);
}
return () => clearTimeout(timer);
}, [activeTab]);
return () => {
timers.forEach(t => clearTimeout(t));
observer?.disconnect();
};
}, [activeTab, columnInfo, rowDataMap]);
if (columnInfo.length === 0) {
return <div>컬럼 정보가 없습니다.</div>;
@@ -788,7 +884,9 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r
}
</div>
<div className="h-[60vh]" data-tab-key={tabKey}>
{activeTab === tabKey ? (
<RealGridReact
key={tabKey}
ref={(el) => {
if (el) {
gridRefs.current.set(tabKey, el);
@@ -803,10 +901,15 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r
const columns = currentInfo.columns;
const dp = el.dataProvider as { setFields?: (fields: unknown[]) => void } | undefined;
const dp = el.dataProvider as { setFields?: (fields: unknown[]) => void; setRows?: (rows: Record<string, string | number>[]) => void } | undefined;
if (dp?.setFields) {
dp.setFields(buildFieldsFromColumns(columns));
}
// setFields 호출 직후 행 데이터 적용 (realgrid-react의 setRows 타이밍 이슈 방지)
const tabRowData = rowDataMap.get(tabKey) || [];
if (dp?.setRows && tabRowData.length) {
dp.setRows(tabRowData);
}
gridView.setDisplayOptions({
fitStyle: GridFitStyle.EVEN
@@ -1018,7 +1121,7 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r
const onSortingHandler = createOnSortingHandler(columns, setRowData, sortDirRef, originalRowsRef, findGridElement);
(gridView as { onSorting?: (g: unknown, f: unknown[], d: unknown[]) => boolean }).onSorting = onSortingHandler;
}, 0);
}, 150);
}
} else {
gridRefs.current.delete(tabKey);
@@ -1053,6 +1156,7 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r
/>
))}
</RealGridReact>
) : null}
</div>
</div>
</TabsContent>
@@ -6,6 +6,7 @@ import SubmitButton from "@/components/button/SumitButton";
import SaveButton from "@/components/button/SaveButton";
import LastYearDataButton from "@/components/button/LastYearDataButton";
import SubmitExceptionButton from "@/components/button/SubmitExceptionButton";
import InstallationStatusButton from "@/components/button/InstallationStatusButton";
import { RegionalFactStatusInpColumn } from "@/components/util/column/input/sewagePipe/RegionalFactStatusInpColumn";
import { FactInstallStatusInpColumn } from "@/components/util/column/input/sewagePipe/FactInstallStatusInpColumn";
@@ -28,25 +29,25 @@ const SewagePipeInp = () => {
];
const SubmitExceptionFunc = () => {
console.log('submit exception');
// 예외 제출 로직
};
const getLastYearDataFunc = () => {
console.log('get last year data');
// 지난연도 데이터 가져오기 로직
};
const submitFunc = () => {
console.log('submit');
// 제출 로직
};
const saveFunc = () => {
console.log('save');
// 저장 로직
};
const installationStatusFunc = () => {
// 시설별 설치현황관리 로직
};
const [rowDataMap, setRowDataMap] = useState<Map<string, Record<string, string | number>[]>>(new Map());
return (
@@ -60,6 +61,11 @@ const SewagePipeInp = () => {
<SaveButton saveFunc={saveFunc} />
</div>
</div>
<div className="card !py-0">
<div className="flex justify-end items-center gap-[0.6rem] mx-[0.6rem]">
<InstallationStatusButton installationStatusFunc={installationStatusFunc} />
</div>
</div>
<TabDataGrid
columnInfo={SewagePipeInpTapList}
rowDataMap={rowDataMap}
@@ -1,4 +1,4 @@
import { useState, useMemo } from "react";
import { useState, useMemo, useRef } from "react";
import SearchForm from "@/components/module/SearchForm";
// import { DataGrid } from "@rsone/components";
@@ -8,6 +8,7 @@ import SaveButton from "@/components/button/SaveButton";
import LastYearDataButton from "@/components/button/LastYearDataButton";
import SubmitExceptionButton from "@/components/button/SubmitExceptionButton";
import { LoadingWithAnimation } from "@common/components";
import { ConfirmDialog } from "@/shared/ui/confirm-dialog";
import { useAlertStore } from "@/shared/lib";
import { statisticsInputAPi } from "@/entities/statistics/api/statistics-input-service";
@@ -15,9 +16,13 @@ import type { SearchFormValues } from "@/components/type/SearchForm.type";
import type {
SewerageSupplyRateItem,
SewerageSupplyRateRequestParams,
SewerageSupplyRateSaveItem,
} from "@/entities/statistics/model/statistics-input-interface";
import { SeweragePenetrationRateInpColumn } from "@/components/util/column/input/SeweragePenetrationRateInpColumn";
import { toGridRows } from "@/components/util/grid/gridFunction";
import { getFooterSummary } from "@/components/util/grid/footerSummary";
import { getUserInfo } from "../../../../../../packages/common/components/src/api";
import { useConfirm } from "@frontend-opensource/use-react-hooks";
function getSewerageSupplyRateParams(
values: SearchFormValues,
@@ -28,7 +33,6 @@ function getSewerageSupplyRateParams(
gugun: values.gugun === 'ALL' ? '' : values.gugun,
bsnmCd: values.bsnmCd,
yr: overrides?.yr ?? values.year,
demoYr: overrides?.demoYr ?? values.year,
...(overrides?.mode && { mode: overrides.mode }),
};
}
@@ -41,22 +45,38 @@ const SeweragePenetrationRateInp = () => {
const [searchValues, setSearchValues] = useState<SearchFormValues | null>(null);
const [isEnterable, setIsEnterable] = useState<boolean>(true);
const [lastSearchedYear, setLastSearchedYear] = useState<string | null>(null);
const { confirm } = useConfirm();
const [footerFromApi, setFooterFromApi] = useState<{ totalPopl?: number; poplSm?: number; frgnrPoplSm?: number } | null>(null);
const getGridDataRef = useRef<(() => Record<string, string | number>[]) | null>(null);
const footerFieldNames = ['totalPopl', 'poplSm', 'frgnrPoplSm'] as const;
const footerWithApiDefault = (fieldName: (typeof footerFieldNames)[number], numberFormat: string) => ({
expression: 'sum' as const,
numberFormat,
valueCallback: (grid: Parameters<typeof getFooterSummary>[0], column: Parameters<typeof getFooterSummary>[1]) =>
(footerFromApi && footerFromApi[fieldName] != null ? footerFromApi[fieldName] : null) ?? getFooterSummary(grid, column),
});
// 최상위 관리자일땐 모든 상황에서 edit 가능하게 수정 필요.
const columnInfo = useMemo(() => {
const { columns, columnLayout } = SeweragePenetrationRateInpColumn;
const base = isEnterable ? columns : columns.map((col) => ({ ...col, editable: false as const }));
return {
columnLayout,
columns: isEnterable
? columns
: columns.map((col) => ({ ...col, editable: false as const })),
columns: base.map((col) => {
if (col.fieldName === 'totalPopl') return { ...col, footer: footerWithApiDefault('totalPopl', '#,##0') };
if (col.fieldName === 'poplSm') return { ...col, footer: footerWithApiDefault('poplSm', '#,##0') };
if (col.fieldName === 'frgnrPoplSm') return { ...col, footer: footerWithApiDefault('frgnrPoplSm', '#,##0') };
return col;
}),
};
}, [isEnterable]);
}, [isEnterable, footerFromApi]);
const handleReset = () => {
setRowData([]);
setLastSearchedYear(null);
setFooterFromApi(null);
};
const fetchSewerageSupplyRate = async (params: SewerageSupplyRateRequestParams) => {
@@ -64,18 +84,31 @@ const SeweragePenetrationRateInp = () => {
setIsLoading(true);
const response = await statisticsInputAPi.getSewerageSupplyRateList(params);
if (response.status === 'success' && response.data) {
const commonInfo = response.data.commonInfo;
const convertedData: SewerageSupplyRateItem[] = response.data.sewerageSupplyRateList.map((d) => ({
...d,
sido: commonInfo.sido,
speclCntrplnAr: d.speclCntrplnAr === '' || d.speclCntrplnAr === null ? '해당없음' : d.speclCntrplnAr,
piplSupprt: commonInfo.piplSupprt,
}));
setRowData(toGridRows(convertedData));
setFooterFromApi(
commonInfo
? {
totalPopl: commonInfo.bsnmTotalPopl,
poplSm: commonInfo.bsnmPoplSm,
frgnrPoplSm: commonInfo.bsnmFrgnrPoplSm,
}
: null
);
} else {
alert(response.message);
}
} catch {
alert('데이터 조회 중 오류가 발생했습니다.');
setRowData([]);
setFooterFromApi(null);
} finally {
setIsLoading(false);
}
@@ -126,11 +159,91 @@ const SeweragePenetrationRateInp = () => {
// 제출 로직
};
const saveFunc = () => {
// 저장 로직
const saveFunc = async () => {
try {
if (await confirm('저장 하시겠습니까?')) {
setIsLoading(true);
const userInfo = await getUserInfo();
const currentData = getGridDataRef.current?.();
if (!currentData || currentData.length === 0) {
alert('저장할 데이터가 없습니다.');
return;
}
// 컬럼 정의에서 dataFormat 추출 (소수점 자리수 맞추기 위해)
const columnFormatMap = new Map<string, string>();
SeweragePenetrationRateInpColumn.columns.forEach((col) => {
if (col.fieldName && col.dataFormat) {
columnFormatMap.set(col.fieldName, col.dataFormat);
}
});
// 숫자 포맷팅 함수 (dataFormat에 따라 소수점 자리수 맞춤)
const formatNumber = (value: string | number | null | undefined, fieldName: string): number => {
if (value === null || value === undefined || value === '') return 0;
const num = typeof value === 'string' ? parseFloat(value.replace(/,/g, '')) : value;
if (isNaN(num)) return 0;
const format = columnFormatMap.get(fieldName);
if (!format) return num;
// #,##0.000 → 소수점 3자리, #,##0.0 → 소수점 1자리, #,##0 → 정수
const decimalPlaces = format.match(/\.(\d+)/)?.[1]?.length ?? 0;
return decimalPlaces > 0 ? parseFloat(num.toFixed(decimalPlaces)) : Math.round(num);
};
// SaveItem 타입에 정의된 필드만 추출
const convertedData: SewerageSupplyRateSaveItem[] = currentData.map((d) => ({
bsnmCd: searchValues?.bsnmCd ?? '',
sido: d.sido as string,
gugun: (d.gugun as string) || null,
yr: searchValues?.year ?? '',
adstCd: d.adstCd as string,
adstDong: d.adstDong as string,
bstrm: d.bstrm as string,
speclCntrplnAr: d.speclCntrplnAr === '해당없음' ? null : (d.speclCntrplnAr as string | null),
pblswrgPrmTrt: formatNumber(d.pblswrgPrmTrt, 'pblswrgPrmTrt'),
pblswrgScdTrt: formatNumber(d.pblswrgScdTrt, 'pblswrgScdTrt'),
pblswrgTertTrt: formatNumber(d.pblswrgTertTrt, 'pblswrgTertTrt'),
wstrPrmTrt: formatNumber(d.wstrPrmTrt, 'wstrPrmTrt'),
wstrScdTrt: formatNumber(d.wstrScdTrt, 'wstrScdTrt'),
wstrTertTrt: formatNumber(d.wstrTertTrt, 'wstrTertTrt'),
notConectPopltn: formatNumber(d.notConectPopltn, 'notConectPopltn'),
swgeProcZoneInnerAr: formatNumber(d.swgeProcZoneInnerAr, 'swgeProcZoneInnerAr'),
townUnprocPopltn: formatNumber(d.townUnprocPopltn, 'townUnprocPopltn'),
townSwttPopltn: formatNumber(d.townSwttPopltn, 'townSwttPopltn'),
townWrrtnPopltn: formatNumber(d.townWrrtnPopltn, 'townWrrtnPopltn'),
swgeProcZoneOuterAr: formatNumber(d.swgeProcZoneOuterAr, 'swgeProcZoneOuterAr'),
rmk: (d.rmk as string) ?? '',
popltnSm: formatNumber(d.popltnSm, 'popltnSm'),
arSm: formatNumber(d.arSm, 'arSm'),
swgeProcZoneInnerSm: formatNumber(d.swgeProcZoneInnerSm, 'swgeProcZoneInnerSm'),
pblswrgPopltnSm: formatNumber(d.pblswrgPopltnSm, 'pblswrgPopltnSm'),
wstrPopltnSm: formatNumber(d.wstrPopltnSm, 'wstrPopltnSm'),
swgeProcZoneOuterSm: formatNumber(d.swgeProcZoneOuterSm, 'swgeProcZoneOuterSm'),
pblswrgPopltnSuprt: formatNumber(d.pblswrgPopltnSuprt, 'pblswrgPopltnSuprt'),
adtrtPopltnSuprt: formatNumber(d.adtrtPopltnSuprt, 'adtrtPopltnSuprt'),
swrgInstlrt: formatNumber(d.swrgInstlrt, 'swrgInstlrt'),
userId: userInfo.userName,
}));
const response = await statisticsInputAPi.saveSewerageSupplyRate(convertedData);
console.log(convertedData)
console.log(response);
} else {
// 저장 취소
}
} catch {
alert('데이터 저장 중 오류가 발생했습니다.');
} finally {
setIsLoading(false);
}
};
return (
<>
<div className="relative">
<SearchForm onSubmit={handleSearch} onReset={handleReset} onValuesChange={setSearchValues} />
{rowData.length > 0 &&
@@ -159,8 +272,11 @@ const SeweragePenetrationRateInp = () => {
fixedColumns={1}
rowData={rowData}
setRowData={setRowData}
getGridDataRef={getGridDataRef}
/>
</div>
<ConfirmDialog isOpen={false} />
</>
);
};
@@ -1,4 +1,4 @@
import { useState, useMemo } from "react";
import { useState, useMemo, useRef } from "react";
import TabDataGrid from "@/components/module/TabDataGrid";
import SearchForm from "@/components/module/SearchForm";
import SaveButton from "@/components/button/SaveButton";
@@ -10,19 +10,23 @@ import { LoadingWithAnimation } from "@common/components";
import { useAlertStore } from "@/shared/lib";
import { statisticsManagementApi } from "@/entities/statistics/api/statistics-management-service";
import { SewagePipeColumnInfoListRvw } from "@/components/util/column/review/SewagePipeRvwColumn";
import type { ColumnInfoList, ColumnConfig } from "@/components/type/DataGrid.type";
import type { SearchFormValues } from "@/components/type/SearchForm.type";
import { toGridRows } from "@/components/util/grid/gridFunction";
// 하수도 통계 검토 02.하수관로
const SewagePipeRvw = () => {
const { setMessage: alert } = useAlertStore((state) => state);
const [rowDataMap, setRowDataMap] = useState<Map<string, any[]>>(new Map());
const [rowDataMap, setRowDataMap] = useState<Map<string, Record<string, string | number>[]>>(new Map());
const [isLoading, setIsLoading] = useState<boolean>(false);
const [activeTab, setActiveTab] = useState<string>('a');
const searchParamRef = useRef<SearchFormValues | null>(null);
const columnInfo = useMemo(() => {
return SewagePipeColumnInfoListRvw.map((tab: any) => ({
return SewagePipeColumnInfoListRvw.map((tab: ColumnInfoList) => ({
...tab,
columns: tab.columns.map((col: any) => ({
columns: (tab.columns ?? []).map((col: ColumnConfig) => ({
...col,
editable: false as const,
styleName: col.styleName ?? ("rg-cell-readonly" as const),
@@ -30,7 +34,10 @@ const SewagePipeRvw = () => {
}));
}, []);
const handleReset = () => setRowDataMap(new Map());
const handleReset = () => {
setRowDataMap(new Map());
setActiveTab('a');
};
const handleSearch = async (values: SearchFormValues) => {
if (!values.sido || values.sido === 'ALL') {
@@ -38,60 +45,101 @@ const SewagePipeRvw = () => {
return;
}
setActiveTab('a');
setRowDataMap(new Map());
try {
setIsLoading(true);
const response = await statisticsManagementApi.getSewagePipeReviewList({
const searchParam = {
sido: values.sido,
gugun: values.gugun === 'ALL' ? '' : values.gugun,
bsnmCd: values.bsnmCd,
yr: values.year,
});
};
if (response.status === 'success' && response.data) {
const rawList = response.data;
const newRowDataMap = new Map<string, any[]>();
newRowDataMap.set('a', toGridRows(rawList));
searchParamRef.current = searchParam;
const response = await statisticsManagementApi.getSewagePipeReviewRegionalList(searchParam);
if (response?.status === 'success' && response.data) {
const newRowDataMap = new Map<string, Record<string, string | number>[]>();
newRowDataMap.set('a', toGridRows(response.data as object[]));
setRowDataMap(newRowDataMap);
} else {
handleReset();
alert(response.message || "데이터가 없습니다.");
alert(response?.message || "데이터가 없습니다.");
}
} catch (error) {
console.error("조회 에러:", error);
alert('데이터 조회 중 오류가 발생했습니다.');
handleReset();
} finally {
setIsLoading(false);
}
};
const handleActiveTabChange = async (tabKey: string) => {
setActiveTab(tabKey);
const existingAData = rowDataMap.get('a');
const activeTabData = rowDataMap.get(tabKey);
const hasAData = Array.isArray(existingAData) && existingAData.length > 0;
const hasActiveTabData = Array.isArray(activeTabData) && activeTabData.length > 0;
if (hasAData && !hasActiveTabData && searchParamRef.current) {
try {
setIsLoading(true);
let response;
if (tabKey === 'b') {
response = await statisticsManagementApi.getSewagePipeFacilityList(searchParamRef.current);
}
if (response?.status === 'success' && response.data) {
setRowDataMap(prev => {
const next = new Map(prev);
next.set(tabKey, toGridRows(response.data as object[]));
return next;
});
} else {
alert(response?.message || "데이터가 없습니다.");
}
} catch {
alert('데이터 조회 중 오류가 발생했습니다.');
} finally {
setIsLoading(false);
}
}
};
return (
<div className="relative">
<div className="relative">
<SearchForm onSubmit={handleSearch} onReset={handleReset} />
<div className="card !py-0">
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
<ReviewOpinionButton reviewOpinionFunc={() => {}} />
<ApproveButton approveFunc={() => {}} />
<ReturnButton returnFunc={() => {}} />
<SaveButton saveFunc={() => {}} />
<ReviewOpinionButton reviewOpinionFunc={() => { }} />
<ApproveButton approveFunc={() => { }} />
<ReturnButton returnFunc={() => { }} />
<SaveButton saveFunc={() => { }} />
</div>
</div>
{isLoading && (
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent bg-white/50 rounded-lg p-10 flex justify-center items-center">
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
<div className="relative size-[5rem]">
<LoadingWithAnimation color="primary" />
</div>
</div>
)}
<TabDataGrid
columnInfo={columnInfo}
isExcelImport={false}
rowDataMap={rowDataMap}
setRowDataMap={setRowDataMap}
<TabDataGrid
columnInfo={columnInfo}
isExcelImport={false}
rowDataMap={rowDataMap}
setRowDataMap={setRowDataMap}
activeTab={activeTab}
onActiveTabChange={handleActiveTabChange}
/>
</div>
);
@@ -93,7 +93,7 @@ const SeweragePenetrationRateRvw = () => {
</div>
{isLoading && (
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent bg-white/50 rounded-lg p-10 flex justify-center items-center">
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
<div className="relative size-[5rem]">
<LoadingWithAnimation color="primary" />
</div>
@@ -91,7 +91,7 @@ const StatsInputStatusRvw = () => {
</div>
{isLoading && (
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent bg-white/50 rounded-lg p-10 flex justify-center items-center">
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
<div className="relative size-[5rem]">
<LoadingWithAnimation color="primary" />
</div>
@@ -1,7 +1,8 @@
"use client";
import { useState } from "react";
import { DataGrid } from "@rsone/components";
// import { DataGrid } from "@rsone/components";
import DataGrid from "@/components/module/DataGrid";
import SearchForm from "@/components/module/SearchForm";
import {
Button,
@@ -39,7 +40,7 @@ interface VerificationFormValues {
};
}
const ManagementVerificationRule = () => {
const HbStatisticsVerification = () => {
const [verificationHistoryRowData, setVerificationHistoryRowData] =
useState<Record<string, string | number>[]>(
verificationHistoryMockData,
@@ -102,7 +103,7 @@ const ManagementVerificationRule = () => {
<div className="p-2">
{/* 통계 검증 섹션 */}
<div className="mb-6">
<h3 className="px-2 text-[1.5rem] font-semibold">
<h3 className="px-2 text-[1.5rem] font-semibold text-title">
통계 검증
</h3>
@@ -461,8 +462,8 @@ const ManagementVerificationRule = () => {
</div>
{/* 검증 이력 섹션 */}
<div className="mt-8 border-t pt-6">
<h3 className="mb-4 px-2 text-[1.5rem] font-semibold">
<div className="mt-8 border-t border-border pt-6">
<h3 className="mb-4 px-2 text-[1.5rem] font-semibold text-title">
검증 이력
</h3>
<DataGrid
@@ -479,4 +480,4 @@ const ManagementVerificationRule = () => {
);
};
export default ManagementVerificationRule;
export default HbStatisticsVerification;
@@ -0,0 +1,261 @@
"use client";
import DataGrid from "@/components/module/DataGrid";
import {
hbArticleColumnInfo,
imrArticleColumnInfo,
validationArticleColumnInfo,
} from "@/entities/statistics/model/verification-article-column";
import {
Button,
Input,
Label,
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from "@common/components";
import { CodeSelect } from "@/entities/code/ui/code-select";
import { verificationTargetManagementApi } from "@/entities/statistics/api/verification-target-management-service";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
import { ENDPOINT } from "@/shared/config";
import type {
VerificationTargetManagementSearchParams,
VerificationTargetManagementResponse,
} from "@/entities/statistics/model/verification-target-management-interface";
import { VerificationTargetDialog } from "./VerificationTargetDialog";
import { useConfirm } from "@frontend-opensource/use-react-hooks";
const TAB_CONFIG = {
HB: { value: "HB", label: "H-B", columnInfo: hbArticleColumnInfo },
IMR: { value: "IMR", label: "I-MR", columnInfo: imrArticleColumnInfo },
VV: {
value: "VV",
label: "Validation",
columnInfo: validationArticleColumnInfo,
},
} as const;
type TabValue = keyof typeof TAB_CONFIG;
function VerificationArticleManagement() {
const queryClient = useQueryClient();
const { confirm } = useConfirm();
const [activeTab, setActiveTab] = useState<TabValue>("HB");
const [statsCd, setStatsCd] = useState("");
const [vrfcTrgtNm, setVrfcTrgtNm] = useState("");
const [searchParams, setSearchParams] =
useState<VerificationTargetManagementSearchParams>({
vrfcMthdCd: activeTab,
statsCd,
vrfcTrgtNm,
});
const [dialogOpen, setDialogOpen] = useState(false);
const [selectedData, setSelectedData] =
useState<VerificationTargetManagementResponse | null>(null);
const { data: verificationData } = useQuery({
queryKey: [ENDPOINT.STATVERIFY_SERVICE.VRFCTGT_MNG, searchParams],
queryFn: async () => {
const response =
await verificationTargetManagementApi.getVerificationTargetManagementList(
{
vrfcMthdCd: searchParams.vrfcMthdCd,
statsCd: searchParams.statsCd || undefined,
vrfcTrgtNm: searchParams.vrfcTrgtNm || undefined,
},
);
return response;
},
});
const rowData = (verificationData?.content || []) as unknown as Record<
string,
string | number
>[];
const columnInfo = TAB_CONFIG[activeTab].columnInfo;
function handleSearch() {
setSearchParams({
vrfcMthdCd: activeTab,
statsCd,
vrfcTrgtNm,
});
}
function handleInitialize() {
setStatsCd("");
setVrfcTrgtNm("");
setSearchParams({
vrfcMthdCd: activeTab,
statsCd: "",
vrfcTrgtNm: "",
});
}
function handleTabChange(value: string) {
const newTab = value as TabValue;
setActiveTab(newTab);
setSearchParams({
vrfcMthdCd: newTab,
statsCd,
vrfcTrgtNm,
});
}
const updateMutation = useMutation({
mutationFn: (data: VerificationTargetManagementResponse) =>
verificationTargetManagementApi.updateVerificationTargetManagement(
data.vrfcTrgtSn,
{
vrfcMthdCd: data.vrfcMthdCd,
statsCd: data.statsCd,
schmNm: data.schmNm,
tblNm: data.tblNm,
colNm: data.colNm,
pkColNm: data.pkColNm,
ipcrCntVl: data.ipcrCntVl,
pctlCrtrVl: data.pctlCrtrVl,
scopCntCntVl: data.scopCntCntVl,
thrsCntVl: data.thrsCntVl,
useYn: data.useYn,
vrfcTrgtNm: data.vrfcTrgtNm,
},
),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: [ENDPOINT.STATVERIFY_SERVICE.VRFCTGT_MNG],
});
setDialogOpen(false);
},
});
const deleteMutation = useMutation({
mutationFn: (vrfcTrgtSn: number) =>
verificationTargetManagementApi.deleteVerificationTargetManagement(
vrfcTrgtSn,
),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: [ENDPOINT.STATVERIFY_SERVICE.VRFCTGT_MNG],
});
setDialogOpen(false);
},
});
function handleRowClick(rowData: Record<string, string | number>) {
setSelectedData(
rowData as unknown as VerificationTargetManagementResponse,
);
setDialogOpen(true);
}
function handleSubmit(e: React.FormEvent) {
e.preventDefault();
handleSearch();
}
async function handleSave(data: VerificationTargetManagementResponse) {
if (await confirm("저장하시겠습니까?")) {
updateMutation.mutate(data);
}
}
async function handleDelete(vrfcTrgtSn: number) {
if (await confirm("정말 삭제하시겠습니까?")) {
deleteMutation.mutate(vrfcTrgtSn);
}
}
return (
<Tabs
defaultValue="HB"
value={activeTab}
onValueChange={handleTabChange}
>
<TabsList>
{Object.entries(TAB_CONFIG).map(([key, config]) => (
<TabsTrigger
key={key}
value={config.value}
className="!px-[2rem] !py-[0.8rem] !text-[1.2rem]"
>
{config.label}
</TabsTrigger>
))}
</TabsList>
<div className="card card-border !mx-0">
<form onSubmit={handleSubmit}>
<div className="flex items-center gap-4">
<div className="flex items-center gap-4">
<Label className="whitespace-nowrap px-4 text-label">
통계항목
</Label>
<CodeSelect
upCd="STITEM"
value={statsCd}
onValueChange={setStatsCd}
placeholder="선택"
className="w-[16rem]"
/>
</div>
<div className="flex items-center gap-4">
<Label className="whitespace-nowrap px-4 text-label">
검증명
</Label>
<Input
value={vrfcTrgtNm}
onChange={(e) => setVrfcTrgtNm(e.target.value)}
placeholder="검증명"
className="w-[20rem]"
/>
</div>
<div className="ml-auto flex gap-2">
<Button
type="submit"
color="green"
className="h-[3.6rem] w-[80px]"
>
조회
</Button>
<Button
type="button"
color="gray"
className="h-[3.6rem] w-[80px]"
onClick={handleInitialize}
>
초기화
</Button>
</div>
</div>
</form>
</div>
{Object.entries(TAB_CONFIG).map(([key, config]) => (
<TabsContent key={key} value={config.value}>
<DataGrid
columnInfo={columnInfo}
rowData={rowData}
setRowData={() => {}}
onRowClick={handleRowClick}
isExcelImport={false}
/>
</TabsContent>
))}
<VerificationTargetDialog
open={dialogOpen}
onOpenChange={setDialogOpen}
data={selectedData}
onSave={handleSave}
onDelete={handleDelete}
/>
</Tabs>
);
}
export default VerificationArticleManagement;
@@ -0,0 +1,380 @@
"use client";
import {
Button,
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
Input,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
} from "@common/components";
import { CodeSelect } from "@/entities/code/ui/code-select";
import type { VerificationTargetManagementResponse } from "@/entities/statistics/model/verification-target-management-interface";
import {
verificationTargetManagementSchema,
type VerificationTargetManagementFormData,
} from "@/entities/statistics/model/verification-target-management-schema";
import { useEffect } from "react";
import { useForm, Controller } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
interface VerificationTargetDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
data: VerificationTargetManagementResponse | null;
onSave: (data: VerificationTargetManagementResponse) => void;
onDelete: (vrfcTrgtSn: number) => void;
}
export function VerificationTargetDialog({
open,
onOpenChange,
data,
onSave,
onDelete,
}: VerificationTargetDialogProps) {
const {
control,
handleSubmit,
reset,
formState: { errors },
} = useForm<VerificationTargetManagementFormData>({
resolver: zodResolver(verificationTargetManagementSchema),
defaultValues: data || undefined,
});
useEffect(() => {
if (data && open) reset(data);
}, [data, open]);
function onSubmit(formData: VerificationTargetManagementFormData) {
if (!data) return;
onSave({
...data,
...formData,
} as VerificationTargetManagementResponse);
}
function handleDelete() {
if (data?.vrfcTrgtSn) {
onDelete(data.vrfcTrgtSn);
}
}
if (!data) return null;
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-[800px]">
<DialogHeader>
<DialogTitle>검증 항목 상세</DialogTitle>
</DialogHeader>
<form onSubmit={handleSubmit(onSubmit)}>
<Table variant="secondary">
<TableBody>
<TableRow>
<TableHead
className="w-[150px] bg-muted font-medium"
data-required
>
통계항목
</TableHead>
<TableCell>
<Controller
name="statsCd"
control={control}
render={({ field }) => (
<div className="space-y-1">
<CodeSelect
upCd="STITEM"
value={field.value}
onValueChange={
field.onChange
}
placeholder="선택"
/>
{errors.statsCd && (
<p className="text-xs text-red-500">
{errors.statsCd.message}
</p>
)}
</div>
)}
/>
</TableCell>
<TableHead
className="w-[150px] bg-muted font-medium"
data-required
>
검증명
</TableHead>
<TableCell>
<Controller
name="vrfcTrgtNm"
control={control}
render={({ field }) => (
<Input
{...field}
value={field.value || ""}
placeholder="검증명"
/>
)}
/>
</TableCell>
</TableRow>
<TableRow>
<TableHead
className="bg-muted font-medium"
data-required
>
스키마명
</TableHead>
<TableCell>
<Controller
name="schmNm"
control={control}
render={({ field }) => (
<div className="space-y-1">
<Input
{...field}
placeholder="스키마명"
/>
{errors.schmNm && (
<p className="text-xs text-red-500">
{errors.schmNm.message}
</p>
)}
</div>
)}
/>
</TableCell>
<TableHead
className="bg-muted font-medium"
data-required
>
테이블명
</TableHead>
<TableCell>
<Controller
name="tblNm"
control={control}
render={({ field }) => (
<div className="space-y-1">
<Input
{...field}
placeholder="테이블명"
/>
{errors.tblNm && (
<p className="text-xs text-red-500">
{errors.tblNm.message}
</p>
)}
</div>
)}
/>
</TableCell>
</TableRow>
<TableRow>
<TableHead
className="bg-muted font-medium"
data-required
>
컬럼명
</TableHead>
<TableCell>
<Controller
name="colNm"
control={control}
render={({ field }) => (
<div className="space-y-1">
<Input
{...field}
placeholder="컬럼명"
/>
{errors.colNm && (
<p className="text-xs text-red-500">
{errors.colNm.message}
</p>
)}
</div>
)}
/>
</TableCell>
<TableHead
className="bg-muted font-medium"
data-required
>
PK 키
</TableHead>
<TableCell>
<Controller
name="pkColNm"
control={control}
render={({ field }) => (
<div className="space-y-1">
<Input
{...field}
placeholder="PK 키"
/>
{errors.pkColNm && (
<p className="text-xs text-red-500">
{errors.pkColNm.message}
</p>
)}
</div>
)}
/>
</TableCell>
</TableRow>
<TableRow>
<TableHead className="bg-muted font-medium">
중요도 계수(μ)
</TableHead>
<TableCell>
<Controller
name="ipcrCntVl"
control={control}
render={({ field }) => (
<div className="space-y-1">
<Input
type="number"
step="0.1"
value={field.value ?? ""}
onChange={(e) =>
field.onChange(
e.target.value
? Number(
e.target
.value,
)
: null,
)
}
placeholder="(0 ~ 1)"
/>
</div>
)}
/>
</TableCell>
<TableHead className="bg-muted font-medium">
백분위수 기준값(pct)
</TableHead>
<TableCell>
<Controller
name="pctlCrtrVl"
control={control}
render={({ field }) => (
<div className="space-y-1">
<Input
type="number"
step="0.1"
value={field.value ?? ""}
onChange={(e) =>
field.onChange(
e.target.value
? Number(
e.target
.value,
)
: null,
)
}
placeholder="(0 ~ 0.5)"
/>
</div>
)}
/>
</TableCell>
</TableRow>
<TableRow>
<TableHead className="bg-muted font-medium">
스케일 조정 계수(A)
</TableHead>
<TableCell>
<Controller
name="scopCntCntVl"
control={control}
render={({ field }) => (
<Input
type="number"
step="0.05"
value={field.value ?? ""}
onChange={(e) =>
field.onChange(
e.target.value
? Number(
e.target
.value,
)
: null,
)
}
/>
)}
/>
</TableCell>
<TableHead className="bg-muted font-medium">
임계 계수(c)
</TableHead>
<TableCell>
<Controller
name="thrsCntVl"
control={control}
render={({ field }) => (
<Input
type="number"
step="1"
value={field.value ?? ""}
onChange={(e) =>
field.onChange(
e.target.value
? Number(
e.target
.value,
)
: null,
)
}
/>
)}
/>
</TableCell>
</TableRow>
</TableBody>
</Table>
<DialogFooter className="mt-6">
<Button
type="button"
color="gray"
onClick={() => onOpenChange(false)}
>
취소
</Button>
<Button
type="button"
color="red"
onClick={handleDelete}
>
삭제
</Button>
<Button type="submit" color="green">
저장
</Button>
</DialogFooter>
</form>
</DialogContent>
</Dialog>
);
}
+127 -48
View File
@@ -11,28 +11,55 @@ export type RealGridColumnInfo = {
valueType?: import("realgrid").ValueType;
dataFormat?: string;
styleName?: string;
mergeRule?: { criteria: 'value' };
footer?: {
text?: string;
expression?: 'sum' | 'avg' | 'count' | 'max' | 'min';
numberFormat?: string;
valueCallback?: (grid: GridView, column: DataColumn, footerIndex: number, columnFooter: ColumnFooter, value: number | string | undefined) => number | string;
} | Array<{
text?: string;
expression?: 'sum' | 'avg' | 'count' | 'max' | 'min';
numberFormat?: string;
valueCallback?: (grid: GridView, column: DataColumn, footerIndex: number, columnFooter: ColumnFooter, value: number | string | undefined) => number | string;
}>;
mergeRule?: { criteria: "value" };
footer?:
| {
text?: string;
expression?: "sum" | "avg" | "count" | "max" | "min";
numberFormat?: string;
valueCallback?: (
grid: GridView,
column: DataColumn,
footerIndex: number,
columnFooter: ColumnFooter,
value: number | string | undefined,
) => number | string;
}
| Array<{
text?: string;
expression?: "sum" | "avg" | "count" | "max" | "min";
numberFormat?: string;
valueCallback?: (
grid: GridView,
column: DataColumn,
footerIndex: number,
columnFooter: ColumnFooter,
value: number | string | undefined,
) => number | string;
}>;
};
/** setColumns 메서드가 있는 GridView */
export type GridViewWithSetColumns = GridView & { setColumns?: (columns: RealGridColumnInfo[]) => void };
export type GridViewWithSetColumns = GridView & {
setColumns?: (columns: RealGridColumnInfo[]) => void;
};
/** footer 배열 요소에 valueCallback 할당용 */
export type FooterItemWithCallback = { valueCallback?: (grid: GridView, column: DataColumn, footerIndex: number, columnFooter: ColumnFooter, value: number | string | undefined) => number | string };
export type FooterItemWithCallback = {
valueCallback?: (
grid: GridView,
column: DataColumn,
footerIndex: number,
columnFooter: ColumnFooter,
value: number | string | undefined,
) => number | string;
};
export type GridView = {
getSummary(field: string, summary: 'sum' | 'avg' | 'count' | 'max' | 'min'): number | undefined;
getSummary(
field: string,
summary: "sum" | "avg" | "count" | "max" | "min",
): number | undefined;
getDataSource(): {
getRowCount(): number;
getValue(rowIndex: number, field: string): number | string;
@@ -41,7 +68,12 @@ export type GridView = {
getDataRow(itemIndex: number): number;
};
export type MergeCallback = (grid: GridView, column: DataColumn, itemIndex: number, value: number | string | null | undefined) => number | null;
export type MergeCallback = (
grid: GridView,
column: DataColumn,
itemIndex: number,
value: number | string | null | undefined,
) => number | null;
export type DataColumn = {
name: string;
@@ -66,15 +98,28 @@ export type DataFieldValueCallback = (
dataRow: number,
fieldName: string,
fieldNames: string[],
values: unknown[]
values: unknown[],
) => number | string | undefined;
/** 계산 필드 설정 (computedFieldCallbacks.ts 참고) */
export type ComputedFieldConfig =
| { fields: string[]; type: "sum" | "avg" }
| { numeratorFields: string[]; denominatorFields: string[]; type: "pblswrgPopltnSuprtRate" }
| { numeratorFields: string[]; denominatorFields: string[]; type: "adtrtPopltnSuprtRate" }
| { numeratorFields: string[]; denominatorFields: string[]; thirdFields: string[], type: "swrgInstlrtRate" };
| {
numeratorFields: string[];
denominatorFields: string[];
type: "pblswrgPopltnSuprtRate";
}
| {
numeratorFields: string[];
denominatorFields: string[];
type: "adtrtPopltnSuprtRate";
}
| {
numeratorFields: string[];
denominatorFields: string[];
thirdFields: string[];
type: "swrgInstlrtRate";
};
export type ColumnConfig = {
name: string;
@@ -92,18 +137,32 @@ export type ColumnConfig = {
sortPreserveGroupOrder?: SortPreserveGroupOrder;
valueType?: ValueType;
dataFormat?: string;
footer?: {
text?: string;
expression?: 'sum' | 'avg' | 'count' | 'max' | 'min';
numberFormat?: string;
valueCallback?: (grid: GridView, column: DataColumn, footerIndex: number, columnFooter: ColumnFooter, value: number | string | undefined) => number | string;
multiRow?: boolean; // 여러 행 footer 사용 여부
} | Array<{
text?: string;
expression?: 'sum' | 'avg' | 'count' | 'max' | 'min';
numberFormat?: string;
valueCallback?: (grid: GridView, column: DataColumn, footerIndex: number, columnFooter: ColumnFooter, value: number | string | undefined) => number | string;
}>, // RealGrid에서 footer를 배열로 설정할 수 있음
footer?:
| {
text?: string;
expression?: "sum" | "avg" | "count" | "max" | "min";
numberFormat?: string;
valueCallback?: (
grid: GridView,
column: DataColumn,
footerIndex: number,
columnFooter: ColumnFooter,
value: number | string | undefined,
) => number | string;
multiRow?: boolean; // 여러 행 footer 사용 여부
}
| Array<{
text?: string;
expression?: "sum" | "avg" | "count" | "max" | "min";
numberFormat?: string;
valueCallback?: (
grid: GridView,
column: DataColumn,
footerIndex: number,
columnFooter: ColumnFooter,
value: number | string | undefined,
) => number | string;
}>; // RealGrid에서 footer를 배열로 설정할 수 있음
};
export type FooterUserSpan = {
@@ -112,16 +171,19 @@ export type FooterUserSpan = {
text?: string; // 표시할 텍스트
};
export type ColumnLayoutItem = string | {
name: string;
hideChildHeaders?: boolean;
header: { text: string };
items: (string | ColumnLayoutItem)[];
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
} | {
column: string; // 컬럼 이름 (footerUserSpans 사용 시)
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
};
export type ColumnLayoutItem =
| string
| {
name: string;
hideChildHeaders?: boolean;
header: { text: string };
items: (string | ColumnLayoutItem)[];
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
}
| {
column: string; // 컬럼 이름 (footerUserSpans 사용 시)
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
};
export type ColumnInfo = {
columns: ColumnConfig[];
@@ -138,7 +200,7 @@ export type ColumnInfoList = {
isSplitGrid?: boolean; // 5:5 분리형 그리드 유무
left?: ColumnInfoList; // SplitDataGrid용 왼쪽 그리드 정보
right?: ColumnInfoList; // SplitDataGrid용 오른쪽 그리드 정보
}
};
export type DataGridProps = {
columnInfo: ColumnInfo;
@@ -149,7 +211,14 @@ export type DataGridProps = {
fixedColumns?: number; // 고정할 컬럼 개수 (좌측부터)
showHeaderCheckbox?: boolean; // 헤더 체크박스 표시 여부 (기본값: true)
rowData: Record<string, string | number>[];
setRowData: React.Dispatch<React.SetStateAction<Record<string, string | number>[]>>;
setRowData: React.Dispatch<
React.SetStateAction<Record<string, string | number>[]>
>;
/** 저장 등 시점에 그리드 현재 데이터를 가져올 수 있도록 할당 (편집 반영된 값) */
getGridDataRef?: {
current: (() => Record<string, string | number>[]) | null;
};
onRowClick?: (rowData: Record<string, string | number>) => void; // 행 클릭 이벤트
};
export type TabDataGridProps = {
@@ -160,8 +229,14 @@ export type TabDataGridProps = {
onRowsChange?: (rows: Record<string, string | number>[]) => void;
showHeaderCheckbox?: boolean; // 헤더 체크박스 표시 여부 (기본값: true)
rowDataMap: Map<string, Record<string, string | number>[]>;
setRowDataMap: React.Dispatch<React.SetStateAction<Map<string, Record<string, string | number>[]>>>;
setRowDataMap: React.Dispatch<
React.SetStateAction<Map<string, Record<string, string | number>[]>>
>;
isSplitGrid?: boolean; // 5:5 분리형 그리드 유무
/** 활성 탭 키 (제어 모드). 부모에서 넘기면 해당 탭이 선택됨 */
activeTab?: string;
/** 활성 탭 변경 시 호출 (제어 모드). activeTab과 함께 넘기면 부모가 탭 상태를 가짐 */
onActiveTabChange?: (tabKey: string) => void;
};
export type SplitDataGridProps = {
@@ -172,6 +247,10 @@ export type SplitDataGridProps = {
showHeaderCheckbox?: boolean;
leftRowData: Record<string, string | number>[];
rightRowData: Record<string, string | number>[];
setLeftRowData: React.Dispatch<React.SetStateAction<Record<string, string | number>[]>>;
setRightRowData: React.Dispatch<React.SetStateAction<Record<string, string | number>[]>>;
};
setLeftRowData: React.Dispatch<
React.SetStateAction<Record<string, string | number>[]>
>;
setRightRowData: React.Dispatch<
React.SetStateAction<Record<string, string | number>[]>
>;
};
@@ -1,4 +1,4 @@
import { footerInt, footerDecimal1, footerDecimal3, footerAvgDecimal } from "@/components/util/grid/footerSummary";
import { footerInt, footerDecimal3, footerAvgDecimal } from "@/components/util/grid/footerSummary";
import { ValueType } from "realgrid";
/**
* 하수도 통계 관리 > 01. 하수도 보급률
@@ -32,7 +32,17 @@ export const SeweragePenetrationRateInpColumn = {
{ name: 'area', fieldName: 'area', header: { text: '행정참고자료면적(㎢)' }, footer: footerDecimal3, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' },
// 총인구
{ name: 'popltnSm', fieldName: 'popltnSm', header: { text: '총인구(명)' }, footer: footerInt, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
{
name: 'popltnSm',
fieldName: 'popltnSm',
header: { text: '총인구(명)' },
footer: footerInt,
editable: false,
valueType: ValueType.NUMBER,
dataFormat: '#,##0',
computed: { fields: ['pblswrgPrmTrt', 'pblswrgScdTrt', 'pblswrgTertTrt', 'wstrPrmTrt', 'wstrScdTrt', 'wstrTertTrt', 'notConectPopltn', 'townUnprocPopltn', 'townSwttPopltn', 'townWrrtnPopltn'], type: 'sum' as const },
styleName: 'rg-cell-total',
},
// 총면적
{
@@ -55,7 +65,7 @@ export const SeweragePenetrationRateInpColumn = {
editable: false,
valueType: ValueType.NUMBER,
dataFormat: '#,##0',
computed: { fields: ['pblswrgPrmTrt', 'pblswrgScdTrt', 'pblswrgTertTrt', 'wstrPrmTrt', 'wstrScdTrt', 'wstrTertTrt'], type: 'sum' as const },
computed: { fields: ['pblswrgPrmTrt', 'pblswrgScdTrt', 'pblswrgTertTrt', 'wstrPrmTrt', 'wstrScdTrt', 'wstrTertTrt', 'notConectPopltn'], type: 'sum' as const },
styleName: 'rg-cell-total',
},
@@ -170,6 +180,7 @@ export const SeweragePenetrationRateInpColumn = {
{ name: 'rmk', fieldName: 'rmk', header: { text: '비고' } },
{ name: 'piplSupprt', fieldName: 'piplSupprt', header: { text: '하수관로보급률(%)' }, visible: false },
{ name: 'adstCd', fieldName: 'adstCd', header: { text: '행정코드' }, visible: false },
],
columnLayout: [
@@ -240,5 +251,6 @@ export const SeweragePenetrationRateInpColumn = {
'swrgInstlrt',
'rmk',
'piplSupprt',
'adstCd',
]
};
@@ -18,7 +18,188 @@ const rawList = [
mergeCells: true,
editable: false,
sortdisable: true,
footer: [
footer: [
{
valueCallback: (grid: GridView, column: DataColumn, footerIndex: number, columnFooter: ColumnFooter, value: number | string | undefined) => {
const divisionIndex = 0;
const dataSource = grid.getDataSource();
const rowCount = dataSource.getRowCount();
const uniqueValues = new Set<string>();
for (let i = 0; i < rowCount; i++) {
const divisionValue = dataSource.getValue(i, 'displayYear');
if (divisionValue !== null && divisionValue !== undefined && divisionValue !== '') {
uniqueValues.add(String(divisionValue));
}
}
const divisionValues = Array.from(uniqueValues);
if (divisionValues.length > divisionIndex) return divisionValues[divisionIndex] + '합계';
return '합계';
}
},
{
valueCallback: (grid: GridView, column: DataColumn, footerIndex: number, columnFooter: ColumnFooter, value: number | string | undefined) => {
const divisionIndex = 1;
const dataSource = grid.getDataSource();
const rowCount = dataSource.getRowCount();
const uniqueValues = new Set<string>();
for (let i = 0; i < rowCount; i++) {
const divisionValue = dataSource.getValue(i, 'displayYear');
if (divisionValue !== null && divisionValue !== undefined && divisionValue !== '') {
uniqueValues.add(String(divisionValue));
}
}
const divisionValues = Array.from(uniqueValues);
if (divisionValues.length > divisionIndex) return divisionValues[divisionIndex] + '합계';
return '합계';
}
}
]
},
{ name: 'gugun', fieldName: 'gugun', header: { text: '시군구' }, mergeCells: true, editable: false, sortdisable: true },
{ name: 'adstDong', fieldName: 'adstDong', header: { text: '행정구역명' }, editable: false },
{
name: 'displayYear',
fieldName: 'displayYear',
header: { text: '구분' },
editable: false,
sortdisable: true,
footer: [
{
valueCallback: (grid: GridView, column: DataColumn, footerIndex: number, columnFooter: ColumnFooter, value: number | string | undefined) => {
const divisionIndex = 0;
const dataSource = grid.getDataSource();
const rowCount = dataSource.getRowCount();
const uniqueValues = new Set<string>();
for (let i = 0; i < rowCount; i++) {
const divisionValue = dataSource.getValue(i, 'displayYear');
if (divisionValue !== null && divisionValue !== undefined && divisionValue !== '') {
uniqueValues.add(String(divisionValue));
}
}
const divisionValues = Array.from(uniqueValues);
return divisionValues.length > divisionIndex ? divisionValues[divisionIndex] + '합계' : '';
}
},
{
valueCallback: (grid: GridView, column: DataColumn, footerIndex: number, columnFooter: ColumnFooter, value: number | string | undefined) => {
const divisionIndex = 1;
const dataSource = grid.getDataSource();
const rowCount = dataSource.getRowCount();
const uniqueValues = new Set<string>();
for (let i = 0; i < rowCount; i++) {
const divisionValue = dataSource.getValue(i, 'displayYear');
if (divisionValue !== null && divisionValue !== undefined && divisionValue !== '') {
uniqueValues.add(String(divisionValue));
}
}
const divisionValues = Array.from(uniqueValues);
return divisionValues.length > divisionIndex ? divisionValues[divisionIndex] + '합계' : '';
}
}
]
},
/* 하수정비 기본계획 */
{ name: 'targetYr', fieldName: 'targetYr', header: { text: '하수정보기본계획목표년도' } },
{ name: 'piplImprmnPlanExtn', fieldName: 'piplImprmnPlanExtn', header: { text: '총관로정비\n계획연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'piplPlanExtn', fieldName: 'piplPlanExtn', header: { text: '총계획연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'piplFcltyExtn', fieldName: 'piplFcltyExtn', header: { text: '총시설연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'piplSupprt', fieldName: 'piplSupprt', header: { text: '하수관로\n보급률(%)' }, footer: footerAvgDecimalArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
/* 합류식(m) */
{ name: 'cmbnPlanAr', fieldName: 'cmbnPlanAr', header: { text: '관로정비\n계획면적(㎢)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'cmbnImprmnPlanExtn', fieldName: 'cmbnImprmnPlanExtn', header: { text: '관로정비\n계획연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnPlanExtn', fieldName: 'cmbnPlanExtn', header: { text: '계획연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnFcltyExtn', fieldName: 'cmbnFcltyExtn', header: { text: '시설연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnRctglExtn', fieldName: 'cmbnRctglExtn', header: { text: '사각형(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnCicleExtn', fieldName: 'cmbnCicleExtn', header: { text: '원형(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnOpswrExtn', fieldName: 'cmbnOpswrExtn', header: { text: '개거(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnSdgttrExtn', fieldName: 'cmbnSdgttrExtn', header: { text: '측구(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
/* 분류식 - 오수관로 */
{ name: 'pltwtrPlanAr', fieldName: 'pltwtrPlanAr', header: { text: '관로정비\n계획면적(㎢)' }, footer: footerDecimal3ArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'pltwtrImprmnPlanExtn', fieldName: 'pltwtrImprmnPlanExtn', header: { text: '관로정비\n계획연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'pltwtrPlanExtn', fieldName: 'pltwtrPlanExtn', header: { text: '계획연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'pltwtrFlctyExtn', fieldName: 'pltwtrFlctyExtn', header: { text: '시설연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'pltwtrSqreExtn', fieldName: 'pltwtrSqreExtn', header: { text: '사각형(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'pltwtrCiclExtn', fieldName: 'pltwtrCiclExtn', header: { text: '원형(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
/* 분류식 - 우수관로 */
{ name: 'rainwtrPlanAr', fieldName: 'rainwtrPlanAr', header: { text: '관로정비\n계획면적(㎢)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'rainwtrImprmnPlanExtn', fieldName: 'rainwtrImprmnPlanExtn', header: { text: '관로정비\n계획연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrPlanExtn', fieldName: 'rainwtrPlanExtn', header: { text: '계획연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrFlctyExtn', fieldName: 'rainwtrFlctyExtn', header: { text: '시설연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrSqreExtn', fieldName: 'rainwtrSqreExtn', header: { text: '사각형(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrCiclExtn', fieldName: 'rainwtrCiclExtn', header: { text: '원형(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrOpswrExtn', fieldName: 'rainwtrOpswrExtn', header: { text: '개거(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrSdgttrExtn', fieldName: 'rainwtrSdgttrExtn', header: { text: '측구(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
/* 부속시설 */
{ name: 'mnhleSite', fieldName: 'mnhleSite', header: { text: '합류식맨홀(개소)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'pltwtrMnhleSite', fieldName: 'pltwtrMnhleSite', header: { text: '오수맨홀(개소)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'rainwtrMnhleSite', fieldName: 'rainwtrMnhleSite', header: { text: '우수맨홀(개소)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'pltwtrRcvrSite', fieldName: 'pltwtrRcvrSite', header: { text: '오수받이(개소)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'rainwtrRcvrSite', fieldName: 'rainwtrRcvrSite', header: { text: '빗물받이(개소)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'soilspllSite', fieldName: 'soilspllSite', header: { text: '우수토실(개소)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'soilholeSite', fieldName: 'soilholeSite', header: { text: '우수토구(개소)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
/* 대장 및 기타 */
{ name: 'sewerRegstrCmptExtn', fieldName: 'sewerRegstrCmptExtn', header: { text: '하수도대장전산화연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'sewerRegstrCmptRt', fieldName: 'sewerRegstrCmptRt', header: { text: '하수도대장전산화율(%)' }, footer: footerAvgDecimalArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.0' },
{ name: 'rmk', fieldName: 'rmk', header: { text: '비고' } },
],
columnLayout: [
{
name: 'areaGroup', header: { text: '행정구역' }, items: [
{ column: 'sido', footerUserSpans: [{ colspan: 4 }, { colspan: 4 }] },
'gugun',
'adstDong',
]
},
'displayYear',
'targetYr', 'piplImprmnPlanExtn', 'piplPlanExtn', 'piplFcltyExtn', 'piplSupprt',
{
name: 'combinedGroup', header: { text: '합류식(m)' },
items: ['cmbnPlanAr', 'cmbnImprmnPlanExtn', 'cmbnPlanExtn', 'cmbnFcltyExtn',
{ name: 'cmbnAmGroup', header: { text: '암거' }, items: ['cmbnRctglExtn', 'cmbnCicleExtn'] },
'cmbnOpswrExtn', 'cmbnSdgttrExtn'
],
},
{
name: 'sepGroup', header: { text: '분류식(m)' },
items: [
{
name: 'foulPipeGroup', header: { text: '오수관로' },
items: ['pltwtrPlanAr', 'pltwtrImprmnPlanExtn', 'pltwtrPlanExtn', 'pltwtrFlctyExtn',
{ name: 'foulAmGroup', header: { text: '암거' }, items: ['pltwtrSqreExtn', 'pltwtrCiclExtn'] }]
},
{
name: 'rainPipeGroup', header: { text: '우수관로' },
items: ['rainwtrPlanAr', 'rainwtrImprmnPlanExtn', 'rainwtrPlanExtn', 'rainwtrFlctyExtn',
{ name: 'rainAmGroup', header: { text: '암거' }, items: ['rainwtrSqreExtn', 'rainwtrCiclExtn'] },
'rainwtrOpswrExtn', 'rainwtrSdgttrExtn']
}
],
},
'mnhleSite',
{ name: 'fcltyGroup', header: { text: '부속시설(개소)' }, items: ['pltwtrMnhleSite', 'rainwtrMnhleSite'] },
'pltwtrRcvrSite', 'rainwtrRcvrSite', 'soilspllSite', 'soilholeSite', 'sewerRegstrCmptExtn', 'sewerRegstrCmptRt', 'rmk'
]
},
{
tabKey: 'b',
tabLabel: '시설별 설치현황',
rowStartNum: 4,
fixedColumns: 3,
columns: [
{
name: 'sido',
fieldName: 'sido',
header: { text: '시도' },
mergeCells: true,
editable: false,
sortdisable: true,
footer: [
{
valueCallback: (grid: GridView, column: DataColumn, footerIndex: number, columnFooter: ColumnFooter, value: number | string | undefined) => {
const divisionIndex = 0;
@@ -32,8 +213,7 @@ const rawList = [
}
}
const divisionValues = Array.from(uniqueValues);
if (divisionValues.length > divisionIndex) return divisionValues[divisionIndex] + '합계';
return '합계';
return divisionValues.length > divisionIndex ? divisionValues[divisionIndex] + '합계' : '합계';
}
},
{
@@ -49,15 +229,14 @@ const rawList = [
}
}
const divisionValues = Array.from(uniqueValues);
if (divisionValues.length > divisionIndex) return divisionValues[divisionIndex] + '합계';
return '합계';
return divisionValues.length > divisionIndex ? divisionValues[divisionIndex] + '합계' : '합계';
}
}
]
},
{ name: 'gugun', fieldName: 'gugun', header: { text: '시군구' }, mergeCells: true, editable: false, sortdisable: true },
{ name: 'adstDong', fieldName: 'adstDong', header: { text: '행정구역명' }, editable: false },
{
{ name: 'gugun', fieldName: 'gugun', header: { text: '시군구' }, mergeCells: true, editable: false, sortdisable: true },
{ name: 'bscFctNm', fieldName: 'bscFctNm', header: { text: '하수처리장명' }, editable: false },
{
name: 'displayYear',
fieldName: 'displayYear',
header: { text: '구분' },
@@ -98,164 +277,80 @@ const rawList = [
}
]
},
{ name: 'fctCpc', fieldName: 'fctCpc', header: { text: '하수처리\n시설용량\n(㎥/일)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.0' },
/* 하수정비 기본계획 */
{ name: 'targetYr', fieldName: 'targetYr', header: { text: '하수정보기본계획목표년도' } },
{ name: 'piplImprmnPlanExtn', fieldName: 'piplImprmnPlanExtn', header: { text: '총관로정비\n계획연장(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'piplPlanExtn', fieldName: 'piplPlanExtn', header: { text: '총계획연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'piplFcltyExtn', fieldName: 'piplFcltyExtn', header: { text: '총시설연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'piplSupprt', fieldName: 'piplSupprt', header: { text: '하수관로\n보급률(%)' }, footer: footerAvgDecimalArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
/* 처리구역면적(㎢) */
{ name: 'procZoneSm', fieldName: 'procZoneSm', header: { text: '합계' }, footer: footerDecimal3ArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'cmbnProcZoneAr', fieldName: 'cmbnProcZoneAr', header: { text: '합류식' }, footer: footerDecimal3ArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'sprtProcZoneAr', fieldName: 'sprtProcZoneAr', header: { text: '분류식' }, footer: footerDecimal3ArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'sepRate', fieldName: 'sepRate', header: { text: '분류식화(%)' }, footer: footerAvgDecimalArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.0' },
/* 합류식(m) */
{ name: 'cmbnPlanAr', fieldName: 'cmbnPlanAr', header: { text: '관로정비\n계획면적(㎢)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'cmbnImprmnPlanExtn', fieldName: 'cmbnImprmnPlanExtn', header: { text: '관로정비\n계획연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnPlanExtn', fieldName: 'cmbnPlanExtn', header: { text: '계획연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnFcltyExtn', fieldName: 'cmbnFcltyExtn', header: { text: '시설연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnRctglExtn', fieldName: 'cmbnRctglExtn', header: { text: '사각형(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnCicleExtn', fieldName: 'cmbnCicleExtn', header: { text: '원형(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnOpswrExtn', fieldName: 'cmbnOpswrExtn', header: { text: '개거(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnSdgttrExtn', fieldName: 'cmbnSdgttrExtn', header: { text: '측구(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
/* 배수설비(개소) */
{ name: 'drngEqpSm', fieldName: 'drngEqpSm', header: { text: '합계' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'cmbnDrngEqp', fieldName: 'cmbnDrngEqp', header: { text: '합류식' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'sprtDrngEqpSm', fieldName: 'sprtDrngEqpSm', header: { text: '합계(분류)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'sprtDrngEqpCnnc', fieldName: 'sprtDrngEqpCnnc', header: { text: '연결' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'sprtDrngEqpDcnnc', fieldName: 'sprtDrngEqpDcnnc', header: { text: '미연결' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
/* 분류식 - 오수관로 */
{ name: 'pltwtrPlanAr', fieldName: 'pltwtrPlanAr', header: { text: '관로정비\n계획면적(㎢)' }, footer: footerDecimal3ArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'pltwtrImprmnPlanExtn', fieldName: 'pltwtrImprmnPlanExtn', header: { text: '관로정비\n계획연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'pltwtrPlanExtn', fieldName: 'pltwtrPlanExtn', header: { text: '계획연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'pltwtrFlctyExtn', fieldName: 'pltwtrFlctyExtn', header: { text: '시설연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'pltwtrSqreExtn', fieldName: 'pltwtrSqreExtn', header: { text: '사각형(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'pltwtrCiclExtn', fieldName: 'pltwtrCiclExtn', header: { text: '원형(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
/* 하수관로 */
{ name: 'piplFcltyExtn', fieldName: 'piplFcltyExtn', header: { text: '총\n시설연장\n(m)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'icgMnnSm', fieldName: 'icgMnnSm', header: { text: '합계' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'icgExtn', fieldName: 'icgExtn', header: { text: '차집' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'mnnExtn', fieldName: 'mnnExtn', header: { text: '오수간선' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
/* 분류식 - 우수관로 */
{ name: 'rainwtrPlanAr', fieldName: 'rainwtrPlanAr', header: { text: '관로정비\n계획면적(㎢)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'rainwtrImprmnPlanExtn', fieldName: 'rainwtrImprmnPlanExtn', header: { text: '관로정비\n계획연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrPlanExtn', fieldName: 'rainwtrPlanExtn', header: { text: '계획연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrFlctyExtn', fieldName: 'rainwtrFlctyExtn', header: { text: '시설연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrSqreExtn', fieldName: 'rainwtrSqreExtn', header: { text: '사각형(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrCiclExtn', fieldName: 'rainwtrCiclExtn', header: { text: '원형(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrOpswrExtn', fieldName: 'rainwtrOpswrExtn', header: { text: '개거(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrSdgttrExtn', fieldName: 'rainwtrSdgttrExtn', header: { text: '측구(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
/* 토실/토구(개소) */
{ name: 'cmbnSoilholeSite', fieldName: 'cmbnSoilholeSite', header: { text: '우수토실(합류)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'sprtSoilholeSite', fieldName: 'sprtSoilholeSite', header: { text: '우수토실(분류)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'sprtSoilspllSite', fieldName: 'sprtSoilspllSite', header: { text: '우수토구(분류)' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
/* 부속시설 */
{ name: 'mnhleSite', fieldName: 'mnhleSite', header: { text: '합류식맨홀(개소)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'pltwtrMnhleSite', fieldName: 'pltwtrMnhleSite', header: { text: '오수맨홀(개소)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'rainwtrMnhleSite', fieldName: 'rainwtrMnhleSite', header: { text: '우수맨홀(개소)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'pltwtrRcvrSite', fieldName: 'pltwtrRcvrSite', header: { text: '오수받이(개소)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'rainwtrRcvrSite', fieldName: 'rainwtrRcvrSite', header: { text: '빗물받이(개소)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'soilspllSite', fieldName: 'soilspllSite', header: { text: '우수토실(개소)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'soilholeSite', fieldName: 'soilholeSite', header: { text: '우수토구(개소)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0' },
/* 지선(m) */
{ name: 'brnchlnSm', fieldName: 'brnchlnSm', header: { text: '합계' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'cmbnBrnchlnExtn', fieldName: 'cmbnBrnchlnExtn', header: { text: '합류식' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'rainwtrBrnchlnExtn', fieldName: 'rainwtrBrnchlnExtn', header: { text: '우수' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'pltwtrBrnchlnExtn', fieldName: 'pltwtrBrnchlnExtn', header: { text: '오수' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
/* 대장 및 기타 */
{ name: 'sewerRegstrCmptExtn', fieldName: 'sewerRegstrCmptExtn', header: { text: '하수도대장전산화연장(m)' }, footer: footerIntArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'sewerRegstrCmptRt', fieldName: 'sewerRegstrCmptRt', header: { text: '하수도대장전산화율(%)' }, footer: footerAvgDecimalArrayByDivision,valueType: ValueType.NUMBER, numberFormat: '#,##0.0' },
{ name: 'rmk', fieldName: 'rmk', header: { text: '비고' } },
],
columnLayout: [
{ name: 'areaGroup', header: { text: '행정구역' }, items: [
{ name: 'rmk', fieldName: 'rmk', header: { text: '비고' } },
],
columnLayout: [
{
name: 'addrGroup',
header: { text: '행정구역' },
items: [
{ column: 'sido', footerUserSpans: [{ colspan: 4 }, { colspan: 4 }] },
'gugun',
'adstDong',
] },
'displayYear',
'targetYr', 'piplImprmnPlanExtn', 'piplPlanExtn', 'piplFcltyExtn', 'piplSupprt',
{
name: 'combinedGroup', header: { text: '합류식(m)' },
items: ['cmbnPlanAr', 'cmbnImprmnPlanExtn', 'cmbnPlanExtn', 'cmbnFcltyExtn',
{ name: 'cmbnAmGroup', header: { text: '암거' }, items: ['cmbnRctglExtn', 'cmbnCicleExtn'] },
'cmbnOpswrExtn', 'cmbnSdgttrExtn'
],
},
{
name: 'sepGroup', header: { text: '분류식(m)' },
items: [
{
name: 'foulPipeGroup', header: { text: '오수관로' },
items: ['pltwtrPlanAr', 'pltwtrImprmnPlanExtn', 'pltwtrPlanExtn', 'pltwtrFlctyExtn',
{ name: 'foulAmGroup', header: { text: '암거' }, items: ['pltwtrSqreExtn', 'pltwtrCiclExtn'] }]
},
{
name: 'rainPipeGroup', header: { text: '우수관로' },
items: ['rainwtrPlanAr', 'rainwtrImprmnPlanExtn', 'rainwtrPlanExtn', 'rainwtrFlctyExtn',
{ name: 'rainAmGroup', header: { text: '암거' }, items: ['rainwtrSqreExtn', 'rainwtrCiclExtn'] },
'rainwtrOpswrExtn', 'rainwtrSdgttrExtn']
}
],
},
'mnhleSite',
{ name: 'fcltyGroup', header: { text: '부속시설(개소)' }, items: ['pltwtrMnhleSite', 'rainwtrMnhleSite'] },
'pltwtrRcvrSite', 'rainwtrRcvrSite', 'soilspllSite', 'soilholeSite', 'sewerRegstrCmptExtn', 'sewerRegstrCmptRt', 'rmk'
]
},
{
tabKey: 'b',
tabLabel: '시설별 설치현황',
rowStartNum: 5,
fixedColumns: 4,
columns: [
{ name: 'SIDO', fieldName: '시도', header: { text: '시도' } },
{ name: 'GUGUN', fieldName: '시군구', header: { text: '시군구' } },
{ name: '구분', fieldName: '구분', header: { text: '구분' } },
{ name: '하수처리장명', fieldName: '하수처리장명', header: { text: '하수처리장명' } },
{ name: 'FCT_CPC', fieldName: '하수처리시설용량(㎥/일)', header: { text: '하수처리\n시설용량\n(㎥/일)' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.0' },
{ name: 'PROC_ZONE_SM', fieldName: '합계(면적)', header: { text: '합계' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'CMBN_PROC_ZONE_AR', fieldName: '합류식(면적)', header: { text: '합류식' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'SPRT_PROC_ZONE_AR', fieldName: '분류식(면적)', header: { text: '분류식' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.000' },
{ name: 'SEP_RATE', fieldName: '분류식화', header: { text: '분류식화' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.0' },
{ name: 'DRNG_EQP_SM', fieldName: '합계(배수)', header: { text: '합계' }, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'CMBN_DRNG_EQP', fieldName: '합류식(배수)', header: { text: '합류식' }, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'SPRT_DRNG_EQP_SM', fieldName: '합계(분류배수)', header: { text: '합계(분류)' }, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'SPRT_DRNG_EQP_CNNC', fieldName: '연결', header: { text: '연결' }, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'SPRT_DRNG_EQP_DCNNC', fieldName: '미연결', header: { text: '미연결' }, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'PIPL_FCLTY_EXTN', fieldName: '총 시설연장(m)', header: { text: '총\n시설연장\n(m)' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'ICG_MNN_SM', fieldName: '합계(차집)', header: { text: '합계' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'ICG_EXTN', fieldName: '차집', header: { text: '차집' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'MNN_EXTN', fieldName: '오수간선', header: { text: '오수간선' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: '합류식', fieldName: '합류식(토실)', header: { text: '합류식' } },
{ name: 'CMBN_SOILHOLE_SITE', fieldName: '우수토실(합류)', header: { text: '우수토실(합류)' }, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'SPRT_SOILHOLE_SITE', fieldName: '우수토실(분류)', header: { text: '우수토실(분류)' }, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'SPRT_SOILSPLL_SITE', fieldName: '우수토구(분류)', header: { text: '우수토구(분류)' }, valueType: ValueType.NUMBER, numberFormat: '#,##0' },
{ name: 'BRNCHLN_SM', fieldName: '합계(지선)', header: { text: '합계' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'CMBN_BRNCHLN_EXTN', fieldName: '합류식(지선)', header: { text: '합류식' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'RAINWTR_BRNCHLN_EXTN', fieldName: '우수(지선)', header: { text: '우수' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'PLTWTR_BRNCHLN_EXTN', fieldName: '오수(지선)', header: { text: '오수' }, valueType: ValueType.NUMBER, numberFormat: '#,##0.00' },
{ name: 'RMK', fieldName: '비고', header: { text: '비고' } },
],
columnLayout: [
{ name: 'addrGroup', header: { text: '행정구역' }, items: ['SIDO', 'GUGUN'] },
'하수처리장명', 'FCT_CPC', '구분',
{ name: 'areaGroup', header: { text: '처리구역면적(㎢)' }, items: ['PROC_ZONE_SM', 'CMBN_PROC_ZONE_AR', 'SPRT_PROC_ZONE_AR'] },
'SEP_RATE',
{
name: 'drainGroup', header: { text: '배수설비(개소)' },
items: ['DRNG_EQP_SM', 'CMBN_DRNG_EQP', { name: 'sepDrainGroup', header: { text: '분류식' }, items: ['SPRT_DRNG_EQP_SM', 'SPRT_DRNG_EQP_CNNC', 'SPRT_DRNG_EQP_DCNNC'] }],
},
{
name: 'pipeGroup', header: { text: '하수관로' },
items: [
'PIPL_FCLTY_EXTN',
{ name: 'trunkGroup', header: { text: '차집/오수간선(m)' }, items: ['ICG_MNN_SM', 'ICG_EXTN', 'MNN_EXTN'] },
{
name: 'siteGroup', header: { text: '토실/토구(개소)' },
items: [
{ name: 'cmbnSiteGroup', header: { text: '합류식' }, items: ['CMBN_SOILHOLE_SITE'] },
{ name: 'sepSiteGroup', header: { text: '분류식' }, items: ['SPRT_SOILHOLE_SITE', 'SPRT_SOILSPLL_SITE'] }
]
},
{
name: 'branchGroup', header: { text: '지선(m)' },
items: ['BRNCHLN_SM', 'CMBN_BRNCHLN_EXTN', { name: 'sepBranchGroup', header: { text: '분류식' }, items: ['RAINWTR_BRNCHLN_EXTN', 'PLTWTR_BRNCHLN_EXTN'] }]
}
],
},
'RMK'
]
},
'gugun',
'bscFctNm',
]
},
'fctCpc',
'displayYear',
{ name: 'areaGroup', header: { text: '처리구역면적(㎢)' }, items: ['procZoneSm', 'cmbnProcZoneAr', 'sprtProcZoneAr'] },
'sepRate',
{
name: 'drainGroup', header: { text: '배수설비(개소)' },
items: ['drngEqpSm', 'cmbnDrngEqp', { name: 'sepDrainGroup', header: { text: '분류식' }, items: ['sprtDrngEqpSm', 'sprtDrngEqpCnnc', 'sprtDrngEqpDcnnc'] }],
},
{
name: 'pipeGroup', header: { text: '하수관로' },
items: [
'piplFcltyExtn',
{ name: 'trunkGroup', header: { text: '차집/오수간선(m)' }, items: ['icgMnnSm', 'icgExtn', 'mnnExtn'] },
{
name: 'siteGroup', header: { text: '토실/토구(개소)' },
items: [
{ name: 'cmbnSiteGroup', header: { text: '합류식' }, items: ['cmbnSoilholeSite'] },
{ name: 'sepSiteGroup', header: { text: '분류식' }, items: ['sprtSoilholeSite', 'sprtSoilspllSite'] }
]
},
{
name: 'branchGroup', header: { text: '지선(m)' },
items: ['brnchlnSm', 'cmbnBrnchlnExtn', { name: 'sepBranchGroup', header: { text: '우수/오수' }, items: ['rainwtrBrnchlnExtn', 'pltwtrBrnchlnExtn'] }]
}
],
},
'rmk'
]
},
{
tabKey: 'c',
tabLabel: '관종별 현황',
@@ -6,6 +6,8 @@ import {
type SewerageSupplyRateRequestParams,
type SewerageSupplyRateApiResponse,
type CheckInputPeriodResponse,
type SewerageSupplyRateSaveItem,
type SewerageSupplyRateSaveApiResponse,
} from "../model/statistics-input-interface";
export class StatisticsInputAPiService implements StatisticsInputService {
@@ -27,6 +29,15 @@ export class StatisticsInputAPiService implements StatisticsInputService {
return response.data;
}
public async saveSewerageSupplyRate(params: SewerageSupplyRateSaveItem[]): Promise<SewerageSupplyRateSaveApiResponse> {
const response = await axios.post<SewerageSupplyRateSaveApiResponse> (
`${ENDPOINT.ST_SERVICE.INPUT}/sewerage-supply-rate`,
params
);
return response.data;
}
}
export const statisticsInputAPi = new StatisticsInputAPiService();
@@ -6,12 +6,15 @@ import {
type StatsInputStatusReviewApiResponse
} from "../model/statistics-input-review-interface";
import {
type SewagePipeReviewApiResponse
type SewagePipeReviewRegionalApiResponse
} from "../model/statistics-sewage-pipe-review-interface";
import {
type SewerageSupplyRateReviewRequestParams,
type SewerageSupplyRateReviewApiResponse,
} from "../model/statistics-sewerage-penetration-review-interface";
import {
type SewagePipeFacilityApiResponse
} from "../model/statistics-sewage-pipe-review-interface";
export class StatisticsManagementApiService {
/**
@@ -58,16 +61,34 @@ export class StatisticsManagementApiService {
* 02. 하수관로 지역별 시설현황 목록 조회 (Tab1)
* @param params (sido, gugun, yr, bsnmCd)
*/
public async getSewagePipeReviewList(
public async getSewagePipeReviewRegionalList(
params: {
yr?: string;
bsnmCd?: string;
sido?: string;
gugun?: string;
}
): Promise<SewagePipeReviewApiResponse> {
const response = await axios.get<SewagePipeReviewApiResponse>(
`${ENDPOINT.ST_SERVICE.REVIEW}/pipe/tab1`,
): Promise<SewagePipeReviewRegionalApiResponse> {
const response = await axios.get<SewagePipeReviewRegionalApiResponse>(
`${ENDPOINT.ST_SERVICE.REVIEW}/sewer-pipe/regional-status`,
{ params }
);
return response.data;
}
/**
* 02. 하수관로 시설별 설치현황 목록 조회 (Tab2)
* @param params (sido, gugun, yr, bsnmCd)
*/
public async getSewagePipeFacilityList(
params: {
yr?: string;
bsnmCd?: string;
sido?: string;
gugun?: string;
}
): Promise<SewagePipeFacilityApiResponse> {
const response = await axios.get<SewagePipeFacilityApiResponse>(
`${ENDPOINT.ST_SERVICE.REVIEW}/sewer-pipe/facility-status`,
{ params }
);
return response.data;
@@ -0,0 +1,95 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type {
VerificationTargetManagementService,
VerificationTargetManagementSearchParams,
VerificationTargetManagementListApiResponse,
VerificationTargetManagementDetailApiResponse,
VerificationTargetManagementSaveRequest,
VerificationTargetManagementSaveApiResponse,
VerificationTargetManagementUpdateRequest,
VerificationTargetManagementUpdateApiResponse,
VerificationTargetManagementDeleteApiResponse,
} from "../model/verification-target-management-interface";
export class VerificationTargetManagementApiService implements VerificationTargetManagementService {
/**
* 검증 대상 목록 조회
* @param params 검색 조건 (vrfcMthdCd, statsCd, tblNm, colNm, vrfcTrgtNm, useYn, page, size, sort)
*/
public async getVerificationTargetManagementList(
params: VerificationTargetManagementSearchParams,
): Promise<VerificationTargetManagementListApiResponse> {
const response =
await client.get<VerificationTargetManagementListApiResponse>(
`${ENDPOINT.STATVERIFY_SERVICE.VRFCTGT_MNG}`,
{ params },
);
return response.data;
}
/**
* 검증 대상 상세 조회
* @param vrfcTrgtSn 검증 대상 일련번호
*/
public async getVerificationTargetManagementById(
vrfcTrgtSn: number,
): Promise<VerificationTargetManagementDetailApiResponse> {
const response =
await client.get<VerificationTargetManagementDetailApiResponse>(
`${ENDPOINT.STATVERIFY_SERVICE.VRFCTGT_MNG}/${vrfcTrgtSn}`,
);
return response.data;
}
/**
* 검증 대상 등록
* @param request 등록 요청 데이터
*/
public async saveVerificationTargetManagement(
request: VerificationTargetManagementSaveRequest,
): Promise<VerificationTargetManagementSaveApiResponse> {
const response =
await client.post<VerificationTargetManagementSaveApiResponse>(
`${ENDPOINT.STATVERIFY_SERVICE.VRFCTGT_MNG}`,
request,
);
return response.data;
}
/**
* 검증 대상 수정
* @param vrfcTrgtSn 검증 대상 일련번호
* @param request 수정 요청 데이터
*/
public async updateVerificationTargetManagement(
vrfcTrgtSn: number,
request: VerificationTargetManagementUpdateRequest,
): Promise<VerificationTargetManagementUpdateApiResponse> {
const response =
await client.put<VerificationTargetManagementUpdateApiResponse>(
`${ENDPOINT.STATVERIFY_SERVICE.VRFCTGT_MNG}/${vrfcTrgtSn}`,
request,
);
return response.data;
}
/**
* 검증 대상 삭제
* @param vrfcTrgtSn 검증 대상 일련번호
*/
public async deleteVerificationTargetManagement(
vrfcTrgtSn: number,
): Promise<VerificationTargetManagementDeleteApiResponse> {
const response =
await client.delete<VerificationTargetManagementDeleteApiResponse>(
`${ENDPOINT.STATVERIFY_SERVICE.VRFCTGT_MNG}/${vrfcTrgtSn}`,
);
return response.data;
}
}
// 통합 인스턴스 수출
export const verificationTargetManagementApi =
new VerificationTargetManagementApiService();
@@ -13,6 +13,28 @@ export interface SewerageSupplyRateStatusInfo {
returnOpinionSm: string | null;
}
export interface SewerageSupplyRateCommonInfo {
bsnmArea: number;
bsnmCd: string;
bsnmFrgnrPoplSm: number;
bsnmPoplSm: number;
bsnmTotalPopl: number;
piplFcltyExtn: number;
piplPlanExtn: number;
piplSupprt: number;
sido: string;
yr: string;
}
/** 검증 결과 한 건 (필드별 메시지) */
export interface VerificationResultItem {
type: string;
rsn: string;
}
/** 필드명 → 검증 결과 배열. 예: { popltnSm: [{ type, rsn }], wstrPrmTrt: [...] } */
export type SewerageSupplyRateVerificationResult = Record<string, VerificationResultItem[]>;
export interface SewerageSupplyRateItem {
sido: string;
gugun: string;
@@ -93,11 +115,13 @@ export interface SewerageSupplyRateItem {
chkAdtrtPopltnSuprt: string;
chkSwrgInstlrt: string;
chkNotConectPopltn: string;
verificationResult?: SewerageSupplyRateVerificationResult;
}
export interface SewerageSupplyRateResponseData {
statusInfo: SewerageSupplyRateStatusInfo;
sewerageSupplyRateList: SewerageSupplyRateItem[];
commonInfo: SewerageSupplyRateCommonInfo;
}
export type SewerageSupplyRateApiResponse = ApiResponse<SewerageSupplyRateResponseData> & {
@@ -109,10 +133,53 @@ export interface SewerageSupplyRateRequestParams {
gugun?: string;
bsnmCd?: string;
yr?: string;
demoYr?: string;
mode?: string;
}
/** 하수도 보급률 저장 API 요청 body (한 행) */
export interface SewerageSupplyRateSaveItem {
bsnmCd: string;
sido: string;
gugun: string | null;
yr: string;
adstCd: string;
adstDong: string;
bstrm: string;
speclCntrplnAr: string | null;
pblswrgPrmTrt: number;
pblswrgScdTrt: number;
pblswrgTertTrt: number;
wstrPrmTrt: number;
wstrScdTrt: number;
wstrTertTrt: number;
notConectPopltn: number;
swgeProcZoneInnerAr: number;
townUnprocPopltn: number;
townSwttPopltn: number;
townWrrtnPopltn: number;
swgeProcZoneOuterAr: number;
rmk: string;
popltnSm: number;
arSm: number;
swgeProcZoneInnerSm: number;
pblswrgPopltnSm: number;
wstrPopltnSm: number;
swgeProcZoneOuterSm: number;
pblswrgPopltnSuprt: number;
adtrtPopltnSuprt: number;
swrgInstlrt: number;
userId: string;
}
export interface SewerageSupplyRateSaveData {
hasMismatch?: boolean;
mismatchIdList?: string[];
httpStatus?: number;
code?: string;
}
export type SewerageSupplyRateSaveApiResponse = ApiResponse<SewerageSupplyRateSaveData>;
// 하수도 통계 입력 기간 조회
export interface CheckInputPeriodResponse {
status: string;
@@ -122,4 +189,6 @@ export interface CheckInputPeriodResponse {
export interface StatisticsInputService {
getSewerageSupplyRateList(params: SewerageSupplyRateRequestParams): Promise<SewerageSupplyRateApiResponse>;
checkInputPeriod(params: string): Promise<CheckInputPeriodResponse>;
saveSewerageSupplyRate(params: SewerageSupplyRateSaveItem[]): Promise<SewerageSupplyRateSaveApiResponse>;
}
@@ -1,9 +1,9 @@
import type { ApiResponse } from "./statistics-interface";
/**
* 02. 하수관로 지역별 시설현황 아이템 인터페이스 (Tab1)
* 02. 하수관로 tab1.지역별 시설현황 아이템 인터페이스 (Tab1)
*/
export interface SewagePipeReviewItem {
export interface SewagePipeReviewrRegionalItem {
// 기본 정보 및 행 제어
sido: string; // 시도
gugun: string; // 시군구
@@ -64,11 +64,11 @@ export interface SewagePipeReviewItem {
}
export interface SewagePipeReviewResponseData {
sewagePipeList: SewagePipeReviewItem[];
sewagePipeList: SewagePipeReviewrRegionalItem[];
}
export type SewagePipeReviewApiResponse = ApiResponse<SewagePipeReviewItem[]> & {
export type SewagePipeReviewRegionalApiResponse = ApiResponse<SewagePipeReviewrRegionalItem[]> & {
message: string;
};
@@ -79,5 +79,74 @@ export interface SewagePipeReviewService {
bsnmCd?: string; // 사업장 코드
sido?: string; // 시도
gugun?: string; // 구군
}): Promise<SewagePipeReviewApiResponse>;
}): Promise<SewagePipeReviewRegionalApiResponse>;
}
export interface SewagePipeReviewFacilityItem {
// 1. 행정구역 및 기본 정보
sido: string; // 시도
gugun: string; // 시군구
adstCd: string; // 행정코드
adstDong: string; // 행정구역명
yr: string; // 연도
rowType: 'OLD' | 'CURR'; // 전년도/당해년도 구분
displayYear: string; // 구분 표시용 (2024년확정 등)
// 2. 시설 정보
bscFctNm: string; // 하수처리장명
fctCpc: number; // 하수처리시설용량(㎥/일)
// 3. 처리구역면적(㎢)
procZoneSm: number; // 합계(면적)
cmbnProcZoneAr: number; // 합류식(면적)
sprtProcZoneAr: number; // 분류식(면적)
sepRate: number; // 분류식화 (%)
// 4. 배수설비(개소)
drngEqpSm: number; // 합계(배수)
cmbnDrngEqp: number; // 합류식(배수)
sprtDrngEqpSm: number; // 합계(분류배수)
sprtDrngEqpCnnc: number; // 연결
sprtDrngEqpDcnnc: number; // 미연결
// 5. 하수관로 (m)
piplFcltyExtn: number; // 총 시설연장(m)
icgMnnSm: number; // 합계(차집/오수간선)
icgExtn: number; // 차집
mnnExtn: number; // 오수간선
// 6. 토실/토구 (개소)
cmbnSoilholeSite: number; // 우수토실(합류)
sprtSoilholeSite: number; // 우수토실(분류)
sprtSoilspllSite: number; // 우수토구(분류)
// 7. 지선 (m)
brnchlnSm: number; // 합계(지선)
cmbnBrnchlnExtn: number; // 합류식(지선)
rainwtrBrnchlnExtn: number; // 우수(지선)
pltwtrBrnchlnExtn: number; // 오수(지선)
// 비고
rmk: string; // 비고
}
export interface SewagePipeFacilityResponseData {
facilityPipeList: SewagePipeReviewFacilityItem[];
}
export type SewagePipeFacilityApiResponse = ApiResponse<SewagePipeReviewFacilityItem[]> & {
message: string;
};
export interface SewagePipeFacilityService {
getSewagePipeFacilityList(params: {
yr?: string; // 조회 연도
bsnmCd?: string; // 사업장 코드
sido?: string; // 시도
gugun?: string; // 구군
}): Promise<SewagePipeFacilityApiResponse>;
}
@@ -0,0 +1,200 @@
import { ValueType } from "realgrid";
import type { ColumnInfo } from "@rsone/components";
export const hbArticleColumnInfo: ColumnInfo = {
columns: [
{
name: "statsNm",
fieldName: "statsNm",
header: { text: "통계항목" },
editable: false,
sortdisable: false,
},
{
name: "vrfcTrgtNm",
fieldName: "vrfcTrgtNm",
header: { text: "검증명" },
editable: false,
sortdisable: false,
},
{
name: "tblNm",
fieldName: "tblNm",
header: { text: "테이블명" },
editable: false,
sortdisable: false,
},
{
name: "colNm",
fieldName: "colNm",
header: { text: "컬럼명" },
editable: false,
sortdisable: false,
},
{
name: "pctlCrtrVl",
fieldName: "pctlCrtrVl",
header: { text: "Percentile" },
editable: false,
sortdisable: false,
valueType: ValueType.NUMBER,
dataFormat: "#,##0.##",
},
{
name: "scopCntCntVl",
fieldName: "scopCntCntVl",
header: { text: "A" },
editable: false,
sortdisable: false,
valueType: ValueType.NUMBER,
dataFormat: "#,##0.###",
},
{
name: "thrsCntVl",
fieldName: "thrsCntVl",
header: { text: "C" },
editable: false,
sortdisable: false,
valueType: ValueType.NUMBER,
dataFormat: "#,##0.###",
},
{
name: "rgtrNm",
fieldName: "rgtrNm",
header: { text: "등록자" },
editable: false,
sortdisable: false,
},
{
name: "regDt",
fieldName: "regDt",
header: { text: "등록일시" },
editable: false,
sortdisable: false,
},
],
columnLayout: [
"statsNm",
"vrfcTrgtNm",
"tblNm",
"colNm",
"pctlCrtrVl",
"scopCntCntVl",
"thrsCntVl",
"rgtrNm",
"regDt",
],
};
export const imrArticleColumnInfo: ColumnInfo = {
columns: [
{
name: "statsNm",
fieldName: "statsNm",
header: { text: "통계항목" },
editable: false,
sortdisable: false,
},
{
name: "vrfcTrgtNm",
fieldName: "vrfcTrgtNm",
header: { text: "검증명" },
editable: false,
sortdisable: false,
},
{
name: "tblNm",
fieldName: "tblNm",
header: { text: "테이블명" },
editable: false,
sortdisable: false,
},
{
name: "colNm",
fieldName: "colNm",
header: { text: "컬럼명" },
editable: false,
sortdisable: false,
},
{
name: "ipcrCntVl",
fieldName: "ipcrCntVl",
header: { text: "μ" },
editable: false,
sortdisable: false,
valueType: ValueType.NUMBER,
dataFormat: "#,##0.###",
},
{
name: "rgtrNm",
fieldName: "rgtrNm",
header: { text: "등록자" },
editable: false,
sortdisable: false,
},
{
name: "regDt",
fieldName: "regDt",
header: { text: "등록일시" },
editable: false,
sortdisable: false,
},
],
columnLayout: [
"statsNm",
"vrfcTrgtNm",
"tblNm",
"colNm",
"ipcrCntVl",
"rgtrNm",
"regDt",
],
};
export const validationArticleColumnInfo: ColumnInfo = {
columns: [
{
name: "statsNm",
fieldName: "statsNm",
header: { text: "통계항목" },
editable: false,
sortdisable: false,
},
{
name: "vrfcTrgtNm",
fieldName: "vrfcTrgtNm",
header: { text: "검증명" },
editable: false,
sortdisable: false,
},
{
name: "tblNm",
fieldName: "tblNm",
header: { text: "테이블명" },
editable: false,
sortdisable: false,
},
{
name: "colNm",
fieldName: "colNm",
header: { text: "컬럼명" },
editable: false,
sortdisable: false,
},
{
name: "rgtrNm",
fieldName: "rgtrNm",
header: { text: "등록자" },
editable: false,
sortdisable: false,
},
{
name: "regDt",
fieldName: "regDt",
header: { text: "등록일시" },
editable: false,
sortdisable: false,
},
],
columnLayout: ["statsNm", "vrfcTrgtNm", "tblNm", "colNm", "rgtrNm", "regDt"],
};
@@ -0,0 +1,57 @@
/** H-B 탭 검증 항목 */
export interface HBArticleItem {
/** 통계 항목명 */
statsItmNm: string;
/** 검증 항목명 */
vrfcItmNm: string;
/** 테이블명 */
tblNm: string;
/** 컬럼명 */
colNm: string;
/** Percentile 값 */
percentileVal: number;
/** A 값 */
aVal: number;
/** C 값 */
cVal: number;
/** 등록자명 */
regNm: string;
/** 등록 일시 */
regDt: string;
}
/** I-MR 탭 검증 항목 */
export interface IMRArticleItem {
/** 통계 항목명 */
statsItmNm: string;
/** 검증명 */
vrfcNm: string;
/** 테이블명 */
tblNm: string;
/** 컬럼명 */
colNm: string;
/** 등록자명 */
regNm: string;
/** 등록 일시 */
regDt: string;
}
/** Validation 탭 검증 항목 */
export interface ValidationArticleItem {
/** 순번 */
no: string;
/** 통계항목명 */
statsItmNm: string;
/** 검증명 */
vrfcNm: string;
/** 테이블명 */
tblNm: string;
/** 컬럼명 */
colNm: string;
/** 비교 테이블명 */
cmpTblNm: string;
/** 비교 컬럼명 */
cmpColNm: string;
/** 기본규칙 */
bscRul: string;
}
@@ -0,0 +1,150 @@
import { fakerKO as faker } from "@faker-js/faker";
import type {
HBArticleItem,
IMRArticleItem,
ValidationArticleItem,
} from "./verification-article-interface";
const HB_STATS_ITEMS = [
"하수도 보급률",
"하수관로",
"하수처리시설 및 방류량보고",
"펌프장",
"공공하수처리시설",
"분뇨처리시설",
"개인하수처리시설",
"하수도재정",
"물 재이용",
];
const HB_VERIFICATION_ITEMS = [
"행정구역 보급률",
"유역환경청별 보급률",
"관로연장",
"처리용량",
"방류량",
"펌프용량",
];
const IMR_STATS_ITEMS = [
"하수도 보급률",
"하수관로",
"하수처리시설 및 방류량보고",
"펌프장",
"공공하수처리시설",
"분뇨처리시설",
"개인하수처리시설",
"하수도재정",
"물 재이용",
];
const VALIDATION_STATS_ITEMS = [
"하수관로 유지관리",
"하수저류시설 및 빗물펌프장",
"공공하수처리시설",
"분뇨처리시설",
"개인하수처리시설",
"하수도재정",
];
const VERIFICATION_NAMES = [
"제정별 사업비",
"관로길이",
"공란검증",
"범위검증",
"논리검증",
"유지보수",
];
const TABLE_NAMES = [
"tb_stats_drng_sys",
"tb_stats_ppline",
"tb_stats_fclt",
"tb_stats_pump_stt",
"tb_stats_sewg_trtm",
];
const COLUMN_NAMES = [
"drng_sys_rate",
"ppline_len",
"fclt_cpct",
"pump_cpct",
"trtm_qty",
"popl_cnt",
];
const BASIC_RULES = [
"값 > 0",
"값 >= 0",
"값 != NULL",
"범위: 0-100",
"A > B",
];
function formatDateTime(date: Date): string {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
const h = String(date.getHours()).padStart(2, "0");
const min = String(date.getMinutes()).padStart(2, "0");
return `${y}-${m}-${d} ${h}:${min}`;
}
/** H-B 탭 목데이터 생성 */
export function createHBArticleMock(count = 10): HBArticleItem[] {
faker.seed(100);
return Array.from({ length: count }, (_, index) => ({
statsItmNm: faker.helpers.arrayElement(HB_STATS_ITEMS),
vrfcItmNm: faker.helpers.arrayElement(HB_VERIFICATION_ITEMS),
tblNm: faker.helpers.arrayElement(TABLE_NAMES),
colNm: faker.helpers.arrayElement(COLUMN_NAMES),
percentileVal: faker.number.float({
min: 0,
max: 100,
fractionDigits: 2,
}),
aVal: faker.number.float({ min: 0, max: 10, fractionDigits: 3 }),
cVal: faker.number.float({ min: 0, max: 10, fractionDigits: 3 }),
regNm: faker.person.fullName(),
regDt: formatDateTime(faker.date.recent({ days: 90 })),
}));
}
/** I-MR 탭 목데이터 생성 */
export function createIMRArticleMock(count = 10): IMRArticleItem[] {
faker.seed(200);
return Array.from({ length: count }, (_, index) => ({
statsItmNm: faker.helpers.arrayElement(IMR_STATS_ITEMS),
vrfcNm: faker.helpers.arrayElement(VERIFICATION_NAMES),
tblNm: faker.helpers.arrayElement(TABLE_NAMES),
colNm: faker.helpers.arrayElement(COLUMN_NAMES),
regNm: faker.person.fullName(),
regDt: formatDateTime(faker.date.recent({ days: 90 })),
}));
}
/** Validation 탭 목데이터 생성 */
export function createValidationArticleMock(
count = 6,
): ValidationArticleItem[] {
faker.seed(300);
return Array.from({ length: count }, (_, index) => ({
no: `${index + 1}`,
statsItmNm: faker.helpers.arrayElement(VALIDATION_STATS_ITEMS),
vrfcNm: faker.helpers.arrayElement(VERIFICATION_NAMES),
tblNm: faker.helpers.arrayElement(TABLE_NAMES),
colNm: faker.helpers.arrayElement(COLUMN_NAMES),
cmpTblNm: faker.helpers.arrayElement(TABLE_NAMES),
cmpColNm: faker.helpers.arrayElement(COLUMN_NAMES),
bscRul: faker.helpers.arrayElement(BASIC_RULES),
}));
}
/** H-B 탭 기본 목데이터 */
export const hbArticleMockData = createHBArticleMock(10);
/** I-MR 탭 기본 목데이터 */
export const imrArticleMockData = createIMRArticleMock(10);
/** Validation 탭 기본 목데이터 */
export const validationArticleMockData = createValidationArticleMock(6);
@@ -0,0 +1,105 @@
import type { PageableList } from "@/shared/model";
import type { ApiResponse } from "./statistics-interface";
// 검증 대상 관리 응답 DTO
export interface VerificationTargetManagementResponse {
vrfcTrgtSn: number; // 검증 대상 일련번호
vrfcMthdCd: string; // 검증 방법 코드
vrfcMthdNm: string; // 검증 방법 명
statsCd: string; // 통계 코드
statsNm: string; // 통계 항목 명
schmNm: string; // 스키마 명
tblNm: string; // 테이블 명
colNm: string; // 컬럼 명
pkColNm: string; // pk 컬럼 명
ipcrCntVl: number | null; // 중요도 계수 값 (mu)
pctlCrtrVl: number | null; // 백분위 기준 값 (percentile)
scopCntCntVl: number | null; // 범위 조정 계수 값 (A)
thrsCntVl: number | null; // 임계 계수 값 (C)
useYn: string; // 사용 여부
vrfcTrgtNm: string; // 검증대상명
rgtr: string | null; // 등록자 ID
regDt: string | null; // 등록 일시
mdfr: string | null; // 수정자 ID
rgtrNm: string | null; // 등록자명
mdfrNm: string | null; // 수정자명
mdfcn: string | null; // 수정 일시
}
// 검증 대상 관리 검색 DTO
export interface VerificationTargetManagementSearchParams {
vrfcMthdCd?: string; // 검증 방법 코드
statsCd?: string; // 통계 코드
tblNm?: string; // 테이블 명
colNm?: string; // 컬럼 명
vrfcTrgtNm?: string; // 검증대상명
useYn?: string; // 사용 여부
page?: number; // 페이지 번호 (0부터 시작)
size?: number; // 페이지 크기
sort?: string; // 정렬 조건 (예: "vrfcTrgtSn,desc")
}
// 검증 대상 관리 저장 요청 DTO
export interface VerificationTargetManagementSaveRequest {
vrfcMthdCd: string; // 검증 방법 코드 (필수, 최대 10자)
statsCd: string; // 통계 코드 (필수, 최대 10자)
schmNm: string; // 스키마 명 (필수, 최대 150자)
tblNm: string; // 테이블 명 (필수, 최대 150자)
colNm: string; // 컬럼 명 (필수, 최대 150자)
pkColNm: string; // pk 컬럼 명 (필수, 최대 150자)
ipcrCntVl?: number | null; // 중요도 계수 값 (mu)
pctlCrtrVl?: number | null; // 백분위 기준 값 (percentile)
scopCntCntVl?: number | null; // 범위 조정 계수 값 (A)
thrsCntVl?: number | null; // 임계 계수 값 (C)
useYn?: string; // 사용 여부 (Y/N, 최대 1자)
vrfcTrgtNm?: string; // 검증대상명 (최대 150자)
}
// 검증 대상 관리 수정 요청 DTO
export interface VerificationTargetManagementUpdateRequest {
vrfcMthdCd: string; // 검증 방법 코드 (필수, 최대 10자)
statsCd: string; // 통계 코드 (필수, 최대 10자)
schmNm: string; // 스키마 명 (필수, 최대 150자)
tblNm: string; // 테이블 명 (필수, 최대 150자)
colNm: string; // 컬럼 명 (필수, 최대 150자)
pkColNm: string; // pk 컬럼 명 (필수, 최대 150자)
ipcrCntVl?: number | null; // 중요도 계수 값 (mu)
pctlCrtrVl?: number | null; // 백분위 기준 값 (percentile)
scopCntCntVl?: number | null; // 범위 조정 계수 값 (A)
thrsCntVl?: number | null; // 임계 계수 값 (C)
useYn?: string; // 사용 여부 (Y/N, 최대 1자)
vrfcTrgtNm?: string; // 검증대상명 (최대 150자)
}
// API 응답 타입
export type VerificationTargetManagementListApiResponse =
PageableList<VerificationTargetManagementResponse>;
export type VerificationTargetManagementDetailApiResponse =
ApiResponse<VerificationTargetManagementResponse>;
export type VerificationTargetManagementSaveApiResponse = ApiResponse<number>;
export type VerificationTargetManagementUpdateApiResponse = ApiResponse<number>;
export type VerificationTargetManagementDeleteApiResponse = ApiResponse<number>;
// 서비스 인터페이스
export interface VerificationTargetManagementService {
getVerificationTargetManagementList(
params: VerificationTargetManagementSearchParams,
): Promise<VerificationTargetManagementListApiResponse>;
getVerificationTargetManagementById(
vrfcTrgtSn: number,
): Promise<VerificationTargetManagementDetailApiResponse>;
saveVerificationTargetManagement(
request: VerificationTargetManagementSaveRequest,
): Promise<VerificationTargetManagementSaveApiResponse>;
updateVerificationTargetManagement(
vrfcTrgtSn: number,
request: VerificationTargetManagementUpdateRequest,
): Promise<VerificationTargetManagementUpdateApiResponse>;
deleteVerificationTargetManagement(
vrfcTrgtSn: number,
): Promise<VerificationTargetManagementDeleteApiResponse>;
}
@@ -0,0 +1,29 @@
import { z } from "zod";
export const verificationTargetManagementSchema = z.object({
vrfcTrgtSn: z.number().optional(),
vrfcMthdCd: z.string().optional(),
vrfcMthdNm: z.string().optional().nullable(),
statsCd: z.string().min(1, "통계항목을 선택해주세요"),
statsNm: z.string().optional().nullable(),
schmNm: z.string().min(1, "스키마명을 입력해주세요"),
tblNm: z.string().min(1, "테이블명을 입력해주세요"),
colNm: z.string().min(1, "컬럼명을 입력해주세요"),
pkColNm: z.string().min(1, "PK 키를 입력해주세요"),
ipcrCntVl: z.number().optional().nullable(),
pctlCrtrVl: z.number().optional().nullable(),
scopCntCntVl: z.number().optional().nullable(),
thrsCntVl: z.number().optional().nullable(),
useYn: z.string().optional(),
vrfcTrgtNm: z.string().optional().nullable(),
rgtr: z.string().optional().nullable(),
regDt: z.string().optional().nullable(),
mdfr: z.string().optional().nullable(),
rgtrNm: z.string().optional().nullable(),
mdfrNm: z.string().optional().nullable(),
mdfcn: z.string().optional().nullable(),
});
export type VerificationTargetManagementFormData = z.infer<
typeof verificationTargetManagementSchema
>;
+1 -1
View File
@@ -1 +1 @@
export { default as statisticsPage } from "./ui/statistics-page";
export { default as StatisticsPage } from "./ui/statistics-page";
+70 -67
View File
@@ -3,73 +3,76 @@ import { PROXY_HOST } from "./env";
export const BASE_URL = `${PROXY_HOST}/server`;
export const ENDPOINT = {
ATTACH_SERVICE: {
TUS_UPLOAD: "/attach-service/api/v1/tus/upload",
EDITOR_UPLOAD: "/attach-service/api/v1/upload/editor",
IMAGES: "/attach-service/api/v1/images",
MOVIE_THUMBNAIL: "/attach-service/api/v1/movie/thumbnail",
ATTACHMENTS: "/attach-service/api/v1/atfl/attachments",
DOWNLOAD: "/attach-service/api/v1/atflcd/download",
STREAM_VIDEO: "/attach-service/api/v1/stream/video",
},
USER_SERVICE: {
LOGIN: "/user-service/login",
USERS: "/user-service/api/v1/users",
SILENT_REFRESH: "/user-service/api/v1/users/token/refresh",
AUTHORIZATIONS: "/user-service/api/v1/authorizations",
ROLE_AUTHORIZATIONS: "/user-service/api/v1/role-authorizations",
ROLES: "/user-service/api/v1/roles",
LOGINLOG: "/user-service/api/v1/login-logs",
PRIVACYLOG: "/user-service//api/v1/prvc-inq-logs",
},
CMS_SERVICE: {
DASHBOARD: "/cms-service/api/v1/dashboard",
SITES: "/cms-service/api/v1/sites",
IPS: "/cms-service/api/v1/site-ips",
DOMAINS: "/cms-service/api/v1/site-dmns",
POSTINGS: "/cms-service/api/v1/site-pstgs",
CODE: "/cms-service/api/v1/code/cache",
MENUS: "/cms-service/api/v1/menus",
MENU_ROLES: "/cms-service/api/v1/menu-roles",
MENU_AUTHRTS: "/cms-service/api/v1/menu-authrts",
MENU_TEMPORARY_STORAGE: "/cms-service/api/v1/menu-tmpr-strg",
MENU_HISTORY: "/cms-service/api/v1/menu-hstry",
CONTENTS: "/cms-service/api/v1/contents",
CONTENTS_DETAILS: "/cms-service/api/v1/contents-details",
ORGANIZATIONS: "/cms-service/api/v1/ognzs",
USER_ORGANIZATION: "/cms-service/api/v1/user-ognz",
IMAGES: "/cms-service/api/v1/images",
BANNERS: "/cms-service/api/v1/bnrs",
TEMPLATE: "/cms-service/api/v1/tmplt",
TERMS: "/cms-service/api/v1/trms",
LWPO_CODE: "/cms-service/api/v1/lwpo-cds",
UP_CODE: "/cms-service/api/v1/up-codes",
POPUPS: "/cms-service/api/v1/popups",
SCHEDULES: "/cms-service/api/v1/schdls",
SURVEY: "/cms-service/api/v1/srvy",
SURVEY_QUESTION: "/cms-service/api/v1/srvy-qitem",
SURVEY_ARTICLE: "/cms-service/api/v1/srvy-artcl",
ZIPS: "/cms-service/api/v1/zips",
GROUPS: "/cms-service/api/v1/groups",
GROUP_USERS: "/cms-service/api/v1/group-users",
MANAGER_IP: "/cms-service/api/v1/mgrip",
APILOG: "/cms-service/api/v1/api-logs",
SITE_AUTHORITY: "/cms-service/api/v1/site-authrt",
CONNECTION_LOG: "/cms-service/api/v1/cntnlog",
},
BOARD_SERVICE: {
BBS: "/board-service/api/v1/bbs",
BBS_TEMPLATES: "/board-service/api/v1/bbsTmplt",
POSTS: "/board-service/api/v1/posts",
POSTS_COMMENTS: "/board-service/api/v1/posts-cmnts",
POST_EVALUATION: "/board-service/api/v1/pstEvl",
},
ST_SERVICE: {
COMMON: "/st-management-service/api/v1/common",
INPUT: "/st-input-service/api/v1/input",
REVIEW: "/st-management-service/api/v1/review",
INPUTCOMMON: "/st-input-service/api/v1/common",
}
ATTACH_SERVICE: {
TUS_UPLOAD: "/attach-service/api/v1/tus/upload",
EDITOR_UPLOAD: "/attach-service/api/v1/upload/editor",
IMAGES: "/attach-service/api/v1/images",
MOVIE_THUMBNAIL: "/attach-service/api/v1/movie/thumbnail",
ATTACHMENTS: "/attach-service/api/v1/atfl/attachments",
DOWNLOAD: "/attach-service/api/v1/atflcd/download",
STREAM_VIDEO: "/attach-service/api/v1/stream/video",
},
USER_SERVICE: {
LOGIN: "/user-service/login",
USERS: "/user-service/api/v1/users",
SILENT_REFRESH: "/user-service/api/v1/users/token/refresh",
AUTHORIZATIONS: "/user-service/api/v1/authorizations",
ROLE_AUTHORIZATIONS: "/user-service/api/v1/role-authorizations",
ROLES: "/user-service/api/v1/roles",
LOGINLOG: "/user-service/api/v1/login-logs",
PRIVACYLOG: "/user-service//api/v1/prvc-inq-logs",
},
CMS_SERVICE: {
DASHBOARD: "/cms-service/api/v1/dashboard",
SITES: "/cms-service/api/v1/sites",
IPS: "/cms-service/api/v1/site-ips",
DOMAINS: "/cms-service/api/v1/site-dmns",
POSTINGS: "/cms-service/api/v1/site-pstgs",
CODE: "/cms-service/api/v1/code/cache",
MENUS: "/cms-service/api/v1/menus",
MENU_ROLES: "/cms-service/api/v1/menu-roles",
MENU_AUTHRTS: "/cms-service/api/v1/menu-authrts",
MENU_TEMPORARY_STORAGE: "/cms-service/api/v1/menu-tmpr-strg",
MENU_HISTORY: "/cms-service/api/v1/menu-hstry",
CONTENTS: "/cms-service/api/v1/contents",
CONTENTS_DETAILS: "/cms-service/api/v1/contents-details",
ORGANIZATIONS: "/cms-service/api/v1/ognzs",
USER_ORGANIZATION: "/cms-service/api/v1/user-ognz",
IMAGES: "/cms-service/api/v1/images",
BANNERS: "/cms-service/api/v1/bnrs",
TEMPLATE: "/cms-service/api/v1/tmplt",
TERMS: "/cms-service/api/v1/trms",
LWPO_CODE: "/cms-service/api/v1/lwpo-cds",
UP_CODE: "/cms-service/api/v1/up-codes",
POPUPS: "/cms-service/api/v1/popups",
SCHEDULES: "/cms-service/api/v1/schdls",
SURVEY: "/cms-service/api/v1/srvy",
SURVEY_QUESTION: "/cms-service/api/v1/srvy-qitem",
SURVEY_ARTICLE: "/cms-service/api/v1/srvy-artcl",
ZIPS: "/cms-service/api/v1/zips",
GROUPS: "/cms-service/api/v1/groups",
GROUP_USERS: "/cms-service/api/v1/group-users",
MANAGER_IP: "/cms-service/api/v1/mgrip",
APILOG: "/cms-service/api/v1/api-logs",
SITE_AUTHORITY: "/cms-service/api/v1/site-authrt",
CONNECTION_LOG: "/cms-service/api/v1/cntnlog",
},
BOARD_SERVICE: {
BBS: "/board-service/api/v1/bbs",
BBS_TEMPLATES: "/board-service/api/v1/bbsTmplt",
POSTS: "/board-service/api/v1/posts",
POSTS_COMMENTS: "/board-service/api/v1/posts-cmnts",
POST_EVALUATION: "/board-service/api/v1/pstEvl",
},
ST_SERVICE: {
COMMON: "/st-management-service/api/v1/common",
INPUT: "/st-input-service/api/v1/input",
REVIEW: "/st-management-service/api/v1/review",
INPUTCOMMON: "/st-input-service/api/v1/common",
},
STATVERIFY_SERVICE: {
VRFCTGT_MNG: "/statverify-service/api/v1/vrfc-trgt-mng",
},
};
export const JWT_EXPIRATION_TIME = 1800000;
@@ -7,12 +7,10 @@ function StatisticsPageLayout({ children }: { children: React.ReactNode }) {
const pageTitle = tabs.find((t) => t.menuItem.menuEngNm === activeTabId);
const menuPaths = pageTitle?.path
?.split(">")
.map((path) => path.trim());
const menuPaths = pageTitle?.path?.split(">").map((path) => path.trim());
return (
<div className="h-auto min-h-full pb-2">
<div className="h-auto min-h-full bg-container pb-2">
<TabBar />
<PageTitle
title={pageTitle?.label ?? ""}
+9 -7
View File
@@ -10,7 +10,10 @@ const TabBar = () => {
return null;
}
const handleCloseTab = (e: React.MouseEvent | React.KeyboardEvent, tabId: string) => {
const handleCloseTab = (
e: React.MouseEvent | React.KeyboardEvent,
tabId: string,
) => {
e.stopPropagation();
removeTab(tabId);
};
@@ -22,22 +25,22 @@ const TabBar = () => {
className="w-full"
variant="outline"
>
<TabsList>
<TabsList className="w-full !justify-start !p-4 !pb-0">
{tabs.map((tab) => (
<TabsTrigger
key={tab.id}
value={tab.id}
className="!px-4 !flex !items-center !justify-start !gap-2 !w-[140px]"
className="!flex !w-[140px] !items-center !justify-start !gap-2 !px-4"
title={tab.label}
>
<span className="text-xl flex-1 leading-none truncate">
<span className="flex-1 truncate text-xl leading-none">
{tab.label}
</span>
<span
role="button"
onClick={(e) => handleCloseTab(e, tab.id)}
aria-label={`${tab.label} 탭 닫기`}
className="flex items-center justify-center flex-shrink-0 leading-none hover:text-[#2094fa]"
className="flex flex-shrink-0 items-center justify-center leading-none hover:text-[#2094fa]"
>
<i className="ri-close-line" />
</span>
@@ -46,7 +49,6 @@ const TabBar = () => {
</TabsList>
</Tabs>
);
}
};
export { TabBar };
@@ -20,7 +20,7 @@ type BannerImageProps = {
lnkgUrlAddr: string;
};
const BannerImage = ({ atflCd, bnrSn, lnkgUrlAddr }: BannerImageProps) => {
const BannerImage = ({ atflCd, lnkgUrlAddr }: BannerImageProps) => {
const { data: imageUrl, isLoading } = useQuery({
queryKey: [ENDPOINT.ATTACH_SERVICE.IMAGES, atflCd],
queryFn: () => getImageUrlByAtflCd(atflCd),
@@ -29,13 +29,13 @@ const BannerImage = ({ atflCd, bnrSn, lnkgUrlAddr }: BannerImageProps) => {
const handleClick = () => {
if (lnkgUrlAddr) {
window.open(lnkgUrlAddr, '_blank');
window.open(lnkgUrlAddr, "_blank");
}
};
if (isLoading) {
return (
<div className="relative flex h-24 items-center justify-center bg-accent mx-auto">
<div className="relative mx-auto flex h-24 items-center justify-center bg-accent">
<div className="text-sm text-muted-foreground">로딩 중...</div>
</div>
);
@@ -43,18 +43,22 @@ const BannerImage = ({ atflCd, bnrSn, lnkgUrlAddr }: BannerImageProps) => {
if (!imageUrl) {
return (
<div className="relative flex h-24 items-center justify-center bg-accent mx-auto">
<div className="relative mx-auto flex h-24 items-center justify-center bg-accent">
<div className="text-sm text-muted-foreground">이미지 없음</div>
</div>
);
}
return (
<div
className="relative flex h-24 items-center justify-center cursor-pointer hover:opacity-80 transition-opacity mx-auto"
<div
className="relative mx-auto flex h-24 cursor-pointer items-center justify-center transition-opacity hover:opacity-80"
onClick={handleClick}
>
<img src={imageUrl} className="object-contain w-full h-full" alt="배너 이미지" />
<img
src={imageUrl}
className="h-full w-full object-contain"
alt="배너 이미지"
/>
</div>
);
};
@@ -70,25 +74,33 @@ export function Footer() {
queryFn: () => getBannerList(siteId),
});
// MAIN 타입 배너만 필터링
const mainBanners = bannerList?.filter((banner) => banner.bnrTypeCd === "BNRFTER") ?? [];
// MAIN 타입 배너만 필터링
const mainBanners =
bannerList?.filter((banner) => banner.bnrTypeCd === "BNRFTER") ?? [];
const plugin = useRef(Autoplay({ delay: 2000, stopOnInteraction: true }));
return (
<footer className="flex flex-col sm:flex-row w-full shrink-0 items-start border-t border-solid border-border bg-background px-3 sm:px-6 pt-4 pb-1 text-foreground">
<div className="w-full sm:w-[55%] mb-4 sm:mb-0">
<h6 className="mb-2 sm:mb-4 text-lg sm:text-xl md:text-2xl font-bold">{siteInfo?.siteNm ?? ""}</h6>
<p className="my-1 text-sm sm:text-base md:text-xl opacity-60">{siteInfo?.siteAddr ?? ""}</p>
<p className="my-1 text-sm sm:text-base md:text-xl opacity-60">
<footer className="flex w-full shrink-0 flex-col items-start border-t border-solid border-border bg-background px-3 pb-1 pt-4 text-foreground sm:flex-row sm:px-6">
<div className="mb-4 w-full sm:mb-0 sm:w-[55%]">
<h6 className="mb-2 text-lg font-bold sm:mb-4 sm:text-xl md:text-2xl">
{siteInfo?.siteNm ?? ""}
</h6>
<p className="my-1 text-sm opacity-60 sm:text-base md:text-xl">
{siteInfo?.siteAddr ?? ""}
</p>
<p className="my-1 text-sm opacity-60 sm:text-base md:text-xl">
전화: {siteInfo?.telNo ?? ""} / 팩스: {siteInfo?.faxNumber ?? ""}
</p>
<p className="my-1 text-sm sm:text-base md:text-xl opacity-60">{siteInfo?.lwndCn ?? ""}</p>
<p className="my-1 text-sm opacity-60 sm:text-base md:text-xl">
{siteInfo?.lwndCn ?? ""}
</p>
</div>
<div className="flex w-full sm:w-[45%] flex-col">
<div className="flex flex-wrap justify-start sm:justify-end gap-2 sm:gap-4 mb-4 sm:mb-0">
<span className="text-sm sm:text-base md:text-xl">개인정보처리방침</span>
<div className="flex w-full flex-col sm:w-[45%]">
<div className="mb-4 flex flex-wrap justify-start gap-2 sm:mb-0 sm:justify-end sm:gap-4">
<span className="text-sm sm:text-base md:text-xl">
개인정보처리방침
</span>
<span className="text-sm sm:text-base md:text-xl">이용약관</span>
<span className="text-sm sm:text-base md:text-xl">사이트맵</span>
<span className="text-sm sm:text-base md:text-xl">고객센터</span>
@@ -97,29 +109,34 @@ export function Footer() {
<Carousel
plugins={[plugin.current]}
opts={{ loop: true }}
className="relative my-4 sm:my-8 h-20 sm:h-24"
className="relative my-4 h-20 sm:my-8 sm:h-24"
>
<CarouselContent>
{mainBanners && mainBanners.length > 0 ? (
mainBanners.map((banner) => (
<CarouselItem key={`banner-${banner.bnrSn}`} className="basis-1/2 sm:basis-1/3">
<BannerImage
atflCd={banner.atflCd}
bnrSn={banner.bnrSn}
<CarouselItem
key={`banner-${banner.bnrSn}`}
className="basis-1/2 sm:basis-1/3"
>
<BannerImage
atflCd={banner.atflCd}
bnrSn={banner.bnrSn}
lnkgUrlAddr={banner.lnkgUrlAddr}
/>
</CarouselItem>
))
) : (
<CarouselItem className="basis-1/2 sm:basis-1/3">
<div className="relative flex h-20 sm:h-24 w-full items-center justify-center bg-accent">
<div className="text-sm text-muted-foreground">배너가 없습니다</div>
<div className="relative flex h-20 w-full items-center justify-center bg-accent sm:h-24">
<div className="text-sm text-muted-foreground">
배너가 없습니다
</div>
</div>
</CarouselItem>
)}
</CarouselContent>
<CarouselPrevious className="absolute left-2 top-1/2 !bg-[rgba(255,255,255,0.8)] text-accent-foreground z-10" />
<CarouselNext className="absolute right-2 top-1/2 !bg-[rgba(255,255,255,0.8)] text-accent-foreground z-10" />
<CarouselPrevious className="absolute left-2 top-1/2 z-10 !bg-background text-accent-foreground" />
<CarouselNext className="absolute right-2 top-1/2 z-10 !bg-background text-accent-foreground" />
</Carousel>
</div>
</div>
@@ -1,27 +1,42 @@
@tailwind components;
@layer components {
/* 상단 메뉴 호버 시 하단 라인 - 기본 테마 */
.header-nav-link {
position: relative;
}
.header-nav-link::after {
content: '';
/* .header-nav-link::before {
content: "";
position: absolute;
bottom: -4px;
left: 0;
width: 0;
height: 2px;
background-color: #063A74;
background-color: #063a74;
transition: width 0.3s ease;
}
.header-nav-link:hover::after {
.header-nav-link:hover::before {
width: 100%;
} */
/* 네비게이션 아이템 사이 구분선 */
.header-nav-link::after {
content: "";
position: absolute;
left: -0.75rem;
top: 50%;
transform: translateY(-50%);
width: 1px !important;
height: 1.5rem !important;
background-color: var(--border);
}
.header-nav-link:first-child::after {
display: none;
}
[data-theme="blue"] {
header {
background: #00afe5;
@@ -35,7 +50,7 @@
color: #fff;
}
header button[role="button"].primary {
background-color: #008E8D !important;
background-color: #008e8d !important;
color: #fff !important;
}
nav a,
@@ -45,7 +60,7 @@
.header-nav-link:hover {
color: #fff !important;
}
.header-nav-link::after {
.header-nav-link::before {
background-color: #fff;
}
}
@@ -63,7 +78,7 @@
color: #fff;
}
header button[role="button"].primary {
background-color: #008E8D !important;
background-color: #008e8d !important;
color: #fff !important;
}
nav a,
@@ -73,9 +88,8 @@
.header-nav-link:hover {
color: #fff !important;
}
.header-nav-link::after {
.header-nav-link::before {
background-color: #fff;
}
}
}
@@ -21,6 +21,7 @@ import { SidebarTrigger } from "../sidebar";
import { Popover, PopoverContent, PopoverTrigger } from "../popover";
import { SearchForm } from "./search-form";
import { NoticePopover } from "./notice-popover";
import { ScrollArea, ScrollBar } from "../scroll-area";
const appConfig = getConfig();
const userId = getCookie(appConfig.AUTH_USER_ID ?? "");
@@ -71,7 +72,7 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {
method: "POST",
credentials: "include", // ⭐ 쿠키 포함 중요!
});
if (!response.ok) {
console.error("Logout API failed");
// API 실패해도 계속 진행
@@ -82,42 +83,42 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {
} finally {
// 2. 클라이언트 쿠키 삭제 (백업)
clearClientCookies();
// 3. 로컬/세션 스토리지 정리
if (typeof window !== "undefined") {
localStorage.clear();
sessionStorage.clear();
}
// 4. 로그인 페이지로 리다이렉트
window.location.href = "/auth/login";
}
};
// 쿠키 삭제 헬퍼 함수
const clearClientCookies = () => {
const actualHost = window.location.hostname;
// 루트 도메인 추출
const getRootDomain = (hostname: string): string => {
if (hostname === "localhost" || /^\d+\.\d+\.\d+\.\d+$/.test(hostname)) {
return hostname;
}
if (hostname.includes("hasuon.or.kr")) {
return ".hasuon.or.kr";
}
const parts = hostname.split(".");
if (parts.length >= 2) {
return `.${parts.slice(-2).join(".")}`;
}
return hostname;
};
const domain = getRootDomain(actualHost);
// 삭제할 쿠키 목록
const cookiesToDelete = [
appConfig.AUTH_USER_ID,
@@ -127,26 +128,26 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {
"site-id-key",
"site-theme-key",
].filter(Boolean); // undefined 제거
// 여러 방법으로 쿠키 삭제 시도
cookiesToDelete.forEach((cookieName) => {
if (!cookieName) return;
// 방법 1: removeCookie 함수 사용
if (domain === "localhost") {
removeCookie(cookieName, {});
} else {
removeCookie(cookieName, { domain });
}
// 방법 2: 직접 document.cookie 설정 (도메인 포함)
if (domain !== "localhost") {
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=${domain}`;
}
// 방법 3: 도메인 없이 삭제 (현재 도메인만)
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
// 방법 4: Secure 속성 포함 삭제
if (window.location.protocol === "https:") {
if (domain !== "localhost") {
@@ -156,66 +157,7 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {
}
});
};
/*
const logout = async () => {
try {
const response = await fetch("/api/auth/logout", {
method: "POST",
});
if (!response.ok) throw new Error("Failed to logout");
const actualHost = window.location.hostname;
// 서브도메인 쿠키 삭제를 위한 루트 도메인 추출
const getRootDomain = (hostname: string): string => {
// localhost나 IP 주소인 경우
if (hostname === "localhost" || /^\d+\.\d+\.\d+\.\d+$/.test(hostname)) {
return hostname;
}
// hasuon.or.kr 도메인인 경우
if (hostname.includes("hasuon.or.kr")) {
return ".hasuon.or.kr";
}
// 일반적인 도메인의 경우 루트 도메인 추출 (예: sub.example.com → .example.com)
const parts = hostname.split(".");
if (parts.length >= 2) {
// 마지막 두 부분을 사용 (예: example.com)
return `.${parts.slice(-2).join(".")}`;
}
return hostname;
};
const domain = getRootDomain(actualHost);
const cookieOptions = domain.startsWith(".") || domain === "localhost"
? { domain }
: {};
// 쿠키 삭제 (서브도메인 포함)
if (appConfig.AUTH_USER_ID) {
removeCookie(appConfig.AUTH_USER_ID, cookieOptions);
}
if (appConfig.REFRESH_TOKEN) {
removeCookie(appConfig.REFRESH_TOKEN, cookieOptions);
}
if (appConfig.ACCESS_TOKEN) {
removeCookie(appConfig.ACCESS_TOKEN, cookieOptions);
}
if (appConfig.CLAIM_NAME) {
removeCookie(appConfig.CLAIM_NAME, cookieOptions);
}
removeCookie("site-id-key", cookieOptions);
removeCookie("site-theme-key", cookieOptions);
window.location.href = "/auth/login";
} catch (error) {
console.error(error);
}
};
*/
const openPopup = useCallback(async (popup: Popup) => {
try {
const cookieName = `cs-popup-hide-for-day-${popup.popupSn}`;
@@ -268,8 +210,8 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {
}, []);
return (
<header className="sticky top-0 z-30 box-border flex flex-col sm:flex-row h-[6rem] w-full items-center justify-between border-b border-solid border-border bg-background">
<div className="flex items-center px-2 sm:px-4 md:px-6 w-full sm:w-auto justify-between sm:justify-start">
<header className="sticky top-0 z-30 box-border flex h-[6rem] w-full flex-col items-center justify-between border-b border-solid border-border bg-background sm:flex-row">
<div className="flex w-full items-center justify-between px-2 sm:w-auto sm:justify-start sm:px-4 md:px-6">
<div className="flex items-center gap-2 sm:gap-4">
<SidebarTrigger className="size-12 !bg-transparent p-2 hover:!bg-accent [&>svg]:!size-full [&>svg]:text-foreground" />
<h1 className="flex flex-col items-center gap-2">
@@ -291,7 +233,10 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {
<span
className="text-[1.2rem] font-semibold text-foreground"
style={{
letterSpacing: logoWidth > 0 ? `${(logoWidth - 120) / (siteInfo?.siteNm?.length || 1)}px` : '0.05em'
letterSpacing:
logoWidth > 0
? `${(logoWidth - 120) / (siteInfo?.siteNm?.length || 1)}px`
: "0.05em",
}}
>
{siteInfo?.siteNm}
@@ -306,7 +251,9 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {
onClick={() => setIsMobileMenuOpen(!isMobileMenuOpen)}
className="m-0 flex h-[3rem] items-center !bg-background px-3 py-0 text-label"
>
<i className={`diveicon ${isMobileMenuOpen ? 'di-menu-close-fill' : 'di-menu-open-fill'} static text-4xl`} />
<i
className={`diveicon ${isMobileMenuOpen ? "di-menu-close-fill" : "di-menu-open-fill"} static text-4xl`}
/>
</Button>
)}
{mounted && isLoggedIn && (
@@ -314,7 +261,9 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {
<PopoverTrigger asChild>
<Button className="group m-0 flex h-[3rem] items-center !bg-background px-2 py-0 text-label">
<i className="diveicon di-account-circle static translate-y-0.5 pr-2 text-3xl" />
<span className="text-xs hidden xs:inline">{userInfo?.userName}</span>
<span className="xs:inline hidden text-xs">
{userInfo?.userName}
</span>
<i className="diveicon di-chevron-down static p-0 transition-transform group-data-[state=open]:rotate-180" />
</Button>
</PopoverTrigger>
@@ -337,57 +286,60 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {
</div>
{/* 모바일에서 네비게이션 (토글 시 표시) */}
{isMobileMenuOpen && (
<div className="w-full sm:hidden border-t border-border bg-background py-2">
{mounted && userSiteList?.content && userSiteList.content.length > 0 && (
<nav className="flex flex-col items-center gap-2 px-4">
<div className="w-full border-t border-border bg-background py-2 sm:hidden">
{mounted &&
userSiteList?.content &&
userSiteList.content.length > 0 && (
<nav className="flex flex-col items-center gap-2 px-4">
{userSiteList.content.map((site) => (
<a
key={site.siteId}
href={site.dmnAddr}
className="w-full py-2 text-center text-xl font-medium text-foreground transition-colors hover:text-primary"
target="_blank"
rel="noopener noreferrer"
onClick={() => setIsMobileMenuOpen(false)}
>
{site.siteNm}
</a>
))}
</nav>
)}
</div>
)}
{/* 데스크톱에서 중간 네비게이션 */}
<ScrollArea className="hidden max-w-[calc(100vw-60rem)] flex-1 items-center justify-center px-2 py-4 sm:flex">
{mounted &&
userSiteList?.content &&
userSiteList.content.length > 0 && (
<nav className="flex w-full flex-nowrap items-center justify-start gap-3 overflow-x-auto whitespace-nowrap md:gap-6">
{userSiteList.content.map((site) => (
<a
key={site.siteId}
href={site.dmnAddr}
className="text-xl font-medium text-foreground hover:text-primary transition-colors w-full text-center py-2"
className="header-nav-link whitespace-nowrap text-sm font-medium text-foreground transition-colors hover:text-primary md:text-lg lg:text-2xl"
target="_blank"
rel="noopener noreferrer"
onClick={() => setIsMobileMenuOpen(false)}
>
{site.siteNm}
</a>
))}
</nav>
)}
</div>
)}
{/* 데스크톱에서 중간 네비게이션 */}
<div className="hidden sm:flex items-center flex-1 justify-center px-2">
{mounted && userSiteList?.content && userSiteList.content.length > 0 && (
<nav className="flex items-center gap-3 md:gap-6 flex-wrap justify-center">
{userSiteList.content.map((site, index) => (
<div key={site.siteId} className="flex items-center">
<a
href={site.dmnAddr}
className="text-sm md:text-lg lg:text-2xl font-medium text-foreground hover:text-primary transition-colors header-nav-link"
target="_blank"
rel="noopener noreferrer"
>
{site.siteNm}
</a>
{index < userSiteList.content.length - 1 && (
<div className="w-px h-4 md:h-6 bg-border ml-3 md:ml-6"></div>
)}
</div>
))}
</nav>
)}
</div>
<ScrollBar orientation="horizontal" />
</ScrollArea>
{/* 데스크톱에서 오른쪽 요소들 */}
<div className="hidden sm:flex items-center gap-2 px-2 md:px-4">
<div className="hidden items-center gap-2 px-2 sm:flex md:px-4">
<SearchForm />
{mounted ? (
isLoggedIn && (
<Popover>
<PopoverTrigger asChild>
<Button className="group m-0 flex h-[3rem] items-center !bg-background px-2 md:px-4 py-0 text-label">
<i className="diveicon di-account-circle static translate-y-0.5 pr-1 md:pr-2 text-2xl md:text-3xl" />
<span className="text-sm md:text-base hidden md:inline">{userInfo?.userName}</span>
<Button className="group m-0 flex h-[3rem] items-center !bg-background px-2 py-0 text-label md:px-4">
<i className="diveicon di-account-circle static translate-y-0.5 pr-1 text-2xl md:pr-2 md:text-3xl" />
<span className="hidden text-sm md:inline md:text-base">
{userInfo?.userName}
</span>
<i className="diveicon di-chevron-down static p-0 transition-transform group-data-[state=open]:rotate-180" />
</Button>
</PopoverTrigger>