결함 오류 수정
This commit is contained in:
@@ -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),
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 (
|
||||
<TableCell key={head.id + headIndex} className="bg-[#d5e1eb] font-bold text-right">
|
||||
{data[head.id as keyof any] ?? ""}
|
||||
</TableCell>
|
||||
);
|
||||
}
|
||||
// 총합계 행의 나머지 셀에도 색상 적용
|
||||
if (data["구분"] === 0 || data["용수명"] === 0) {
|
||||
return (
|
||||
<TableCell key={head.id + headIndex} className="bg-[#d5e1eb] font-bold text-right">
|
||||
{Number(data[head.id]) ? formatCommaNumber(data[head.id as keyof any]) : data[head.id as keyof any] ?? ""}
|
||||
</TableCell>
|
||||
);
|
||||
}
|
||||
// mergeCell 처리
|
||||
if (head.mergeCell) {
|
||||
const rowSpan = getRowSpan(chgRes, head.id, dataIndex);
|
||||
if (rowSpan === 0) return null;
|
||||
return (
|
||||
<TableCell key={head.id + headIndex} rowSpan={rowSpan} className={`w-36 align-middle text-center whitespace-nowrap ${bgClass}`}>
|
||||
{data[head.id as keyof any] ?? ""}
|
||||
{Number(data[head.id]) ? formatCommaNumber(data[head.id as keyof any]) : data[head.id as keyof any] ?? ""}
|
||||
</TableCell>
|
||||
);
|
||||
}
|
||||
@@ -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}
|
||||
/>
|
||||
</TableCell>
|
||||
@@ -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] ?? ""}
|
||||
</div>
|
||||
</TableCell>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user