From 968bf94de2e5e311050fb01a6d894ef6f9a6432f Mon Sep 17 00:00:00 2001 From: leedj312 Date: Sat, 9 Aug 2025 16:49:52 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=BC=EC=9E=AC=EC=9D=B4=EC=9A=A9=20?= =?UTF-8?q?=EC=88=98=EC=9A=94=EB=A7=A4=EC=B9=AD=20=EA=B2=80=ED=86=A0=20?= =?UTF-8?q?=ED=9B=84=EB=B3=B4=EC=B2=98=20=EC=84=A0=ED=83=9D=EC=9D=84=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20=EC=82=AC=EC=A0=84=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/form/coMat/conCostForm/conCostForm.tsx | 71 ++++++++++--------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx index 1d175f1c6..423581432 100644 --- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -50,6 +50,10 @@ export default function ConCostForm({ const ref = useRef(false); const [checkFinish, setCheckFinish] = useState(false); + const [lastSub, setLastSub] = useState<{ + ruseUtztnFcltNm: string; + ruseUtztnFcltCd: string; + } | null>(null); useEffect(() => { if (!ref.current) { @@ -80,7 +84,7 @@ export default function ConCostForm({ const dmndQtyWatch = form.watch("dmndQty"); const totalConstCost = form.watch("totalConstCost"); const cstrnCst = form.watch("demandCst.cstrnCst"); - + const splyList = form.watch("splyCndtList"); const calculateConstCost = useCallback(() => { const usgPrcsProcs = usgPrcsProcsWatch; if (!dmndQtyWatch) { @@ -157,8 +161,11 @@ export default function ConCostForm({ return; } - const splycd = form.getValues("splyCndtList") - const pk = splycd&&splycd[0]?.ruseUtztnFcltCd?splycd[0]?.ruseUtztnFcltCd:'11000SW001R1' + const splycd = form.getValues("splyCndtList"); + const pk = + splycd && splycd[0]?.ruseUtztnFcltCd + ? splycd[0]?.ruseUtztnFcltCd + : "11000SW001R1"; if (type === "mat") { if (value.demandCst) { @@ -183,11 +190,7 @@ export default function ConCostForm({ onClick={() => { toast.dismiss(t.id); - coMatRvwUpdate( - pk, - form.getValues("dmdInfoId"), - data - ); + coMatRvwUpdate(pk, form.getValues("dmdInfoId"), data); }} > 확인 @@ -199,7 +202,6 @@ export default function ConCostForm({ )); } else { - coMatRvwUpdate(pk, form.getValues("dmdInfoId"), data); } } @@ -216,6 +218,10 @@ export default function ConCostForm({ console.log(" form ", form.formState.errors); }, [form.formState]); + useEffect(() => { + console.log("splyCndtList ", splyList); + }, [splyList]); + useEffect(() => { form.register("dmdInfoSn"); form.register("dmdInfoId"); @@ -369,8 +375,8 @@ export default function ConCostForm({ console.log("dmndQty ", e); //field.onChange(Number(e.target.value) * 365 ); }} - // value={Number(field.value) * 365 || 0} - value={Number(field.value) || 0} + // value={Number(field.value) * 365 || 0} + value={Number(field.value) || 0} readOnly /> @@ -501,30 +507,32 @@ export default function ConCostForm({ )} /> - {/*
+
-
- ( - - { - field.onChange(e.target.value); - }} - value={field.value ?? ""} - /> - - )} - /> -
*/} + + + +
{ + if (readonly) return; - if(readonly) return; - field.onChange(Number(e.target.value)); }} value={field.value ?? 0}