From 9ef58ef1530066a26c24456b9c54f3c94568080c Mon Sep 17 00:00:00 2001 From: rsone001 Date: Wed, 11 Mar 2026 10:38:25 +0900 Subject: [PATCH] =?UTF-8?q?st:=20=EB=A9=94=EB=89=B4=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20road=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95,=20TabDataGri?= =?UTF-8?q?d=20=EC=88=98=EC=A0=95,=20=EC=9D=BC=EB=B0=98=EA=B2=80=EC=A6=9D?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20=ED=99=94=EB=A9=B4=20=EC=9E=91=EC=97=85=20?= =?UTF-8?q?=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/st/app/(with-base-layout)/layout.tsx | 2 +- apps/st/src/components/module/TabDataGrid.tsx | 611 ++++++++++-------- .../statistics/input/SewagePipeInp.tsx | 105 ++- .../input/SeweragePenetrationRateInp.tsx | 64 +- .../statistics/input/StatsInputStatusInp.tsx | 71 +- .../statistics/input/SubmitDailog.tsx | 2 +- .../GeneralVerificationManagement.tsx | 180 ++++-- apps/st/src/components/type/DataGrid.type.ts | 4 + .../sewagePipe/RegionalFactStatusInpColumn.ts | 153 ++--- .../input/sewagePipe/SewagePipeInpColumn.ts | 17 + .../management/GeneralVerificationColumn.tsx | 62 ++ ...tatistics-input-sew-supply-rate-service.ts | 4 +- .../statistics/api/statistics-service.ts | 11 + .../model/general-verification-interface.ts | 12 + .../statistics/model/statistics-interface.ts | 15 + ...tics-sewage-supply-rate-input-interface.ts | 2 + .../src/shared/ui/statistics-page-layout.tsx | 2 +- apps/st/src/store/tab-store.ts | 2 +- 18 files changed, 829 insertions(+), 490 deletions(-) create mode 100644 apps/st/src/components/util/column/input/sewagePipe/SewagePipeInpColumn.ts create mode 100644 apps/st/src/components/util/column/management/GeneralVerificationColumn.tsx create mode 100644 apps/st/src/entities/statistics/model/general-verification-interface.ts diff --git a/apps/st/app/(with-base-layout)/layout.tsx b/apps/st/app/(with-base-layout)/layout.tsx index 3fe61855e..98c126bf6 100644 --- a/apps/st/app/(with-base-layout)/layout.tsx +++ b/apps/st/app/(with-base-layout)/layout.tsx @@ -76,7 +76,7 @@ export default function WithBaseLayout({ // menuList에서 활성 탭의 메뉴 찾기 const findMenuByEngNm = (items: MenuItem[]): MenuItem | null => { for (const item of items) { - if (item.menuEngNm === activeTabId) { + if (item.urlPath === activeTabId) { return item; } if (item.children) { diff --git a/apps/st/src/components/module/TabDataGrid.tsx b/apps/st/src/components/module/TabDataGrid.tsx index aa36287ee..cbbe53a0c 100644 --- a/apps/st/src/components/module/TabDataGrid.tsx +++ b/apps/st/src/components/module/TabDataGrid.tsx @@ -92,20 +92,20 @@ function toNum(v: unknown): number { // } // } // } - + // if (!gridEl) return; - + // columns.forEach((col) => { // if (!col.fieldName && !col.name) return; - + // const fieldName = col.fieldName || col.name; // const direction = sortDir[fieldName] || sortDir[col.name] || "none"; // if (direction === "none") return; - + // // 헤더 셀 찾기 (fieldName 또는 name으로) // const headerCells = gridEl.querySelectorAll('.rg-header-cell, [class*="header"], .rg-header'); // let targetCell: HTMLElement | null = null; - + // headerCells.forEach((cell) => { // const el = cell as HTMLElement; // const text = el.textContent?.trim(); @@ -121,17 +121,17 @@ function toNum(v: unknown): number { // targetCell = el; // } // }); - + // if (!targetCell) return; - + // const headerCell = targetCell as HTMLElement; - + // // 기존 화살표 제거 // const existingIndicator = headerCell.querySelector(".rg-sort-indicator") as HTMLElement | null; // if (existingIndicator) { // existingIndicator.remove(); // } - + // // 화살표 추가 // const indicator = document.createElement("span"); // indicator.className = "rg-sort-indicator"; @@ -164,7 +164,7 @@ function createOnSortingHandler( const groupField = mergeCellCol?.fieldName || null; const orderByField = 'displayYear'; // 고정값 또는 설정 가능하게 할 수 있음 const hasMergeCells = mergeCellCols.length > 0; - + return function onSorting(g: unknown, fields: unknown[], _directions: unknown[]) { const grid = g as { getColumn?: (i: number) => { fieldName?: string; name?: string } | undefined; getDataSource?: () => { getRowCount(): number; getValue(r: number, f: string): unknown } }; const idx = fields?.[0]; @@ -178,10 +178,10 @@ function createOnSortingHandler( if (!sortField) return true; const col = columns.find((c) => (c.fieldName === sortField || c.name === sortField)); if (!col || col.sortdisable) return true; - + // mergeCells: true인 컬럼이 없으면 RealGrid 기본 정렬 사용 if (!hasMergeCells || !groupField) return true; - + const ds = grid.getDataSource?.(); if (!ds) return true; const cnt = ds.getRowCount(); @@ -229,7 +229,7 @@ function sortRowsGroupPreserving( if (!groups.has(k)) groups.set(k, []); groups.get(k)!.push(r); } - + // valueType에 따라 비교 함수 선택 const compareValue = (val: unknown): number | string => { if (valueType === ValueType.NUMBER) { @@ -238,7 +238,7 @@ function sortRowsGroupPreserving( // 텍스트나 기타 타입은 문자열로 비교 return String(val ?? ""); }; - + const rep = (arr: Record[]): number | string => { const values = arr.map((r) => compareValue(r[sortField])); if (valueType === ValueType.NUMBER) { @@ -253,7 +253,7 @@ function sortRowsGroupPreserving( return sortAsc ? (strs[0] as string) : (strs[strs.length - 1] as string); } }; - + const entries = [...groups.entries()].sort((a, b) => { const valA = rep(a[1]); const valB = rep(b[1]); @@ -265,7 +265,7 @@ function sortRowsGroupPreserving( const strB = String(valB); return (sortAsc ? 1 : -1) * strA.localeCompare(strB); }); - + return entries.flatMap(([, arr]) => arr); } @@ -306,9 +306,10 @@ function createNumberComparer(dp: RealGridDataProviderComparer): (field: string }; } -const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, rows = [], showHeaderCheckbox = false, rowDataMap, setRowDataMap, activeTab: activeTabProp, onActiveTabChange }: TabDataGridProps) => { +const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, rows = [], showHeaderCheckbox = false, rowDataMap, setRowDataMap, activeTab: activeTabProp, onActiveTabChange, getGridDataRef }: TabDataGridProps) => { // 각 탭별로 그리드 ref와 데이터를 관리 const gridRefs = useRef>(new Map()); + const activeTabRef = useRef(""); const fileInputRefs = useRef>(new Map()); // 각 탭별로 정렬 상태 관리 const sortDirRefs = useRef>>>(new Map()); @@ -323,7 +324,8 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r }); const isControlled = activeTabProp !== undefined; const activeTab = isControlled ? activeTabProp : internalActiveTab; - const setActiveTab = isControlled ? (onActiveTabChange ?? (() => {})) : setInternalActiveTab; + const setActiveTab = isControlled ? (onActiveTabChange ?? (() => { })) : setInternalActiveTab; + activeTabRef.current = activeTab; const exportExcel = (tabKey: string) => { const currentRowData = rowDataMap.get(tabKey) || []; @@ -345,7 +347,7 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r const columnInfoItem = columnInfo.find(info => info.tabKey === tabKey); if (!columnInfoItem) return; - + const tabLabel = columnInfoItem.tabLabel || tabKey; const columns = columnInfoItem.columns || []; const columnLayout = columnInfoItem.columnLayout || []; @@ -520,7 +522,7 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r const columns = columnInfoItem.columns || []; headers.forEach((headerText, colIndex) => { let fieldName: string | null = null; - + // 헤더에 fieldName이 포함된 경우 (예: "합계 (swgeProcZoneInnerSm)") const fieldNameMatch = headerText.match(/\(([a-zA-Z_][a-zA-Z0-9_]*)\)$/); if (fieldNameMatch && fieldNameMatch[1]) { @@ -529,13 +531,13 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r fieldName = extractedFieldName; } } - + // 매칭 실패 시 원본 헤더 텍스트 사용 if (!fieldName) { console.warn(`엑셀 컬럼 ${colIndex + 1} (헤더: "${headerText}") 매칭 실패 → 헤더 텍스트를 fieldName으로 사용`); fieldName = headerText; } - + headerToFieldNameMap.set(headerText, fieldName); }); @@ -656,6 +658,41 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r }); }, [rowDataMap, columnInfo]); + // getGridDataRef: 현재 활성 탭 그리드 데이터 반환 함수 할당 + useEffect(() => { + if (!getGridDataRef) return; + getGridDataRef.current = () => { + const tabKey = activeTabRef.current; + const gridRef = gridRefs.current.get(tabKey); + const gv = gridRef?.gridView as + | { + getDataSource?: () => { + getRowCount(): number; + getValue(r: number, f: string): unknown; + }; + } + | undefined; + if (!gv?.getDataSource) return []; + const ds = gv.getDataSource(); + if (!ds) return []; + const currentInfo = columnInfo.find((info) => info.tabKey === tabKey); + const columns = currentInfo?.columns ?? []; + const fieldNames = columns + .map((c) => c.fieldName) + .filter((x): x is string => Boolean(x)); + const cnt = ds.getRowCount(); + const rows: Record[] = []; + for (let i = 0; i < cnt; i++) { + const r: Record = {}; + for (const f of fieldNames) r[f] = ds.getValue(i, f) as string | number; + rows.push(r); + } + return rows; + }; + return () => { + if (getGridDataRef) getGridDataRef.current = null; + }; + }, [columnInfo, getGridDataRef]); // 탭 전환 시 그리드 레이아웃·푸터·포맷 재적용 (여러 시점 + ResizeObserver) const appliedTabRef = useRef(null); @@ -728,7 +765,7 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r if (item.valueCallback && footerArr[i]) (footerArr[i] as FooterItemWithCallback).valueCallback = item.valueCallback; }); - } catch (_) {} + } catch (_) { } }); } columns.forEach(col => { @@ -738,7 +775,7 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r 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 (_) {} + } catch (_) { } }); if (dp?.setRows && tabRowData.length) dp.setRows(tabRowData); @@ -788,7 +825,7 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r {columnInfo.map((info) => { const tabKey = info.tabKey; - + // isSplitGrid가 true이고 left, right가 있으면 SplitDataGrid 사용 if (info.isSplitGrid && info.left && info.right) { const leftRowData = rowDataMap.get(info.left.tabKey || `${tabKey}_left`) || []; @@ -886,277 +923,277 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r
{activeTab === tabKey ? ( - { - if (el) { - gridRefs.current.set(tabKey, el); - // 그리드가 생성된 직후 fitStyle 설정 - if (el.gridView) { - setTimeout(() => { - const gridView = el.gridView; - if (!gridView) return; - - const currentInfo = columnInfo.find(info => info.tabKey === tabKey); - if (!currentInfo || !currentInfo.columns) return; - - const columns = currentInfo.columns; - - const dp = el.dataProvider as { setFields?: (fields: unknown[]) => void; setRows?: (rows: Record[]) => 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 - }); - gridView.header.height = 60; - - // 헤더 체크박스 표시 여부 설정 - gridView.setOptions({ - checkBar: { visible: showHeaderCheckbox }, - rowIndicator: { visible: false }, - }); - - // footer가 있는 컬럼이 있으면 footer 높이 설정 - const hasFooter = columns.some(col => col.footer); - if (hasFooter) { - // footer가 배열이거나 multiRow가 true인 footer가 있으면 멀티푸터 설정 (여러 행) - const hasArrayFooter = columns.some(col => col.footer && Array.isArray(col.footer)); - const hasMultiRowFooter = columns.some(col => { - const footer = col.footer; - return footer && !Array.isArray(footer) && 'multiRow' in footer && footer.multiRow === true; - }); - if (hasArrayFooter || hasMultiRowFooter) { - // footer 배열의 길이를 확인하여 행 수 결정 - const arrayFooterLengths = columns - .filter(col => col.footer && Array.isArray(col.footer)) - .map(col => (col.footer as unknown[]).length); - const maxFooterLength = arrayFooterLengths.length > 0 - ? Math.max(...arrayFooterLengths) - : 2; // 기본값 2 - const footerHeights = Array.from({ length: maxFooterLength }, () => ({ height: 40 })); - gridView.setFooters?.(footerHeights); - } else { - gridView.footer.height = 40; - } - } - - gridView.setOptions({ - summaryMode: "aggregate" - }); - - // footerUserSpans가 있는 경우 setColumnLayout으로 설정 - const checkFooterUserSpans = (layout: unknown[]): boolean => { - return layout.some(item => { - if (typeof item === 'string') return false; - if (item && typeof item === 'object' && 'footerUserSpans' in item) return true; - if (item && typeof item === 'object' && 'items' in item && Array.isArray(item.items)) { - return checkFooterUserSpans(item.items); - } - return false; - }); - }; - - if (checkFooterUserSpans(columnLayout)) { - // setColumnLayout은 그리드가 완전히 렌더링된 후 호출해야 함 - setTimeout(() => { - if (gridView && columnLayout) { - gridView.setColumnLayout?.(columnLayout); - } - }, 100); - } - - // footer 설정 (배열 또는 단일 객체 모두 처리) - // setFooters 호출 후 footer 배열 설정 + { + if (el) { + gridRefs.current.set(tabKey, el); + // 그리드가 생성된 직후 fitStyle 설정 + if (el.gridView) { setTimeout(() => { - const currentGridView = gridView; - if (!currentGridView || !currentGridView.columnByName) { - console.warn('GridView not available for footer setup'); - return; + const gridView = el.gridView; + if (!gridView) return; + + const currentInfo = columnInfo.find(info => info.tabKey === tabKey); + if (!currentInfo || !currentInfo.columns) return; + + const columns = currentInfo.columns; + + const dp = el.dataProvider as { setFields?: (fields: unknown[]) => void; setRows?: (rows: Record[]) => void } | undefined; + if (dp?.setFields) { + dp.setFields(buildFieldsFromColumns(columns)); } - - // footer가 배열인 컬럼이 있으면 setColumns를 다시 호출하여 footer 설정 - const hasArrayFooter = columns.some(col => col.footer && Array.isArray(col.footer)); - if (hasArrayFooter) { - // 모든 컬럼 정보를 다시 가져와서 footer 배열을 포함하여 setColumns 호출 - const columnsWithFooter: RealGridColumnInfo[] = columns.map(col => { - const colInfo: 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: col.mergeGroupField ? `values['${col.mergeGroupField}'] + value` : 'value' as const } }), - }; - - if (col.footer) { - if (Array.isArray(col.footer)) { - colInfo.footer = col.footer; - } else { - colInfo.footer = { - text: col.footer.text, - expression: col.footer.expression, - numberFormat: col.footer.numberFormat, - }; - } - } - - return colInfo; + // setFields 호출 직후 행 데이터 적용 (realgrid-react의 setRows 타이밍 이슈 방지) + const tabRowData = rowDataMap.get(tabKey) || []; + if (dp?.setRows && tabRowData.length) { + dp.setRows(tabRowData); + } + + gridView.setDisplayOptions({ + fitStyle: GridFitStyle.EVEN + }); + gridView.header.height = 60; + + // 헤더 체크박스 표시 여부 설정 + gridView.setOptions({ + checkBar: { visible: showHeaderCheckbox }, + rowIndicator: { visible: false }, + }); + + // footer가 있는 컬럼이 있으면 footer 높이 설정 + const hasFooter = columns.some(col => col.footer); + if (hasFooter) { + // footer가 배열이거나 multiRow가 true인 footer가 있으면 멀티푸터 설정 (여러 행) + const hasArrayFooter = columns.some(col => col.footer && Array.isArray(col.footer)); + const hasMultiRowFooter = columns.some(col => { + const footer = col.footer; + return footer && !Array.isArray(footer) && 'multiRow' in footer && footer.multiRow === true; }); - - try { - (currentGridView as GridViewWithSetColumns).setColumns?.(columnsWithFooter); - - // setColumns 호출 후 footer 배열의 valueCallback을 다시 설정 - setTimeout(() => { - columns.forEach(col => { - if (!col.footer || !Array.isArray(col.footer)) return; - - try { - const column = currentGridView.columnByName(col.name); - if (!column) return; - - // footer 배열의 각 요소에 valueCallback 설정 - col.footer.forEach((footerItem, index) => { - if (footerItem.valueCallback && column.footer) { - // footer가 배열인 경우 - if (Array.isArray(column.footer) && column.footer[index]) { - (column.footer[index] as FooterItemWithCallback).valueCallback = footerItem.valueCallback; - } - } - }); - } catch (e) { - console.warn(`Error setting footer array valueCallback for column ${col.name}:`, e); + if (hasArrayFooter || hasMultiRowFooter) { + // footer 배열의 길이를 확인하여 행 수 결정 + const arrayFooterLengths = columns + .filter(col => col.footer && Array.isArray(col.footer)) + .map(col => (col.footer as unknown[]).length); + const maxFooterLength = arrayFooterLengths.length > 0 + ? Math.max(...arrayFooterLengths) + : 2; // 기본값 2 + const footerHeights = Array.from({ length: maxFooterLength }, () => ({ height: 40 })); + gridView.setFooters?.(footerHeights); + } else { + gridView.footer.height = 40; + } + } + + gridView.setOptions({ + summaryMode: "aggregate" + }); + + // footerUserSpans가 있는 경우 setColumnLayout으로 설정 + const checkFooterUserSpans = (layout: unknown[]): boolean => { + return layout.some(item => { + if (typeof item === 'string') return false; + if (item && typeof item === 'object' && 'footerUserSpans' in item) return true; + if (item && typeof item === 'object' && 'items' in item && Array.isArray(item.items)) { + return checkFooterUserSpans(item.items); + } + return false; + }); + }; + + if (checkFooterUserSpans(columnLayout)) { + // setColumnLayout은 그리드가 완전히 렌더링된 후 호출해야 함 + setTimeout(() => { + if (gridView && columnLayout) { + gridView.setColumnLayout?.(columnLayout); + } + }, 100); + } + + // footer 설정 (배열 또는 단일 객체 모두 처리) + // setFooters 호출 후 footer 배열 설정 + setTimeout(() => { + const currentGridView = gridView; + if (!currentGridView || !currentGridView.columnByName) { + console.warn('GridView not available for footer setup'); + return; + } + + // footer가 배열인 컬럼이 있으면 setColumns를 다시 호출하여 footer 설정 + const hasArrayFooter = columns.some(col => col.footer && Array.isArray(col.footer)); + if (hasArrayFooter) { + // 모든 컬럼 정보를 다시 가져와서 footer 배열을 포함하여 setColumns 호출 + const columnsWithFooter: RealGridColumnInfo[] = columns.map(col => { + const colInfo: 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: col.mergeGroupField ? `values['${col.mergeGroupField}'] + value` : 'value' as const } }), + }; + + if (col.footer) { + if (Array.isArray(col.footer)) { + colInfo.footer = col.footer; + } else { + colInfo.footer = { + text: col.footer.text, + expression: col.footer.expression, + numberFormat: col.footer.numberFormat, + }; } - }); - }, 50); - } catch (e) { - console.warn('Failed to set columns with footer array:', e); - } - } - - // footer가 단일 객체이고 valueCallback이 있는 경우 - columns.forEach(col => { - if (!col.footer || Array.isArray(col.footer)) return; - - try { - const column = currentGridView.columnByName(col.name); - if (!column || !column.footer) return; - - const footerObj = col.footer as { valueCallback?: (grid: unknown, column: unknown, footerIndex: number, columnFooter: unknown, value: unknown) => unknown }; - if (footerObj.valueCallback) { - (column.footer as { valueCallback?: typeof footerObj.valueCallback }).valueCallback = footerObj.valueCallback; - } - } catch (e) { - console.warn(`Error setting footer valueCallback for column ${col.name}:`, e); - } - }); - }, 200); - - // 고정 컬럼 설정 - if (currentInfo.fixedColumns !== undefined && currentInfo.fixedColumns > 0) { - gridView.setFixedOptions({ - colCount: currentInfo.fixedColumns, - }); - } - - // 각 탭별 ref 초기화 - if (!sortDirRefs.current.has(tabKey)) { - sortDirRefs.current.set(tabKey, { current: {} }); - } - if (!originalRowsRefs.current.has(tabKey)) { - originalRowsRefs.current.set(tabKey, { current: {} }); - } - - const sortDirRef = sortDirRefs.current.get(tabKey)!; - const originalRowsRef = originalRowsRefs.current.get(tabKey)!; - - // mergeCells: true인 컬럼이 있으면 onSorting에서 클라이언트 정렬로 처리 - const hasMergeCells = columns.some((col) => col.mergeCells === true); - - // setDataComparer로 숫자 정렬 (mergeCells가 있으면 onSorting에서 클라이언트 정렬로 처리) - if (el.dataProvider) { - const dp = el.dataProvider as RealGridDataProviderComparer; - if (typeof dp.setDataComparer === "function" && typeof dp.getValue === "function") { - const numberComparer = createNumberComparer(dp); - const seen = new Set(); - columns.forEach((col) => { - if (hasMergeCells) return; // mergeCells가 있으면 모든 컬럼을 클라이언트 정렬로 처리 - if (col.valueType === ValueType.NUMBER && col.fieldName && !seen.has(col.fieldName)) { - seen.add(col.fieldName); - try { - dp.setDataComparer!(col.fieldName, numberComparer); - } catch (e) { - console.warn("setDataComparer:", e); } + + return colInfo; + }); + + try { + (currentGridView as GridViewWithSetColumns).setColumns?.(columnsWithFooter); + + // setColumns 호출 후 footer 배열의 valueCallback을 다시 설정 + setTimeout(() => { + columns.forEach(col => { + if (!col.footer || !Array.isArray(col.footer)) return; + + try { + const column = currentGridView.columnByName(col.name); + if (!column) return; + + // footer 배열의 각 요소에 valueCallback 설정 + col.footer.forEach((footerItem, index) => { + if (footerItem.valueCallback && column.footer) { + // footer가 배열인 경우 + if (Array.isArray(column.footer) && column.footer[index]) { + (column.footer[index] as FooterItemWithCallback).valueCallback = footerItem.valueCallback; + } + } + }); + } catch (e) { + console.warn(`Error setting footer array valueCallback for column ${col.name}:`, e); + } + }); + }, 50); + } catch (e) { + console.warn('Failed to set columns with footer array:', e); + } + } + + // footer가 단일 객체이고 valueCallback이 있는 경우 + columns.forEach(col => { + if (!col.footer || Array.isArray(col.footer)) return; + + try { + const column = currentGridView.columnByName(col.name); + if (!column || !column.footer) return; + + const footerObj = col.footer as { valueCallback?: (grid: unknown, column: unknown, footerIndex: number, columnFooter: unknown, value: unknown) => unknown }; + if (footerObj.valueCallback) { + (column.footer as { valueCallback?: typeof footerObj.valueCallback }).valueCallback = footerObj.valueCallback; + } + } catch (e) { + console.warn(`Error setting footer valueCallback for column ${col.name}:`, e); } }); + }, 200); + + // 고정 컬럼 설정 + if (currentInfo.fixedColumns !== undefined && currentInfo.fixedColumns > 0) { + gridView.setFixedOptions({ + colCount: currentInfo.fixedColumns, + }); } - } - - // mergeCells: true인 컬럼이 있으면 onSorting에서 그룹 내 순서 유지 정렬 적용 - const setRowData = (updater: React.SetStateAction[]>) => { - setRowDataMap(prev => { - const newMap = new Map(prev); - const currentData = newMap.get(tabKey) || []; - const newData = typeof updater === 'function' ? updater(currentData) : updater; - newMap.set(tabKey, newData); - return newMap; - }); - }; - - // 그리드 DOM 요소 찾기 (나중에 화살표 업데이트에 사용) - // 탭별로 그리드 요소를 찾기 위해 data-tab-key 사용 - const findGridElement = () => { - const tabContent = document.querySelector(`[data-tab-key="${tabKey}"]`); - return tabContent?.querySelector('.rg-grid, [data-grid-id]') as HTMLElement | null; - }; - - const onSortingHandler = createOnSortingHandler(columns, setRowData, sortDirRef, originalRowsRef, findGridElement); - (gridView as { onSorting?: (g: unknown, f: unknown[], d: unknown[]) => boolean }).onSorting = onSortingHandler; - }, 150); + + // 각 탭별 ref 초기화 + if (!sortDirRefs.current.has(tabKey)) { + sortDirRefs.current.set(tabKey, { current: {} }); + } + if (!originalRowsRefs.current.has(tabKey)) { + originalRowsRefs.current.set(tabKey, { current: {} }); + } + + const sortDirRef = sortDirRefs.current.get(tabKey)!; + const originalRowsRef = originalRowsRefs.current.get(tabKey)!; + + // mergeCells: true인 컬럼이 있으면 onSorting에서 클라이언트 정렬로 처리 + const hasMergeCells = columns.some((col) => col.mergeCells === true); + + // setDataComparer로 숫자 정렬 (mergeCells가 있으면 onSorting에서 클라이언트 정렬로 처리) + if (el.dataProvider) { + const dp = el.dataProvider as RealGridDataProviderComparer; + if (typeof dp.setDataComparer === "function" && typeof dp.getValue === "function") { + const numberComparer = createNumberComparer(dp); + const seen = new Set(); + columns.forEach((col) => { + if (hasMergeCells) return; // mergeCells가 있으면 모든 컬럼을 클라이언트 정렬로 처리 + if (col.valueType === ValueType.NUMBER && col.fieldName && !seen.has(col.fieldName)) { + seen.add(col.fieldName); + try { + dp.setDataComparer!(col.fieldName, numberComparer); + } catch (e) { + console.warn("setDataComparer:", e); + } + } + }); + } + } + + // mergeCells: true인 컬럼이 있으면 onSorting에서 그룹 내 순서 유지 정렬 적용 + const setRowData = (updater: React.SetStateAction[]>) => { + setRowDataMap(prev => { + const newMap = new Map(prev); + const currentData = newMap.get(tabKey) || []; + const newData = typeof updater === 'function' ? updater(currentData) : updater; + newMap.set(tabKey, newData); + return newMap; + }); + }; + + // 그리드 DOM 요소 찾기 (나중에 화살표 업데이트에 사용) + // 탭별로 그리드 요소를 찾기 위해 data-tab-key 사용 + const findGridElement = () => { + const tabContent = document.querySelector(`[data-tab-key="${tabKey}"]`); + return tabContent?.querySelector('.rg-grid, [data-grid-id]') as HTMLElement | null; + }; + + const onSortingHandler = createOnSortingHandler(columns, setRowData, sortDirRef, originalRowsRef, findGridElement); + (gridView as { onSorting?: (g: unknown, f: unknown[], d: unknown[]) => boolean }).onSorting = onSortingHandler; + }, 150); + } + } else { + gridRefs.current.delete(tabKey); } - } else { - gridRefs.current.delete(tabKey); - } - }} - autoGenerateField={true} - layout={columnLayout} - rows={currentRowData} - > - {columns.map((column) => ( - - ))} - + }} + autoGenerateField={true} + layout={columnLayout} + rows={currentRowData} + > + {columns.map((column) => ( + + ))} + ) : null}
diff --git a/apps/st/src/components/statistics/input/SewagePipeInp.tsx b/apps/st/src/components/statistics/input/SewagePipeInp.tsx index 4eac16126..20bed7f23 100644 --- a/apps/st/src/components/statistics/input/SewagePipeInp.tsx +++ b/apps/st/src/components/statistics/input/SewagePipeInp.tsx @@ -1,31 +1,87 @@ -import { useState } from "react"; +import { useState, useMemo } from "react"; import SearchForm from "@/components/module/SearchForm"; -import { TabDataGrid } from '@rsone/components'; +import TabDataGrid from "@/components/module/TabDataGrid"; 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 { RegionalFactStatusInpColumn } from "@/components/util/column/input/sewagePipe/RegionalFactStatusInpColumn"; -import { FactInstallStatusInpColumn } from "@/components/util/column/input/sewagePipe/FactInstallStatusInpColumn"; -import { PipeTypeStatusInpColumn } from "@/components/util/column/input/sewagePipe/PipeTypeStatusInpColumn"; -import { PipeDiameterStatusInpColumn } from "@/components/util/column/input/sewagePipe/PipeDiameterStatusInpColumn"; -import { ManholeStatusInpColumn } from "@/components/util/column/input/sewagePipe/ManholeStatusInpColumn"; -import { ConnectionStatusInpColumn } from "@/components/util/column/input/sewagePipe/ConnectionStatusInpColumn"; +import { SewagePipeInpColumnInfoList } from "@/components/util/column/input/sewagePipe/SewagePipeInpColumn"; +import type { ColumnInfoList, ColumnConfig } from "@/components/type/DataGrid.type"; +import type { SearchFormValues } from "@/components/type/SearchForm.type"; +import { useAlertStore } from "@/shared/lib"; +import { useAdminStore } from "@/store/admin-store"; -// 하수도 통계 관리 > 02. 하수관로 +// 하수도 통계 관리 > 02. 하수관로 const SewagePipeInp = () => { - - // tab List - const SewagePipeInpTapList = [ - RegionalFactStatusInpColumn, - FactInstallStatusInpColumn, - PipeTypeStatusInpColumn, - PipeDiameterStatusInpColumn, - ManholeStatusInpColumn, - ConnectionStatusInpColumn, - ]; + const [rowDataMap, setRowDataMap] = useState[]>>(new Map()); + const { setMessage: alert } = useAlertStore((state) => state); + const [isLoading, setIsLoading] = useState(false); + const [activeTab, setActiveTab] = useState(SewagePipeInpColumnInfoList[0]?.tabKey ?? "ST00020001"); + const [isEnterable, setIsEnterable] = useState(true); + const { isAdminInfo } = useAdminStore(); + + const columnInfo = useMemo(() => { + const canEdit = isEnterable || isAdminInfo; + return SewagePipeInpColumnInfoList.map((tab: ColumnInfoList) => { + const applyEditable = (cols: ColumnConfig[] | undefined) => + (cols ?? []).map((col: ColumnConfig) => + canEdit + ? col + : { ...col, editable: false as const, styleName: col.styleName ?? "rg-cell-readonly" } + ); + + if (tab.left && tab.right) { + return { + ...tab, + left: { ...tab.left, columns: applyEditable(tab.left.columns) }, + right: { ...tab.right, columns: applyEditable(tab.right.columns) }, + }; + } + return { + ...tab, + columns: applyEditable(tab.columns), + }; + }); + }, [isEnterable, isAdminInfo]); + + const handleSearch = async (values: SearchFormValues) => { + if (!values.sido || values.sido === 'ALL') { + alert('시도를 선택해주세요.'); + return; + } + + setActiveTab('ST00020001'); + + setRowDataMap(new Map()); + + try { + setIsLoading(true); + + // const searchParam: SewagePipeReviewRequestParams = { + // statsYr: values.year, + // sewerBzmnCd: values.bsnmCd, + // ctpvNm: values.sido, + // sggNm: values.gugun === 'ALL' ? '' : values.gugun + // }; + + // searchParamRef.current = searchParam; + // const response = await statisticsManagementApi.getSewagePipeReviewRegionalList(searchParam); + + // if (response?.status === 'success' && response.data) { + // const newRowDataMap = new Map[]>(); + // newRowDataMap.set('ST00020001', toGridRows(response.data as object[])); + // setRowDataMap(newRowDataMap); + // } else { + // alert(response?.message || "데이터가 없습니다."); + // } + } catch { + alert('데이터 조회 중 오류가 발생했습니다.'); + } finally { + setIsLoading(false); + } + }; const SubmitExceptionFunc = () => { console.log('submit exception'); @@ -47,7 +103,6 @@ const SewagePipeInp = () => { // 저장 로직 }; - const [rowDataMap, setRowDataMap] = useState[]>>(new Map()); return ( <> @@ -60,10 +115,12 @@ const SewagePipeInp = () => { - ); diff --git a/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx b/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx index cf6b184b4..6c660e77b 100644 --- a/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx +++ b/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx @@ -14,7 +14,13 @@ import SubmitDailog from "./SubmitDailog"; import { useAlertStore } from "@/shared/lib"; import { useAdminStore } from "@/store/admin-store"; -import { StatisticsInputSewSupplyRateApi } from "@/entities/statistics/api/statistics-input-sew-supply-rate-service"; +import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/statistics-input-sew-supply-rate-service"; +import { statisticsAPi } from "@/entities/statistics/api/statistics-service"; +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"; + import type { SearchFormValues } from "@/components/type/SearchForm.type"; import type { SewerageSupplyRateItem, @@ -24,14 +30,12 @@ import type { SewerageSupplyRateSaveRequest, SewerageSupplyRateStatusInfo, } from "@/entities/statistics/model/statistics-sewage-supply-rate-input-interface"; +import type { cancelSubmitRequest } from "@/entities/statistics/model/statistics-interface"; import type { StatisticsInputSubmitInfoFormData } from "@/entities/statistics/model/statistics-input-submit-info-schema"; 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"; import { doList } from "@/components/util/column/input/DoList"; + type GridRowWithVerification = Record & { verificationResult?: SewerageSupplyRateVerificationResult; }; @@ -60,11 +64,12 @@ const SeweragePenetrationRateInp = () => { const [lastSearchedValues, setLastSearchedValues] = useState(null); const [statusInfo, setStatusInfo] = useState(null); const [showDailog, setShowDailog] = useState(false); + const [statsCd, setStatsCd] = useState(''); + const [footerFromApi, setFooterFromApi] = useState<{ sewerBzmnWholPpltnCnt?: number; sewerBzmnDomplWholPpltnCnt?: number; sewerBzmnFrgnrWholPpltnCnt?: number; sewerBzmnArea?: number } | null>(null); const { confirm } = useConfirm(); const { isAdminInfo } = useAdminStore(); - const [footerFromApi, setFooterFromApi] = useState<{ sewerBzmnWholPpltnCnt?: number; sewerBzmnDomplWholPpltnCnt?: number; sewerBzmnFrgnrWholPpltnCnt?: number; sewerBzmnArea?: number } | null>(null); const getGridDataRef = useRef<(() => Record[]) | null>(null); const _footerFieldNames = ['sewerBzmnWholPpltnCnt', 'sewerBzmnDomplWholPpltnCnt', 'sewerBzmnFrgnrWholPpltnCnt', 'sewerBzmnArea'] as const; @@ -103,7 +108,7 @@ const SeweragePenetrationRateInp = () => { const fetchSewerageSupplyRate = async (params: SewerageSupplyRateRequestParams, isEnterable: boolean) => { try { setIsLoading(true); - const response = await StatisticsInputSewSupplyRateApi.getSewerageSupplyRateList(params); + const response = await statisticsInputSewSupplyRateApi.getSewerageSupplyRateList(params); if (response.status === 'success' && response.data) { const commonInfo = response.data.commonInfo; const statusInfo = response.data.statusInfo; @@ -121,7 +126,7 @@ const SeweragePenetrationRateInp = () => { }) ); - setStatusInfo(response.data.statusInfo); + setStatusInfo(statusInfo); setFooterFromApi( commonInfo ? { @@ -132,7 +137,7 @@ const SeweragePenetrationRateInp = () => { } : null ); - + setStatsCd(commonInfo.statsCd); if (statusInfo && statusInfo.laeSbmsnSttsCd) { if (['2', '3'].includes(statusInfo.laeSbmsnSttsCd)) { setIsEnterable(false); @@ -163,7 +168,7 @@ const SeweragePenetrationRateInp = () => { } try { - const response = await StatisticsInputSewSupplyRateApi.checkInputPeriod(values.year || ''); + const response = await statisticsInputSewSupplyRateApi.checkInputPeriod(values.year || ''); if (response.status === 'success') { const checkEnterable = response.data; @@ -266,6 +271,7 @@ const SeweragePenetrationRateInp = () => { const requestData: SewerageSupplyRateSaveRequest = { sewerBzmnCd: searchValues?.bsnmCd ?? '', ctpvNm: searchValues?.sido ?? '', + sggNm: searchValues?.gugun ?? '', statsYr: searchValues?.year ?? '', userId: userInfo.userUnqId, submitList: convertedData, @@ -280,7 +286,7 @@ const SeweragePenetrationRateInp = () => { laeIdfrTelNo: submitInfo.laeIdfrTelNo, }; - const response = await StatisticsInputSewSupplyRateApi.submitSewerageSupplyRate(requestData); + const response = await statisticsInputSewSupplyRateApi.submitSewerageSupplyRate(requestData); if (response.status === 'success') { await fetchSewerageSupplyRate(getSewerageSupplyRateParams(searchValues ?? {}), false); alert('제출되었습니다.'); @@ -368,6 +374,7 @@ const SeweragePenetrationRateInp = () => { const requestData: SewerageSupplyRateSaveRequest = { sewerBzmnCd: searchValues?.bsnmCd ?? '', // 하수도 사업자 코드 ctpvNm: searchValues?.sido ?? '', // 시도 + sggNm: searchValues?.gugun ?? '', statsYr: searchValues?.year ?? '', // 통계 연도 userId: userInfo.userUnqId, // 사용자 saveList: convertedData, // 저장 데이터 @@ -378,7 +385,7 @@ const SeweragePenetrationRateInp = () => { requestData.superAdmin = 'superAdmin'; } - const response = await StatisticsInputSewSupplyRateApi.saveSewerageSupplyRate(requestData); + const response = await statisticsInputSewSupplyRateApi.saveSewerageSupplyRate(requestData); if (response.status === 'success') { fetchSewerageSupplyRate(getSewerageSupplyRateParams(searchValues ?? {}), true); @@ -395,7 +402,36 @@ const SeweragePenetrationRateInp = () => { setIsLoading(false); } }; - console.log(footerFromApi); + + const cnacelSubmitFunc = async () => { + try { + if (await confirm('제출된 내용을 취소하시겠습니까?')) { + + const userInfo = await getUserInfo(); + + const requestData: cancelSubmitRequest = { + sewerBzmnCd: searchValues?.bsnmCd ?? '', + ctpvNm: searchValues?.sido ?? '', + sggNm: searchValues?.gugun ?? '', + statsYr: searchValues?.year ?? '', + userId: userInfo.userUnqId, + statsCd: statsCd, + }; + + const response = await statisticsAPi.cancelSubmit(requestData); + + if (response.status === 'success') { + fetchSewerageSupplyRate(getSewerageSupplyRateParams(searchValues ?? {}), true); + alert('제출 취소되었습니다.'); + } else { + alert(response.message ?? '제출 취소 중 오류가 발생했습니다.'); + } + } + } catch { + alert('제출 취소 중 오류가 발생했습니다.'); + } + }; + return ( <>
@@ -411,7 +447,7 @@ const SeweragePenetrationRateInp = () => { )} - {statusInfo?.laeSbmsnSttsCd === '2' && console.log('test')} />} + {statusInfo?.laeSbmsnSttsCd === '2' && } {(isEnterable && (doList.includes(lastSearchedValues?.bsnmCd || '') ? Boolean(lastSearchedValues?.gugun && lastSearchedValues.gugun !== 'ALL') : true) || isAdminInfo) && }
diff --git a/apps/st/src/components/statistics/input/StatsInputStatusInp.tsx b/apps/st/src/components/statistics/input/StatsInputStatusInp.tsx index e6e87c207..4390777b9 100644 --- a/apps/st/src/components/statistics/input/StatsInputStatusInp.tsx +++ b/apps/st/src/components/statistics/input/StatsInputStatusInp.tsx @@ -1,7 +1,8 @@ -import { useState } from "react"; +import { useState, useEffect } from "react"; +import useSWR, { useSWRConfig } from "swr"; import SearchForm from "@/components/module/SearchForm"; -// import { DataGrid } from "@rsone/components"; +import { useTabStore } from "@/store/tab-store"; import DataGrid from "@/components/module/DataGrid"; import ApproveButton from "@/components/button/ApproveButton"; import RejectButton from "@/components/button/RejectButton"; @@ -13,45 +14,63 @@ import type { StatsInputStatusListRequestParams } from "@/entities/statistics/mo import type { SearchFormValues } from "@/components/type/SearchForm.type"; import { useAlertStore } from "@/shared/lib"; import { toGridRows } from "@/components/util/grid/gridFunction"; +import type { StatsInputStatusListApiResponse } from "@/entities/statistics/model/statistics-input-status-interface"; + +const getStatsInputStatusFetcher = async (key: [string, StatsInputStatusListRequestParams]): Promise => { + return StatisticsInputStatusApi.getStatisticsInputStatusList(key[1]); +}; // 하수도 통계 관리 > 00. 통계 입력 현황 const StatsInputStatusInp = () => { const { setMessage: alert } = useAlertStore((state) => state); + const activeTabId = useTabStore((state) => state.activeTabId); const [rowData, setRowData] = useState[]>([]); - const [isLoading, setIsLoading] = useState(false); + const [searchParams, setSearchParams] = useState(null); - const handleSearch = async (values: SearchFormValues) => { - if (values.sido === '' || values.sido === 'ALL') { - alert('시도를 선택해주세요.'); + const swrKey = searchParams ? (["stats-input-status", searchParams] as const) : null; + const { mutate } = useSWRConfig(); + const { isLoading } = useSWR( + swrKey, + getStatsInputStatusFetcher, + { + revalidateOnFocus: true, + onSuccess: (data) => { + if (data.status === "success" && data.data) { + setRowData(toGridRows(data.data)); + } else { + alert(data.message ?? "조회에 실패했습니다."); + } + }, + onError: () => { + alert("데이터 조회 중 오류가 발생했습니다."); + setRowData([]); + }, + }, + ); + + useEffect(() => { + if (activeTabId === 'StatsInputStatusInp' && swrKey) { + mutate(swrKey); + } + }, [activeTabId]); + + const handleSearch = (values: SearchFormValues) => { + if (values.sido === "" || values.sido === "ALL") { + alert("시도를 선택해주세요."); return; } - - const searchParam: StatsInputStatusListRequestParams = { + const params: StatsInputStatusListRequestParams = { ctpvNm: values.sido, sewerBzmnCd: values.bsnmCd, - sggNm: values.gugun === 'ALL' ? '' : values.gugun, + sggNm: values.gugun === "ALL" ? "" : values.gugun, statsYr: values.year, }; - - try { - setIsLoading(true); - - const response = await StatisticsInputStatusApi.getStatisticsInputStatusList(searchParam); - console.log(response) - if (response.status === 'success' && response.data) { - setRowData(toGridRows(response.data)); - } else { - alert(response.message); - } - } catch { - alert('데이터 조회 중 오류가 발생했습니다.'); - setRowData([]); - } finally { - setIsLoading(false); - } + setSearchParams(params); + mutate(["stats-input-status", params]); }; const handleReset = () => { + setSearchParams(null); setRowData([]); }; diff --git a/apps/st/src/components/statistics/input/SubmitDailog.tsx b/apps/st/src/components/statistics/input/SubmitDailog.tsx index b286117b7..7b67d4cb7 100644 --- a/apps/st/src/components/statistics/input/SubmitDailog.tsx +++ b/apps/st/src/components/statistics/input/SubmitDailog.tsx @@ -155,7 +155,7 @@ const SubmitDailog = ({ open, onOpenChange, statusInfo, onConfirm }: SubmitDialo 취소 diff --git a/apps/st/src/components/statistics/verification/GeneralVerificationManagement.tsx b/apps/st/src/components/statistics/verification/GeneralVerificationManagement.tsx index 0bd348123..16947f896 100644 --- a/apps/st/src/components/statistics/verification/GeneralVerificationManagement.tsx +++ b/apps/st/src/components/statistics/verification/GeneralVerificationManagement.tsx @@ -1,79 +1,141 @@ "use client"; -import { useState } from 'react'; +import { useMemo, useState } from 'react'; import { CodeSelect } from '@/entities/code'; import { Button, Label, - Table, - TableBody, - TableCell, - TableHead, - TableRow, + // Table, + // TableBody, + // TableCell, + // TableHead, + // TableRow, + DataTable, } from "@common/components"; +import { getCoreRowModel, useReactTable } from "@tanstack/react-table"; +// import { useDataTable } from "@/shared/lib"; +import { GeneralVerificationColumn } from '@/components/util/column/management/GeneralVerificationColumn'; +import type { GeneralverificationList } from '@/entities/statistics/model/general-verification-interface'; + const GeneralVerificationManagement = () => { const [statsCd, setStatsCd] = useState(''); + // const [rowSelection, setRowSelection] = useState({}); + // const [pagination, setPagination] = useState({ + // pageIndex: 0, + // pageSize: 100, + // }); + + // const { tableComponent } = useDataTable({ + // tableOptions: { + // GeneralVerificationColumn, + // state: { + // pagination, + // rowSelection, + // }, + // manualPagination: true, + // enableMultiRowSelection: true, + // getCoreRowModel: getCoreRowModel(), + // onPaginationChange: setPagination, + // onRowSelectionChange: setRowSelection, + // }, + // // dataTableOptions: { + // // onRowClick: handleRowClick, + // // viewPagination: true, + // // }, + // }); + + const mockData = useMemo( + () => [ + { + vrfSn: 1, + tabNm: '하수도보급률', + vrfNm: '인구수 검증', + vrfClsCd: '시', + statsCd: 'ST000001', + useYn: 'Y', + rgtrId: '관리자', + regDt: '20260102', + }, + { + vrfSn: 2, + tabNm: '하수도보급률', + vrfNm: '인구수 검증', + vrfClsCd: '시', + statsCd: 'ST000001', + useYn: 'Y', + rgtrId: '관리자', + regDt: '20260102', + }, + { + vrfSn: 3, + tabNm: '하수도보급률', + vrfNm: '인구수 검증', + vrfClsCd: '시', + statsCd: 'ST000001', + useYn: 'Y', + rgtrId: '관리자', + regDt: '20260102', + }, + { + vrfSn: 4, + tabNm: '하수도보급률', + vrfNm: '인구수 검증', + vrfClsCd: '시', + statsCd: 'ST000001', + useYn: 'Y', + rgtrId: '관리자', + regDt: '20260102', + }, + ], + [] + ); + + const table = useReactTable({ + data: mockData, + columns: GeneralVerificationColumn, + getCoreRowModel: getCoreRowModel(), + }); + + const handleSearch = () => { + console.log(statsCd); + }; return ( -
+
-
-
-
- - -
-
- - -
+
+
+ +
- +
+ + +
+
-
+
- - - No - 검증항목 - 등록자 - 등록일 - 사용여부 - - - - - 1 - - - 인구수검증 - - - 관리자 - - - 2026-02-09 - - - Y - - - -
+
+

일반 검증 목록

+
+
+ +
diff --git a/apps/st/src/components/type/DataGrid.type.ts b/apps/st/src/components/type/DataGrid.type.ts index d9bf1997c..1423c7940 100644 --- a/apps/st/src/components/type/DataGrid.type.ts +++ b/apps/st/src/components/type/DataGrid.type.ts @@ -262,6 +262,10 @@ export type TabDataGridProps = { activeTab?: string; /** 활성 탭 변경 시 호출 (제어 모드). activeTab과 함께 넘기면 부모가 탭 상태를 가짐 */ onActiveTabChange?: (tabKey: string) => void; + /** 저장 등 시점에 현재 활성 탭 그리드 데이터를 가져올 수 있도록 할당 (편집 반영된 값) */ + getGridDataRef?: { + current: (() => Record[]) | null; + }; }; export type SplitDataGridProps = { diff --git a/apps/st/src/components/util/column/input/sewagePipe/RegionalFactStatusInpColumn.ts b/apps/st/src/components/util/column/input/sewagePipe/RegionalFactStatusInpColumn.ts index a02919150..50c16fe40 100644 --- a/apps/st/src/components/util/column/input/sewagePipe/RegionalFactStatusInpColumn.ts +++ b/apps/st/src/components/util/column/input/sewagePipe/RegionalFactStatusInpColumn.ts @@ -6,92 +6,97 @@ import { ValueType } from "realgrid"; export const RegionalFactStatusInpColumn = { columns: [ // 행정구역 - { name: 'sido', fieldName: '시도', header: { text: '시도' }, editable: false }, - { name: 'sgg', fieldName: '시군구', header: { text: '시군구' }, footer: { text: '합계' }, editable: false }, + { name: 'ctpvNm', fieldName: 'ctpvNm', header: { text: '시도' }, footer: { text: '합계' }, editable: false, styleName: 'rg-cell-readonly' }, + { name: 'sggNm', fieldName: 'sggNm', header: { text: '시군구' }, editable: false, styleName: 'rg-cell-readonly' }, + { name: 'admdstNm', fieldName: 'admdstNm', header: { text: '행정구역명' }, editable: false, styleName: 'rg-cell-readonly' }, // 기본 정보 - { name: 'targetYr', fieldName: '하수정비기본계획목표년도', header: { text: '하수정비기본계획목표년도' }}, - { name: 'piplImprnPlanExtn', fieldName: '총관로정비계획연장(m)', header: { text: '총관로정비계획연장(m)' }, footer: footerDecimal2, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'piplPlanExtn', fieldName: '총계획연장(m)', header: { text: '총계획연장(m)' }, footer: footerDecimal2, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'piplFcltyExtn', fieldName: '총시설연장(m)', header: { text: '총시설연장(m)' }, footer: footerDecimal2, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'piplSupprt', fieldName: '하수관로보급률(%)', header: { text: '하수관로보급률(%)' }, footer: footerDecimal1, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' }, + { name: 'goalYr', fieldName: 'goalYr', header: { text: '하수정비기본계획목표년도' }}, + { name: 'wholPplMtncPlanPrlg', fieldName: 'wholPplMtncPlanPrlg', header: { text: '총관로정비계획연장(m)' }, footer: footerDecimal2, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'wholPlanPrlg', fieldName: 'wholPlanPrlg', header: { text: '총계획연장(m)' }, footer: footerDecimal2, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'wholFcltPrlg', fieldName: 'wholFcltPrlg', header: { text: '총시설연장(m)' }, footer: footerDecimal2, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'swagePplPsplyRt', fieldName: 'swagePplPsplyRt', header: { text: '하수관로보급률(%)' }, footer: footerDecimal1, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.0' }, // 합류식(m) - { name: 'cmbnPlanAr', fieldName: '관로정비계획면적(㎢)', header: { text: '관로정비계획면적(㎢)' }, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' }, - { name: 'cmbnImprnPlanExtn', fieldName: '관로정비계획연장(m)', header: { text: '관로정비계획연장(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'cmbnPlanExtn', fieldName: '계획연장(m)', header: { text: '계획연장(m)' }, footer: footerDecimal2, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'cmbnFcltyExtn', fieldName: '시설연장(m)', header: { text: '시설연장(m)' }, footer: footerDecimal2, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'cmbnRctglExtn', fieldName: '사각형(m)', header: { text: '사각형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'cmbnCicleExtn', fieldName: '원형(m)', header: { text: '원형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'cmbnOpswrExtn', fieldName: '개거(m)', header: { text: '개거(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'cmbnSdgttrExtn', fieldName: '측구(m)', header: { text: '측구(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'cbsysPplMtncPlanArea', fieldName: 'cbsysPplMtncPlanArea', header: { text: '관로정비계획면적(㎢)' }, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' }, + { name: 'cbsysPplMtncPlanPrlg', fieldName: 'cbsysPplMtncPlanPrlg', header: { text: '관로정비계획연장(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'cbsysPlanPrlg', fieldName: 'cbsysPlanPrlg', header: { text: '계획연장(m)' }, footer: footerDecimal2, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'cbsysFcltPrlg', fieldName: 'cbsysFcltPrlg', header: { text: '시설연장(m)' }, footer: footerDecimal2, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'cbsysSqrePrlg', fieldName: 'cbsysSqrePrlg', header: { text: '사각형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'cbsysCiclPrlg', fieldName: 'cbsysCiclPrlg', header: { text: '원형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'cbsysOpnPrlg', fieldName: 'cbsysOpnPrlg', header: { text: '개거(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'cbsysGttrPrlg', fieldName: 'cbsysGttrPrlg', header: { text: '측구(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, // 분류식(m) > 오수관로 - { name: 'pltwtrPlanAr', fieldName: '관로정비계획면적(㎢)', header: { text: '관로정비계획면적(㎢)' }, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' }, - { name: 'pltwtrImprnPlanExtn', fieldName: '관로정비계획연장(m)', header: { text: '관로정비계획연장(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'pltwtrPlanExtn', fieldName: '계획연장(m)', header: { text: '계획연장(m)' }, footer: footerDecimal2, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'pltwtrFlctyExtn', fieldName: '시설연장(m)', header: { text: '시설연장(m)' }, footer: footerDecimal2, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'pltwtrSqreExtn', fieldName: '사각형(m)', header: { text: '사각형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'pltwtrCiclExtn', fieldName: '원형(m)', header: { text: '원형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'drtwPplMtncPlanArea', fieldName: 'drtwPplMtncPlanArea', header: { text: '관로정비계획면적(㎢)' }, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' }, + { name: 'drtwPplMtncPlanPrlg', fieldName: 'drtwPplMtncPlanPrlg', header: { text: '관로정비계획연장(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'drtwPplPlanPrlg', fieldName: 'drtwPplPlanPrlg', header: { text: '계획연장(m)' }, footer: footerDecimal2, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'drtwPplFcltPrlg', fieldName: 'drtwPplFcltPrlg', header: { text: '시설연장(m)' }, footer: footerDecimal2, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'drtwPplSqrePrlg', fieldName: 'drtwPplSqrePrlg', header: { text: '사각형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'drtwPplCiclPrlg', fieldName: 'drtwPplCiclPrlg', header: { text: '원형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, // 분류식(m) > 우수관로 - { name: 'rainwtrPlanAr', fieldName: '관로정비계획면적(㎢)', header: { text: '관로정비계획면적(㎢)' }, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' }, - { name: 'rainwtrImprnPlanExtn', fieldName: '관로정비계획연장(m)', header: { text: '관로정비계획연장(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'rainwtrPlanExtn', fieldName: '계획연장(m)', header: { text: '계획연장(m)' }, footer: footerDecimal2, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'rainwtrFlctyExtn', fieldName: '시설연장(m)', header: { text: '시설연장(m)' }, footer: footerDecimal2, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'rainwtrSqreExtn', fieldName: '사각형(m)', header: { text: '사각형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'rainwtrCiclExtn', fieldName: '원형(m)', header: { text: '원형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'rainwtrOpswrExtn', fieldName: '개거(m)', header: { text: '개거(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, - { name: 'rainwtrSdgttrExtn', fieldName: '측구(m)', header: { text: '측구(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'exlnPplMtncPlanArea', fieldName: 'exlnPplMtncPlanArea', header: { text: '관로정비계획면적(㎢)' }, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' }, + { name: 'exlnPplMtncPlanPrlg', fieldName: 'exlnPplMtncPlanPrlg', header: { text: '관로정비계획연장(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'exlnPplPlanPrlg', fieldName: 'exlnPplPlanPrlg', header: { text: '계획연장(m)' }, footer: footerDecimal2, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'exlnPplFcltPrlg', fieldName: 'exlnPplFcltPrlg', header: { text: '시설연장(m)' }, footer: footerDecimal2, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'exlnPplSqrePrlg', fieldName: 'exlnPplSqrePrlg', header: { text: '사각형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'exlnPplCiclPrlg', fieldName: 'exlnPplCiclPrlg', header: { text: '원형(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'exlnPplOpnPrlg', fieldName: 'exlnPplOpnPrlg', header: { text: '개거(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, + { name: 'exlnPplGttrPrlg', fieldName: 'exlnPplGttrPrlg', header: { text: '측구(m)' }, footer: footerDecimal2, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' }, // 합류식맨홀(개소) - { name: 'mnhleSite', fieldName: '합류식맨홀(개소)', header: { text: '합류식맨홀(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, + { name: 'cbsysMnhlCnt', fieldName: 'cbsysMnhlCnt', header: { text: '합류식맨홀(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, // 분류식 > 오수맨홀, 우수맨홀 - { name: 'pltwtrMnhleSite', fieldName: '오수맨홀(개소)', header: { text: '오수맨홀(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, - { name: 'rainwtrMnhleSite', fieldName: '우수맨홀(개소)', header: { text: '우수맨홀(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, + { name: 'sprsysDrtwMnhlCnt', fieldName: 'sprsysDrtwMnhlCnt', header: { text: '오수맨홀(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, + { name: 'sprsysExlnMnhlCnt', fieldName: 'sprsysExlnMnhlCnt', header: { text: '우수맨홀(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, - { name: 'pltwtrRcvrSite', fieldName: '오수받이(개소)', header: { text: '오수받이(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, - { name: 'rainwtrRcvrSite', fieldName: '빗물받이(개소)', header: { text: '빗물받이(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, - { name: 'soilspllSite', fieldName: '우수토실(개소)', header: { text: '우수토실(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, - { name: 'soilholeSite', fieldName: '우수토구(개소)', header: { text: '우수토구(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, + { name: 'drtwRcvprpCnt', fieldName: 'drtwRcvprpCnt', header: { text: '오수받이(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, + { name: 'exlnRcvprpCnt', fieldName: 'exlnRcvprpCnt', header: { text: '빗물받이(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, + { name: 'stofcbrCnt', fieldName: 'stofcbrCnt', header: { text: '우수토실(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, + { name: 'exlnOtflCnt', fieldName: 'exlnOtflCnt', header: { text: '우수토구(개소)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, // 하수도대장 전산화 - { name: 'sewerRegstrCmptExtn', fieldName: '하수도대장전산화연장(m)', header: { text: '하수도대장전산화연장(m)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, - { name: 'sewerRegstrCmptRt', fieldName: '하수도대장전산화율(%)', header: { text: '하수도대장전산화율(%)' }, footer: footerDecimal1, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' }, + { name: 'sewerLdgrEdpPrlg', fieldName: 'sewerLdgrEdpPrlg', header: { text: '하수도대장전산화연장(m)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, + { name: 'sewerLdgrEdpRt', fieldName: 'sewerLdgrEdpRt', header: { text: '하수도대장전산화율(%)' }, footer: footerDecimal1, editable: false, styleName: 'rg-cell-readonly', valueType: ValueType.NUMBER, dataFormat: '#,##0.0' }, // 비고 - { name: 'rmk', fieldName: '비고', header: { text: '비고' } }, + { name: 'rmrk', fieldName: 'rmrk', header: { text: '비고' } }, ], columnLayout: [ { name: 'adminArea', hideChildHeaders: false, header: { text: '행정구역' }, - items: ['sido', 'sgg'], + items: [ + { column: 'ctpvNm', footerUserSpans: [{ colspan: 3 }] }, + 'sggNm', + 'admdstNm', + ], }, - 'targetYr', - 'piplImprnPlanExtn', - 'piplPlanExtn', - 'piplFcltyExtn', - 'piplSupprt', + 'goalYr', + 'wholPplMtncPlanPrlg', + 'wholPlanPrlg', + 'wholFcltPrlg', + 'swagePplPsplyRt', { name: 'combined', hideChildHeaders: false, header: { text: '합류식(m)' }, items: [ - 'cmbnPlanAr', - 'cmbnImprnPlanExtn', - 'cmbnPlanExtn', - 'cmbnFcltyExtn', + 'cbsysPplMtncPlanArea', + 'cbsysPplMtncPlanPrlg', + 'cbsysPlanPrlg', + 'cbsysFcltPrlg', { name: 'cmbnCulvert', hideChildHeaders: false, header: { text: '암거' }, - items: ['cmbnRctglExtn', 'cmbnCicleExtn'], + items: ['cbsysSqrePrlg', 'cbsysCiclPrlg'], }, - 'cmbnOpswrExtn', - 'cmbnSdgttrExtn', + 'cbsysOpnPrlg', + 'cbsysGttrPrlg', ], }, { @@ -104,15 +109,15 @@ export const RegionalFactStatusInpColumn = { hideChildHeaders: false, header: { text: '오수관로' }, items: [ - 'pltwtrPlanAr', - 'pltwtrImprnPlanExtn', - 'pltwtrPlanExtn', - 'pltwtrFlctyExtn', + 'drtwPplMtncPlanArea', + 'drtwPplMtncPlanPrlg', + 'drtwPplPlanPrlg', + 'drtwPplFcltPrlg', { name: 'pltwtrCulvert', hideChildHeaders: false, header: { text: '암거' }, - items: ['pltwtrSqreExtn', 'pltwtrCiclExtn'], + items: ['drtwPplSqrePrlg', 'drtwPplCiclPrlg'], }, ], }, @@ -121,39 +126,39 @@ export const RegionalFactStatusInpColumn = { hideChildHeaders: false, header: { text: '우수관로' }, items: [ - 'rainwtrPlanAr', - 'rainwtrImprnPlanExtn', - 'rainwtrPlanExtn', - 'rainwtrFlctyExtn', + 'exlnPplMtncPlanArea', + 'exlnPplMtncPlanPrlg', + 'exlnPplPlanPrlg', + 'exlnPplFcltPrlg', { name: 'rainwtrCulvert', hideChildHeaders: false, header: { text: '암거' }, - items: ['rainwtrSqreExtn', 'rainwtrCiclExtn'], + items: ['exlnPplSqrePrlg', 'exlnPplCiclPrlg'], }, - 'rainwtrOpswrExtn', - 'rainwtrSdgttrExtn', + 'exlnPplOpnPrlg', + 'exlnPplGttrPrlg', ], }, ], }, - 'mnhleSite', + 'cbsysMnhlCnt', { name: 'separatedManhole', hideChildHeaders: false, header: { text: '분류식' }, - items: ['pltwtrMnhleSite', 'rainwtrMnhleSite'], + items: ['sprsysDrtwMnhlCnt', 'sprsysExlnMnhlCnt'], }, - 'pltwtrRcvrSite', - 'rainwtrRcvrSite', - 'soilspllSite', - 'soilholeSite', - 'sewerRegstrCmptExtn', - 'sewerRegstrCmptRt', - 'rmk', + 'drtwRcvprpCnt', + 'exlnRcvprpCnt', + 'stofcbrCnt', + 'exlnOtflCnt', + 'sewerLdgrEdpPrlg', + 'sewerLdgrEdpRt', + 'rmrk', ], rowStartNum: 4, fixedColumns: 1, - tabKey: 'regionalFactStatusInp', + tabKey: 'ST00020001', tabLabel: '지역별 시설현황' }; \ No newline at end of file diff --git a/apps/st/src/components/util/column/input/sewagePipe/SewagePipeInpColumn.ts b/apps/st/src/components/util/column/input/sewagePipe/SewagePipeInpColumn.ts new file mode 100644 index 000000000..9030d4700 --- /dev/null +++ b/apps/st/src/components/util/column/input/sewagePipe/SewagePipeInpColumn.ts @@ -0,0 +1,17 @@ +import type { ColumnInfoList } from "@/components/type/DataGrid.type"; +import { RegionalFactStatusInpColumn } from "./RegionalFactStatusInpColumn"; +import { FactInstallStatusInpColumn } from "./FactInstallStatusInpColumn"; +import { PipeTypeStatusInpColumn } from "./PipeTypeStatusInpColumn"; +import { PipeDiameterStatusInpColumn } from "./PipeDiameterStatusInpColumn"; +import { ManholeStatusInpColumn } from "./ManholeStatusInpColumn"; +import { ConnectionStatusInpColumn } from "./ConnectionStatusInpColumn"; + +/** 하수관로 입력 탭 컬럼 리스트 (TabDataGrid columnInfo용) */ +export const SewagePipeInpColumnInfoList: ColumnInfoList[] = [ + RegionalFactStatusInpColumn, + FactInstallStatusInpColumn, + PipeTypeStatusInpColumn, + PipeDiameterStatusInpColumn, + ManholeStatusInpColumn, + ConnectionStatusInpColumn, +]; diff --git a/apps/st/src/components/util/column/management/GeneralVerificationColumn.tsx b/apps/st/src/components/util/column/management/GeneralVerificationColumn.tsx new file mode 100644 index 000000000..b61ad9ea3 --- /dev/null +++ b/apps/st/src/components/util/column/management/GeneralVerificationColumn.tsx @@ -0,0 +1,62 @@ +import dayjs from "dayjs"; +import { useState } from "react"; +import type { ColumnDef } from "@tanstack/react-table"; +import { Button } from "@common/components"; +import type { GeneralverificationList } from "@/entities/statistics/model/general-verification-interface"; + +export const GeneralVerificationColumn: ColumnDef[] = [ + { + id: "no", + header: "NO", + cell: ({ row, table }) => { + const totalRows = table.getRowCount(); + const { pageIndex, pageSize } = table.getState().pagination; + return totalRows - (pageIndex * pageSize + row.index); + }, + }, + { + accessorKey: "vrfSn", + header: "일련번호", + enableHiding: true, + }, + { + accessorKey: "tabNm", + header: "통계항목", + }, + { + accessorKey: "vrfNm", + header: "검증명", + }, + { + accessorKey: "vrfClsCd", + header: "검증분류", + }, + { + accessorKey: "useYn", + header: "사용여부", + }, + { + accessorKey: "regDt", + header: "등록일", + cell: ({ row }) => { + const date = dayjs(row.original.regDt); + return date.format("YYYY-MM-DD"); + }, + }, + { + id: "actions", + header: "관리", + cell: ({ row }) => ( +
e.stopPropagation()}> + +
+ ), + }, +]; + +const GeneralVerificationManageButton = ({ vrfSn }: { vrfSn: number }) => { + const [dialogOpen, setDialogOpen] = useState(false); + return ( + + ); +}; diff --git a/apps/st/src/entities/statistics/api/statistics-input-sew-supply-rate-service.ts b/apps/st/src/entities/statistics/api/statistics-input-sew-supply-rate-service.ts index ba6d10874..7e4e23370 100644 --- a/apps/st/src/entities/statistics/api/statistics-input-sew-supply-rate-service.ts +++ b/apps/st/src/entities/statistics/api/statistics-input-sew-supply-rate-service.ts @@ -21,7 +21,7 @@ export class StatisticsInputSewSupplyRateApiService implements StatisticsInputSe public async checkInputPeriod(params: string): Promise { const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.INPUTCOMMON}/check-input-period?year=${params}`, + `${ENDPOINT.ST_SERVICE.INPUTCOMMON}/check-input-period?statsYr=${params}`, ); return response.data; } @@ -43,4 +43,4 @@ export class StatisticsInputSewSupplyRateApiService implements StatisticsInputSe } } -export const StatisticsInputSewSupplyRateApi = new StatisticsInputSewSupplyRateApiService(); \ No newline at end of file +export const statisticsInputSewSupplyRateApi = new StatisticsInputSewSupplyRateApiService(); \ No newline at end of file diff --git a/apps/st/src/entities/statistics/api/statistics-service.ts b/apps/st/src/entities/statistics/api/statistics-service.ts index f75163e5c..82ed85b83 100644 --- a/apps/st/src/entities/statistics/api/statistics-service.ts +++ b/apps/st/src/entities/statistics/api/statistics-service.ts @@ -6,6 +6,8 @@ import { type SearchCondition, type ApiResponse, type Sgg, + type cancelSubmitRequest, + type cancelSubmitResponse, } from "../model/statistics-interface"; export class StatisticsAPiService implements StatisticsService { @@ -23,6 +25,15 @@ export class StatisticsAPiService implements StatisticsService { ); return response.data; } + + // 입력 - 제출 취소 + public async cancelSubmit(param: cancelSubmitRequest): Promise { + const response = await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUTCOMMON}/cancel-submit`, + param + ); + return response.data; + } } export const statisticsAPi = new StatisticsAPiService(); \ No newline at end of file diff --git a/apps/st/src/entities/statistics/model/general-verification-interface.ts b/apps/st/src/entities/statistics/model/general-verification-interface.ts new file mode 100644 index 000000000..c22504827 --- /dev/null +++ b/apps/st/src/entities/statistics/model/general-verification-interface.ts @@ -0,0 +1,12 @@ +export interface GeneralverificationList { + vrfSn: number; + tabNm: string; + vrfNm: string; + vrfClsCd: string; + statsCd: string; + useYn: string; + rgtrId?: string; + regDt?: string; + mdfrId?: string; + mdfcnDt?: string; +} \ No newline at end of file diff --git a/apps/st/src/entities/statistics/model/statistics-interface.ts b/apps/st/src/entities/statistics/model/statistics-interface.ts index b909eba92..edf5d264c 100644 --- a/apps/st/src/entities/statistics/model/statistics-interface.ts +++ b/apps/st/src/entities/statistics/model/statistics-interface.ts @@ -15,6 +15,20 @@ export interface Sgg { bsnmCd: string; } +export interface cancelSubmitRequest { + statsYr: string; + ctpvNm: string; + sggNm: string; + sewerBzmnCd: string; + statsCd: string; + userId: string; +} + +export interface cancelSubmitResponse { + status: string; + message?: string; +} + export interface ApiResponse { status: string; data: T; @@ -24,4 +38,5 @@ export interface ApiResponse { export interface StatisticsService { getSidoList(): Promise>; getSggList(sidoName: string): Promise>; + cancelSubmit(param: cancelSubmitRequest): Promise; } \ No newline at end of file diff --git a/apps/st/src/entities/statistics/model/statistics-sewage-supply-rate-input-interface.ts b/apps/st/src/entities/statistics/model/statistics-sewage-supply-rate-input-interface.ts index 5c1a1f6ef..b3f97fbb1 100644 --- a/apps/st/src/entities/statistics/model/statistics-sewage-supply-rate-input-interface.ts +++ b/apps/st/src/entities/statistics/model/statistics-sewage-supply-rate-input-interface.ts @@ -29,6 +29,7 @@ export interface SewerageSupplyRateCommonInfo { swagePplPsplyRt: number; ctpvNm: string; statsYr: string; + statsCd: string; } /** 검증 결과 한 건 (필드별 메시지) */ @@ -132,6 +133,7 @@ export interface SewerageSupplyRateSaveItem { export interface SewerageSupplyRateSaveRequest { statsYr: string; ctpvNm: string; + sggNm: string; sewerBzmnCd: string; userId: string; sewerBzmnFrgnrWholPpltnCnt?: number; diff --git a/apps/st/src/shared/ui/statistics-page-layout.tsx b/apps/st/src/shared/ui/statistics-page-layout.tsx index b34ebb5eb..d7d5b98b4 100644 --- a/apps/st/src/shared/ui/statistics-page-layout.tsx +++ b/apps/st/src/shared/ui/statistics-page-layout.tsx @@ -5,7 +5,7 @@ import { TabBar } from "./tab-bar"; function StatisticsPageLayout({ children }: { children: React.ReactNode }) { const { activeTabId, tabs } = useTabStore(); - const pageTitle = tabs.find((t) => t.menuItem.menuEngNm === activeTabId); + const pageTitle = tabs.find((t) => t.menuItem.urlPath === activeTabId); const menuPaths = pageTitle?.path?.split(">").map((path) => path.trim()); diff --git a/apps/st/src/store/tab-store.ts b/apps/st/src/store/tab-store.ts index 6c48a5074..ace855808 100644 --- a/apps/st/src/store/tab-store.ts +++ b/apps/st/src/store/tab-store.ts @@ -28,7 +28,7 @@ const useTabStoreHook = create((set, get) => ({ menuList: null, addTab: (menuItem: MenuItem) => { const { tabs, menuList } = get(); - const tabId = menuItem.menuEngNm || ''; + const tabId = menuItem.urlPath || ''; // 이미 존재하는 탭인지 확인 const existingTab = tabs.find((tab) => tab.id === tabId);