diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx index bb1cade10..46287aa2c 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx @@ -47,7 +47,7 @@ export const pbnstDemandHeadListExport: TableUpperProps[] = [ export const pbnstOrgwtHeadListRxport: TableUpperProps[] = [ { id: "ruseUtztnFcltNm", title: "하수처리장명" }, - { id: "orgwtWtritQnt", title: "원수취수량" }, + { id: "orgwtWtritQnt", title: "원수취수량" , type:'number'}, { id: "tmsYn", title: "하수처리량TMS 전후" }, { id: "dschgFmYn", title: "하수처리장 방류 유량계 전·후​" }, { id: "dtlPstnExpln", title: "상세위치", edit: true }, 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 a1d433f2d..4d4ad91d8 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -179,10 +179,6 @@ export function PbnstBuseForm({ appendBiz(newItem); setIndexBiz(pbnstBizCycle); // 새로 추가된 차수로 포커스 이동 } - useEffect(() => { - //console.log("form ", form.watch()); - }, [form.formState]); - const { fields: fcDemands, append: appendDemand, @@ -209,6 +205,9 @@ export function PbnstBuseForm({ prevDemandsLengthRef.current = fcDemands.length; }, [fcDemands.length]); + const fcOrgwtWatch = form.watch( `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`) + const pplInstlsWatch = form.watch( `items.${indexMng}.fcBizs.${indexBiz}.pplInstls`) + const { fields: fcOrgwtFiled } = useFieldArray({ control: form.control, name: `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`, @@ -304,7 +303,7 @@ export function PbnstBuseForm({ console.log("form errors:", form.formState.errors); }, [form.formState.errors]); - useEffect(() => { + useEffect(() => { const pplSum = form.watch(`items.${indexMng}.fcBizs.${indexBiz}.pplInstls`); if (!pplSum) return; let sum = 0; @@ -314,6 +313,11 @@ export function PbnstBuseForm({ setSumCpct(sum); }, [form.formState, indexMng, indexBiz]); +useEffect(() =>{ + + console.log('form.formState ', form.formState) +}, [form.formState]); + const pbnstBiz = form.watch(`items.${indexMng}.fcBizs`); return ( <> @@ -417,17 +421,18 @@ export function PbnstBuseForm({ 추가등록 - @@ -479,6 +484,7 @@ export function PbnstBuseForm({ form.getValues( `items.${indexMng}.fcBizs.${indexBiz}.pplInstls` ) ?? [] + // pplInstlsWatch||[] } headList={pbnst.pplInstlsHeadLisat} code={ppiSelectList ?? []} @@ -489,9 +495,10 @@ export function PbnstBuseForm({ formNm={"pplInstls"} upHeadList={[]} onTableSet={(val) => { - const pplSum = form.getValues( + const pplSum = form.watch( `items.${indexMng}.fcBizs.${indexBiz}.pplInstls` ); + if (!pplSum) return; let sum = 0; pplSum.forEach((item) => { diff --git a/apps/wr/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable.tsx b/apps/wr/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable.tsx index e4ffc1f8d..715e91d8c 100644 --- a/apps/wr/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable.tsx +++ b/apps/wr/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable.tsx @@ -35,11 +35,14 @@ const RuseMngTable = React.forwardRef( { tableData, headList, upHeadList, code, onTableSet, indexMng, indexBiz }, ref ) => { + + const [tableState, setTableState] = useState([...tableData]); useEffect(() => { if (ref && typeof ref === "object" && "current" in ref) { ref.current = tableState; } + if (onTableSet) onTableSet(tableState); }, [tableState, onTableSet]); diff --git a/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx b/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx index e746ab1f5..577e7ce46 100644 --- a/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx +++ b/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx @@ -76,7 +76,7 @@ const RuseMngTableForm = React.forwardRef( {tableData.map((item, i) => ( - + {headList.map((head, j) => ( ( }} > ) : ( - `${item[head.id] || ""}` + ( + + { + head.type === "number" + ? formatCommaNumber(field.value) + : field.value || "" + } + ) )} )}