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}