From 43d80be24bbd78164a896511b0f3861eca887b20 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Fri, 30 May 2025 16:19:46 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B3=B5=EA=B8=89=EA=B4=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9C=A0=EB=AC=B4=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=BB=A8?= =?UTF-8?q?=ED=8A=B8=EB=A1=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fcltReg/pbnstReg/buseReg/bugRegForm.tsx | 243 +++++++++--------- 1 file changed, 127 insertions(+), 116 deletions(-) diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index d1bf87adb..d1cfe8ebf 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -34,7 +34,7 @@ import MngRegFormDetail from "../mngReg/mngRegFormDetail/mngRegFormDetail"; export function PbnstBuseForm({ data }: { data: fcBizType[] }) { // const ref = useRef(data[0]?.pplInstls ?? null); - const ref = useRef( null); + const ref = useRef(null); const { code, pbnst, pbnstBizData } = useWrStore((state) => state); const { pbnstBizCycle, pbnstRes } = pbnst; const [getBizCycle, setBizCycle] = useState("1"); @@ -72,12 +72,19 @@ export function PbnstBuseForm({ data }: { data: fcBizType[] }) { const formData = form.watch() - formData.pplInstls = ref.current? [...ref.current]:[] // ← form 내부 상태 기준으로 복사 + formData.pplInstls = ref.current ? [...ref.current] : [] // ← form 내부 상태 기준으로 복사 console.log("formData pplReg", formData) pbnstBizData(formData as fcBizType); }, [form.formState]); + useEffect(() => { + + if (ppiYn === "N") { + form.setValue('pplInstls', []) + } + }, [ppiYn, pbnst.pplInstlsHeadLisat]) + useEffect(() => { console.log("pbnst.pbnstMngRegData ", pbnst.pbnstMngRegData); }, [pbnst.pbnstMngRegData]); @@ -89,8 +96,8 @@ export function PbnstBuseForm({ data }: { data: fcBizType[] }) { }; const plusHist = () => { - const regData ={ - ruseFcltBizFk: ref.current?.[0]?.ruseFcltBizFk??"", + const regData = { + ruseFcltBizFk: ref.current?.[0]?.ruseFcltBizFk ?? "", choose: false, ppMqlt: "", pdmt: '', @@ -107,7 +114,7 @@ export function PbnstBuseForm({ data }: { data: fcBizType[] }) { }; const plusArray = () => { - + } const removeSelected = () => { @@ -119,17 +126,17 @@ export function PbnstBuseForm({ data }: { data: fcBizType[] }) { }; useEffect(() => { - - if(getBizCycle){ + + if (getBizCycle) { const index = Number(getBizCycle) - 1; form.reset(pbnst.pbnstResObj?.fcBizs[index]); ref.current = pbnst.pbnstResObj?.fcBizs[index]?.pplInstls ?? []; } - }, [getBizCycle,pbnst.pbnstResObj]); - + }, [getBizCycle, pbnst.pbnstResObj]); + useEffect(() => { const ppl = []; if (code.pplLenght) { @@ -218,116 +225,120 @@ export function PbnstBuseForm({ data }: { data: fcBizType[] }) { sonClass="col-span-4" /> -

재이용 원수취수 현황

-
-
- -
- 재이용 원수취수 현황 +
+
+ +
+ -
-

재이용 공급관로 설치 현황

-
- - setPpiYn(String(val))} - /> - - - - -
-
- { - if (!ref.current) return; - let sum = 0; - ref.current.forEach(item => { - sum += Number(item.cpct) || 0; - }); - setSumCpct(sum); - }} - /> -
- - - -

하수처리수 재이용수 수요처

-
-
- - + headList={pbnst.pbnstOrgwtHeadList} + upHeadList={[]} /> +
+

재이용 공급관로 설치 현황

+
+ + setPpiYn(String(val))} + /> + + + {ppiYn === 'Y' ? <> + + + : <> + + } +
+
+ { + if (!ref.current) return; + let sum = 0; + ref.current.forEach(item => { + sum += Number(item.cpct) || 0; + }); + setSumCpct(sum); + }} + />
- -
- - -
- setIsFcOrgwts(open)} - bodyClass={"w-[50vw] max-w-none h-[60vh]"} - body={ { console.log("val", val); return {}; }} >} - > - + + +

하수처리수 재이용수 수요처

+
+
+ + +
+ +
+ + + + + setIsFcOrgwts(open)} + bodyClass={"w-[50vw] max-w-none h-[60vh]"} + body={ { console.log("val", val); return {}; }} >} + > + ); }