물재아용 건축물 등록 빗물/중수도/온배수 수정 작업중
This commit is contained in:
@@ -28,10 +28,12 @@ import BdstReg from "../bdstReg/bdstReg";
|
||||
export default function RswtrRegForm({
|
||||
rswtForm,
|
||||
isModal,
|
||||
setIsModal,
|
||||
readonly = false
|
||||
}: {
|
||||
rswtForm: customRswtBdst;
|
||||
isModal: boolean;
|
||||
setIsModal?: (isModal: boolean) => void;
|
||||
readonly?: boolean;
|
||||
}) {
|
||||
const { rswt, code, rswtBdstUpdate, rswtBdstReg } = useWrStore(
|
||||
@@ -54,6 +56,7 @@ export default function RswtrRegForm({
|
||||
const onSubmit = (values: z.infer<typeof rswtZod>) => {
|
||||
if (isModal) {
|
||||
rswtBdstReg(values, "41");
|
||||
if(setIsModal) setIsModal(false)
|
||||
} else {
|
||||
rswtBdstUpdate(values, "41");
|
||||
}
|
||||
@@ -61,28 +64,29 @@ export default function RswtrRegForm({
|
||||
const cleanRswtData = (raw: any): z.infer<typeof rswtZod> => {
|
||||
return {
|
||||
...raw,
|
||||
frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null),
|
||||
frstArchPrmsnDt: raw?.frstArchPrmsnDt
|
||||
? new Date(raw.frstArchPrmsnDt)
|
||||
: new Date(), // raw?.frstArchPrmsnDt가 유효하지 않으면 현재 날짜로 초기화
|
||||
archChgPrmsnDt: raw?.archChgPrmsnDt
|
||||
? new Date(raw?.archChgPrmsnDt)
|
||||
: null,
|
||||
reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({
|
||||
...item,
|
||||
instlCmptnDt: new Date(item?.instlCmptnDt),
|
||||
operMngCd: item?.operMngCd ?? "", // null → ""
|
||||
grntchBdstCertYr:
|
||||
typeof item?.grntchBdstCertYr === "string"
|
||||
? item?.grntchBdstCertYr
|
||||
: "", // null → ""
|
||||
rswtrObj: {
|
||||
instlCmptnDt: item?.instlCmptnDt
|
||||
? new Date(item.instlCmptnDt)
|
||||
: new Date(), // item?.instlCmptnDt가 유효하지 않으면 현재 날짜로 초기화
|
||||
operMngCd: item?.operMngCd ?? "", // null → ""
|
||||
instlCstSprtYn: item?.instlCstSprtYn ?? "Y", // null → "Y"
|
||||
grntchBdstCertYn:item?.grntchBdstCertYn??"Y",
|
||||
rswtrObj: {
|
||||
...item?.rswtrObj,
|
||||
filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ?? "Y",
|
||||
|
||||
},
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
console.log("rswtForm:", rswtForm)
|
||||
}, [rswtForm])
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
|
||||
Reference in New Issue
Block a user