From 9eb40c46e52a0b07d58b76c510a54238e67882b5 Mon Sep 17 00:00:00 2001 From: rsone001 Date: Tue, 3 Feb 2026 15:29:45 +0900 Subject: [PATCH] =?UTF-8?q?st:=20fix:=20cell=20style=20=EC=86=8D=EC=84=B1?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80,=20grid=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EB=B3=80=ED=99=98=20=EA=B3=B5=ED=86=B5=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/module/CompactDataGrid.tsx | 5 +++++ apps/st/src/components/module/DataGrid.tsx | 5 +++++ apps/st/src/components/module/TabDataGrid.tsx | 5 +++++ .../input/SeweragePenetrationRateInp.tsx | 12 +---------- apps/st/src/components/type/DataGrid.type.ts | 2 ++ .../input/SeweragePenetrationRateInpColumn.ts | 21 ++++++++++++------- .../SeweragePenetrationRateRvwColumn.ts | 2 +- .../src/components/util/grid/footerSummary.ts | 4 ++++ .../src/components/util/grid/gridFunction.ts | 11 ++++++++++ apps/st/src/shared/config/api.ts | 2 +- .../rsone/components/grid/css/DataGrid.css | 10 ++++++++- 11 files changed, 58 insertions(+), 21 deletions(-) create mode 100644 apps/st/src/components/util/grid/gridFunction.ts diff --git a/apps/st/src/components/module/CompactDataGrid.tsx b/apps/st/src/components/module/CompactDataGrid.tsx index 5eb83dfce..04f7cc0b0 100644 --- a/apps/st/src/components/module/CompactDataGrid.tsx +++ b/apps/st/src/components/module/CompactDataGrid.tsx @@ -270,6 +270,11 @@ const CompactDataGrid = ({ columnInfo, fixedColumns, showHeaderCheckbox = false, {...(column.valueType === ValueType.NUMBER && { numberFormat: column.dataFormat ? column.dataFormat : '#,##0.000' })} header={column.header} editable={column.editable} + {...(column.styleName != null + ? { styleName: column.styleName } + : column.editable === false + ? { styleName: 'rg-cell-readonly' as const } + : {})} {...(column.visible === false && { visible: false })} footer={column.footer && !Array.isArray(column.footer) ? { text: column.footer.text, diff --git a/apps/st/src/components/module/DataGrid.tsx b/apps/st/src/components/module/DataGrid.tsx index b97e43345..ebab75ca8 100644 --- a/apps/st/src/components/module/DataGrid.tsx +++ b/apps/st/src/components/module/DataGrid.tsx @@ -706,6 +706,11 @@ const DataGrid = ({ columnInfo, rowStartNum, isExcelImport = true, isExcelExport {...(column.valueType === ValueType.NUMBER && { numberFormat: column.dataFormat ? column.dataFormat : '#,##0.000' })} header={column.header} editable={column.editable} + {...(column.styleName != null + ? { styleName: column.styleName } + : column.editable === false + ? { styleName: 'rg-cell-readonly' as const } + : {})} {...(column.visible === false && { visible: false })} footer={column.footer && !Array.isArray(column.footer) ? { text: column.footer.text, diff --git a/apps/st/src/components/module/TabDataGrid.tsx b/apps/st/src/components/module/TabDataGrid.tsx index 07dbaeef3..0a6fc37b9 100644 --- a/apps/st/src/components/module/TabDataGrid.tsx +++ b/apps/st/src/components/module/TabDataGrid.tsx @@ -940,6 +940,11 @@ const TabDataGrid = ({ columnInfo, isExcelImport = true, isExcelExport = true, r {...(column.valueType === ValueType.NUMBER && { numberFormat: column.dataFormat ? column.dataFormat : '#,##0.00' })} header={column.header} editable={column.editable} + {...(column.styleName != null + ? { styleName: column.styleName } + : column.editable === false + ? { styleName: 'rg-cell-readonly' as const } + : {})} {...(column.visible === false && { visible: false })} footer={column.footer && !Array.isArray(column.footer) ? { text: (column.footer as { text?: string }).text, diff --git a/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx b/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx index 795722c0f..047f241b8 100644 --- a/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx +++ b/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx @@ -14,17 +14,7 @@ import { statisticsInputAPi } from "@/entities/statistics/api/statistics-input-s import type { SearchFormValues } from "@/components/type/SearchForm.type"; import type { SewerageSupplyRateItem } from "@/entities/statistics/model/statistics-input-interface"; import { SeweragePenetrationRateInpColumn } from "@/components/util/column/input/SeweragePenetrationRateInpColumn"; - -// API 응답 항목을 DataGrid row 타입으로 변환 (null/undefined → 빈 문자열) -function toGridRows(items: SewerageSupplyRateItem[]): Record[] { - return items.map((item) => { - const row: Record = {}; - for (const [key, value] of Object.entries(item)) { - row[key] = value === null || value === undefined ? "" : value; - } - return row; - }); -} +import { toGridRows } from "@/components/util/grid/gridFunction"; // 하수도 통계 관리 > 01. 하수도 보급률 const SeweragePenetrationRateInp = () => { diff --git a/apps/st/src/components/type/DataGrid.type.ts b/apps/st/src/components/type/DataGrid.type.ts index 2574b4d1b..efaccaf0d 100644 --- a/apps/st/src/components/type/DataGrid.type.ts +++ b/apps/st/src/components/type/DataGrid.type.ts @@ -84,6 +84,8 @@ export type ColumnConfig = { editable?: boolean; // 셀 편집 가능 여부 /** 그리드에서 컬럼 숨김 (수식용 필드 등) */ visible?: boolean; + /** 셀에 적용할 CSS 클래스명 (예: 'rg-cell-readonly', 'rg-cell-total') */ + styleName?: string; mergeCells?: boolean; sortdisable?: boolean; sortPreserveGroupOrder?: SortPreserveGroupOrder; diff --git a/apps/st/src/components/util/column/input/SeweragePenetrationRateInpColumn.ts b/apps/st/src/components/util/column/input/SeweragePenetrationRateInpColumn.ts index 50125939e..e2cb0ca12 100644 --- a/apps/st/src/components/util/column/input/SeweragePenetrationRateInpColumn.ts +++ b/apps/st/src/components/util/column/input/SeweragePenetrationRateInpColumn.ts @@ -46,7 +46,8 @@ 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'], type: 'sum' as const }, + styleName: 'rg-cell-total', }, // 하수처리구역 내 > 공공하수처리인구 @@ -58,7 +59,8 @@ export const SeweragePenetrationRateInpColumn = { editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0', - computed: { fields: ['pblswrgPrmTrt', 'pblswrgScdTrt', 'pblswrgTertTrt'], type: 'sum' as const } + computed: { fields: ['pblswrgPrmTrt', 'pblswrgScdTrt', 'pblswrgTertTrt'], type: 'sum' as const }, + styleName: 'rg-cell-total', }, { name: 'pblswrgPrmTrt', fieldName: 'pblswrgPrmTrt', header: { text: '물리적처리' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, { name: 'pblswrgScdTrt', fieldName: 'pblswrgScdTrt', header: { text: '생물학적처리' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, @@ -73,7 +75,8 @@ export const SeweragePenetrationRateInpColumn = { editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0', - computed: { fields: ['wstrPrmTrt', 'wstrScdTrt', 'wstrTertTrt'], type: 'sum' as const } + computed: { fields: ['wstrPrmTrt', 'wstrScdTrt', 'wstrTertTrt'], type: 'sum' as const }, + styleName: 'rg-cell-total', }, { name: 'wstrPrmTrt', fieldName: 'wstrPrmTrt', header: { text: '물리적처리' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, { name: 'wstrScdTrt', fieldName: 'wstrScdTrt', header: { text: '생물학적처리' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, @@ -94,7 +97,8 @@ export const SeweragePenetrationRateInpColumn = { editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0', - computed: { fields: ['townUnprocPopltn', 'townSwttPopltn', 'townWrrtnPopltn'], type: 'sum' as const } + computed: { fields: ['townUnprocPopltn', 'townSwttPopltn', 'townWrrtnPopltn'], type: 'sum' as const }, + styleName: 'rg-cell-total', }, { name: 'townUnprocPopltn', fieldName: 'townUnprocPopltn', header: { text: '미처리인구' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, { name: 'townSwttPopltn', fieldName: 'townSwttPopltn', header: { text: '오수처리인구' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, @@ -114,7 +118,8 @@ export const SeweragePenetrationRateInpColumn = { numeratorFields: ['pblswrgPrmTrt', 'pblswrgScdTrt', 'pblswrgTertTrt', 'wstrPrmTrt', 'wstrScdTrt', 'wstrTertTrt', 'notConectPopltn'], denominatorFields: ['pblswrgPrmTrt', 'pblswrgScdTrt', 'pblswrgTertTrt', 'wstrPrmTrt', 'wstrScdTrt', 'wstrTertTrt', 'notConectPopltn', 'townUnprocPopltn', 'townSwttPopltn', 'townWrrtnPopltn'], type: 'pblswrgPopltnSuprtRate' as const - } + }, + styleName: 'rg-cell-total', }, // 고도처리 인구보급률 (고도처리 인구 / 전체 인구 * 100) @@ -130,7 +135,8 @@ export const SeweragePenetrationRateInpColumn = { numeratorFields: ['pblswrgTertTrt', 'wstrTertTrt'], denominatorFields: ['pblswrgPrmTrt', 'pblswrgScdTrt', 'pblswrgTertTrt', 'wstrPrmTrt', 'wstrScdTrt', 'wstrTertTrt', 'notConectPopltn', 'townUnprocPopltn', 'townSwttPopltn', 'townWrrtnPopltn'], type: 'adtrtPopltnSuprtRate' as const - } + }, + styleName: 'rg-cell-total', }, // 하수도 설치율 @@ -147,7 +153,8 @@ export const SeweragePenetrationRateInpColumn = { denominatorFields: ['pblswrgPrmTrt', 'pblswrgScdTrt', 'pblswrgTertTrt', 'wstrPrmTrt', 'wstrScdTrt', 'wstrTertTrt', 'notConectPopltn'], thirdFields: ['piplSupprt'], type: 'swrgInstlrtRate' as const - } + }, + styleName: 'rg-cell-total', }, // 비고 diff --git a/apps/st/src/components/util/column/review/SeweragePenetrationRateRvwColumn.ts b/apps/st/src/components/util/column/review/SeweragePenetrationRateRvwColumn.ts index 968c2732f..acb635784 100644 --- a/apps/st/src/components/util/column/review/SeweragePenetrationRateRvwColumn.ts +++ b/apps/st/src/components/util/column/review/SeweragePenetrationRateRvwColumn.ts @@ -147,7 +147,7 @@ export const SeweragePenetrationRateInfoList = { { name: 'specl_cntrpln_ar', fieldName: '특별대책지역', header: { text: '특별대책지역' } }, { name: 'total_popl', fieldName: '총인구', header: { text: '총인구' }, footer: footerIntArrayByDivision, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, { name: 'ar_sm', fieldName: '총면적(㎢)', header: { text: '총면적(㎢)' }, footer: footerDecimal3ArrayByDivision, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' }, - { name: '계', fieldName: '계', header: { text: '계' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, + { name: '계', fieldName: '계', header: { text: '계' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, dataFormat: '#,##0', styleName: 'rg-cell-total' }, //공공하수처리인구 { name: '합계', fieldName: '합계', header: { text: '합계' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, { name: '1차처리', fieldName: '1차처리', header: { text: '1차처리' }, footer: footerIntArrayByDivision, valueType: ValueType.NUMBER, dataFormat: '#,##0' }, diff --git a/apps/st/src/components/util/grid/footerSummary.ts b/apps/st/src/components/util/grid/footerSummary.ts index 6364454eb..3ae0b0982 100644 --- a/apps/st/src/components/util/grid/footerSummary.ts +++ b/apps/st/src/components/util/grid/footerSummary.ts @@ -171,6 +171,10 @@ export const footerDecimal3 = createSumFooter('#,##0.000'); // "구분" 값에 따라 필터링하는 Footer 배열 (정수형, 2줄) export const footerIntArrayByDivision = createSumFooterArrayByDivision('#,##0'); +export const footerDecimal1ArrayByDivision = createSumFooterArrayByDivision('#,##0.0'); + +export const footerDecimal2ArrayByDivision = createSumFooterArrayByDivision('#,##0.00'); + // "구분" 값에 따라 필터링하는 Footer 배열 (소수점 3자리, 2줄) export const footerDecimal3ArrayByDivision = createSumFooterArrayByDivision('#,##0.000'); diff --git a/apps/st/src/components/util/grid/gridFunction.ts b/apps/st/src/components/util/grid/gridFunction.ts new file mode 100644 index 000000000..173a7ac6d --- /dev/null +++ b/apps/st/src/components/util/grid/gridFunction.ts @@ -0,0 +1,11 @@ +import type { SewerageSupplyRateItem } from "@/entities/statistics/model/statistics-input-interface"; + +export function toGridRows(items: SewerageSupplyRateItem[]): Record[] { + return items.map((item) => { + const row: Record = {}; + for (const [key, value] of Object.entries(item)) { + row[key] = value === null || value === undefined ? "" : value; + } + return row; + }); +}; \ No newline at end of file diff --git a/apps/st/src/shared/config/api.ts b/apps/st/src/shared/config/api.ts index 90e5a6cba..1fd2505c3 100644 --- a/apps/st/src/shared/config/api.ts +++ b/apps/st/src/shared/config/api.ts @@ -65,7 +65,7 @@ export const ENDPOINT = { POST_EVALUATION: "/board-service/api/v1/pstEvl", }, ST_SERVICE: { - COMMON: "/st-input-service/api/v1/common", + COMMON: "/st-management-service/api/v1/common", INPUT: "/st-input-service/api/v1/input", } }; diff --git a/packages/rsone/components/grid/css/DataGrid.css b/packages/rsone/components/grid/css/DataGrid.css index b7d8352da..4469b8490 100644 --- a/packages/rsone/components/grid/css/DataGrid.css +++ b/packages/rsone/components/grid/css/DataGrid.css @@ -101,5 +101,13 @@ border-right: 1px solid #ccc !important; } +/* 읽기 전용 cell */ +.rg-cell-readonly { + background-color: #f0f0f0 !important; + color: #666 !important; +} - +/* 소계, 합계, 율(%) cell */ +.rg-cell-total { + background-color: #e3eaf2 !important; +} \ No newline at end of file