원수취수 수정 완료
iipbs_wr / build (push) Waiting to run

This commit is contained in:
leedj312
2025-07-07 19:18:29 +09:00
parent 2a16e7151f
commit 7fc94abf86
4 changed files with 30 additions and 13 deletions
@@ -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 },
@@ -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`,
@@ -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({
추가등록
</Button>
</div>
<RuseMngTable
<RuseMngTableForm
key={`fcOrgwts-${indexMng}-${indexBiz}`} // 이게 핵심!
tableData={
form.getValues(
`items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`
) ?? []
form.getValues( `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`)||[]
// fcOrgwtWatch||[]
}
form={form}
headList={pbnst.pbnstOrgwtHeadList}
upHeadList={[]}
indexMng={indexMng}
formNm={"fcOrgwts"}
indexBiz={indexBiz}
/>
</div>
@@ -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) => {
@@ -35,11 +35,14 @@ const RuseMngTable = React.forwardRef<any, RuseMngTableProps>(
{ 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]);
@@ -76,7 +76,7 @@ const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
<TableBody>
{tableData.map((item, i) => (
<TableRow key={item.id}>
<TableRow key={`${item.id }-${i}` } >
{headList.map((head, j) => (
<TableCell
key={`${head.id}-${j}`}
@@ -161,7 +161,14 @@ const RuseMngTableForm = React.forwardRef<any, RuseMngTableProps>(
}}
></Checkbox>
) : (
`${item[head.id] || ""}`
(
<span className="text-black">{
head.type === "number"
? formatCommaNumber(field.value)
: field.value || ""
}</span>
)
)}
</FormUi>
)}