From 5976b35c902b1fb1da1fdc637e620a0d0d3e9ede Mon Sep 17 00:00:00 2001 From: jyha00 Date: Mon, 21 Jul 2025 19:56:41 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=B0=ED=95=A8=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/rainReg/page.tsx | 4 +-- .../ruseFcltMng/fcltSttn/rainSttn/page.tsx | 9 ++++-- apps/wr/components/lib/func/TableData.tsx | 31 +++++++++---------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index 5f81a0ae8..bd0b9bb8e 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -3,7 +3,7 @@ import { useWrStore } from "@/app/store"; import { type customRainBdst, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; -import { tableData } from "@/components/lib/func/commom"; +import { formatCommaNumber, tableData } from "@/components/lib/func/commom"; import RainRegForm from "@/components/ui/form/fcltReg/rainReg/rainRegForm"; import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; import { @@ -52,7 +52,7 @@ export default function Home() { : "확인불가"; return { ...item, - archArea: archArea, + archArea: formatCommaNumber(archArea), }; } diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx index d71989b21..4f83ae576 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx @@ -124,8 +124,13 @@ export default function RainSttn() { item.reuseBuilding[0].rainyObj.filtrTrtmfctCpct === -1 ? "확인불가" : item.reuseBuilding[0].rainyObj.filtrTrtmfctCpct, - archArea: - Math.floor(item.archArea) === -1 ? "확인불가" : item.archArea, + // archArea: + // Math.floor(item.archArea) === -1 ? "확인불가" : Math.trunc(item.archArea) ? item.archArea, + archArea: isNaN(Number(item.archArea)) + ? item.archArea + : Math.floor(Number(item.archArea)) === -1 + ? '확인불가' + : Math.trunc(Number(item.archArea)) }; }) .filter((item: any) => item.rainyObj !== undefined); diff --git a/apps/wr/components/lib/func/TableData.tsx b/apps/wr/components/lib/func/TableData.tsx index 274a5f9b3..63f1db2f6 100644 --- a/apps/wr/components/lib/func/TableData.tsx +++ b/apps/wr/components/lib/func/TableData.tsx @@ -3,6 +3,7 @@ import type { TableUpperProps } from "@/app/store/common/type/header"; import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { Checkbox, Input, TableCell, TableRow } from "@common/components/ui"; +import { formatCommaNumber } from "./commom"; export const rainChkTableData = (chkData: rainChkZodType[]) => { // 1. chkgdnSn + utztnUsgCd 기준 누계 정보 만들기 @@ -210,20 +211,18 @@ export const headVisibleChange = (headList: TableUpperProps[], isEdit: boolean) const handleChange = ( rowIndex: number, field: any, - value: string | number, + value: string, setInputData: (data: any) => void ) => { if (Number(value) < 0 || !Number(value)) { - value = 0; - } else { - value = Number(value); + value = "0"; } setInputData((prevData: any) => prevData?.map((row: any, index: number) => { if (index === rowIndex) { return { ...row, - [field]: value, + [field]: Number(value.replace(/,/g, "")), }; } return row; @@ -292,21 +291,21 @@ export const InputTableBody = ( return null; } - // 총합계 행의 나머지 셀에도 색상 적용 - if (data["구분"] === 0 || data["용수명"] === 0) { - return ( - - {data[head.id as keyof any] ?? ""} - - ); - } + // 총합계 행의 나머지 셀에도 색상 적용 + if (data["구분"] === 0 || data["용수명"] === 0) { + return ( + + {Number(data[head.id]) ? formatCommaNumber(data[head.id as keyof any]) : data[head.id as keyof any] ?? ""} + + ); + } // mergeCell 처리 if (head.mergeCell) { const rowSpan = getRowSpan(chgRes, head.id, dataIndex); if (rowSpan === 0) return null; return ( - {data[head.id as keyof any] ?? ""} + {Number(data[head.id]) ? formatCommaNumber(data[head.id as keyof any]) : data[head.id as keyof any] ?? ""} ); } @@ -320,7 +319,7 @@ export const InputTableBody = ( onChange={(e) => handleChange(dataIndex, head.id, e.target.value, setInputData) } - value={data[head.id as keyof any] ?? ""} + value={formatCommaNumber(data[head.id as keyof any]) ?? ""} maxLength={numSize} /> @@ -333,7 +332,7 @@ export const InputTableBody = ( // `} className={`${textAlignClass} !text-xl w-full h-10`} > - {data[head.id as keyof any] ?? ""} + {Number(data[head.id]) ? formatCommaNumber(data[head.id as keyof any]) : data[head.id as keyof any] ?? ""} );