diff --git a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx index 446323b83..c1e601320 100644 --- a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx @@ -14,9 +14,6 @@ import { tableData, yearOptions, } from "@/components/lib/func/commom"; -import { CmpttnModal } from "@/components/ui/modal/coMat/constCostFeeTable"; -import { CoMatModal } from "@/components/ui/modal/coMat/rateFeeModal"; -import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; import { ContentsDiv, Form, @@ -43,6 +40,7 @@ import moment from "moment"; import { usageProcData } from "@/app/store/matDmd/coMatRvw/headList"; import { zodResolver } from "@hookform/resolvers/zod"; import ConCostForm from "@/components/ui/form/coMat/conCostForm/conCostForm"; +import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; export default function CoMatRvw() { const { code, coRvw, coMatRvwInit, coMatRvwSearch, coMatRvwInqua } = @@ -114,7 +112,7 @@ export default function CoMatRvw() { }, [form.watch("useUsgCd")]); useEffect(() => { - if (coMatRvwRes) { + if (coMatRvwRes.length > 0) { const data = coMatRvwRes?.map((item, index) => { let flag = ""; flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg ??""); diff --git a/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx b/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx index 7a5a59a93..2d339b869 100644 --- a/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx @@ -94,7 +94,6 @@ export default function RuseRvwHstry() { } else { - console.log("시도코드", sggCd); ruseRvwInqua(pageNation, 13, String(startYear), String(endYear), sggCd); } }; @@ -122,7 +121,7 @@ export default function RuseRvwHstry() { ?.map((item) => { form.clearErrors; if (item?.completeYn) { - return item.dmdInfoSn; + return Number(item.dmdInfoSn); } }) .filter((item) => item !== undefined); @@ -136,7 +135,7 @@ export default function RuseRvwHstry() { - + +

기본사항

@@ -111,7 +190,7 @@ export default function ConCostForm({ placeholder="" type="text" onChange={(e) => { - field.onChange((e.target.value)); + field.onChange(e.target.value); }} value={field.value ?? ""} /> @@ -194,9 +273,10 @@ export default function ConCostForm({ type="number" step="0.001" onChange={(e) => { - field.onChange(Number(e.target.value)); + //field.onChange(Number(e.target.value) * 365 ); }} value={Number(field.value) * 365 || 0} + readOnly /> )} @@ -207,14 +287,23 @@ export default function ConCostForm({
- - + + + + } + childrenBody={ + <> + {}} + > + + } + bodyClassName={"w-[40vw] h-full"} + >
)} @@ -236,17 +326,27 @@ export default function ConCostForm({
- - + + + + } + childrenBody={ + <> + {}} + > + + } + bodyClassName={"w-[22vw]"} + >
( )} @@ -286,16 +387,22 @@ export default function ConCostForm({ } bodyClassName={"w-[22vw]"} > - {}} - value={ - form.getValues("demandCst.prcsFcltCpctCstrnCst") + - form.getValues("demandCst.fcltSbsdEpsTrf") || 0 - } + ( + + {}} + value={field.value ?? 0} + readOnly + /> + + )} />
@@ -323,75 +430,37 @@ export default function ConCostForm({ />
- ( - - { - field.onChange(Number(e.target.value)); - }} - value={field.value ?? 0} - /> - - )} - /> -
-
- ( - - )} - /> -
-
- - -
+ ( + + { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + + )} + /> + +
+ + +
- {}}>} - bodyClass="w-[40vw] h-[40vh] " - open={isTrfMo.isModal} - onOpenChange={(open) => { - setIsTrfMo({ isModal: open }); - }} - /> - {}}>} - bodyClass="w-[40vw] max-w-none h-[40vh]" - open={isCmpttnMo.isModal} - onOpenChange={(open) => { - setIsCmpttnMo({ isModal: open }); - }} - /> ); diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx index 66acb0bf8..21dc3cf83 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx @@ -9,8 +9,8 @@ import { } from "@common/business_components/ui"; import { Form, FormField } from "@common/business_components/ui/form"; import { Button, Input } from "@common/components"; -import { useEffect, useRef, useState } from "react"; -import { useFieldArray, useForm, type UseFormReturn } from "react-hook-form"; +import { useEffect, useState } from "react"; +import { useFieldArray, useWatch, type UseFormReturn } from "react-hook-form"; import { z } from "zod"; import { commonButonSize, @@ -38,10 +38,10 @@ export function PbnstMngForm({ form, formType, firstFcltData, - indexMng , + indexMng, setIndexMng, }: { -form: UseFormReturn<{items:PbnstRegArrrayType}>; + form: UseFormReturn<{ items: PbnstRegArrrayType }>; formType: string; firstFcltData?: customPbnst; indexMng: number; @@ -64,37 +64,11 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; const [planFiles, setPlanFiles] = useState(null); const [relationfiles, setRelationFiles] = useState(null); const [fcltNm, setFcltNm] = useState(null); - //const [fcOpresData, setFcOpresData] = useState(null); const [mngMtdCode, setMngMtdCode] = useState<{ name: string; val: SelectDataType[] }[]>(); const [progress, setProgress] = useState(0); - //const new File([] as BlobPart[], "") 파일 다운로드 활용 - //const ref = useRef(null); - - // const form = useForm>({ - // resolver: zodResolver(pbnstRegZod), - // defaultValues: - // formType === "reg" && pbnst.pbnstMngRegData - // ? pbnst.pbnstMngRegData[0] - // : formType === "update" && - // typeof pbnst.pbnsUpdateIndex.mng === "number" && - // pbnst.pbnsUpdateIndex.mng >= 0 && - // pbnst.pbnstRes - // ? pbnst.pbnstRes[pbnst.pbnsUpdateIndex.mng] - // : formType === "sttn" && firstFcltData - // ? { - // ruseUtztnFcltNm: firstFcltData?.ruseUtztnFcltNm, - // fcltCpct: firstFcltData?.fcltCpct, - // ruseCpct: firstFcltData?.ruseCpct, - // splyExtraCpct: firstFcltData?.splyExtraCpct, - // fcOpers: firstFcltData?.fcOpers, - // fcFiles: firstFcltData?.fcFiles, - // } - // : pbnstRegZod.parse({}), - // mode: "onChange", - // }); const { fields: fcOpersField, append, @@ -104,39 +78,33 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; name: `items.${indexMng}.fcOpers`, }); - - - const selectFclt = (val: number) => { - // if (pbnst.pbnstRes && pbnst.pbnstRes[val]) { - // getBizCycle(pbnst.pbnstRes[val]); - // // form.reset(pbnst.pbnstRes[val]); - - // getpbnstInsertIndex({ ...pbnst.pbnsUpdateIndex, mng: val }); - // } - }; + const watchedItem = useWatch({ + control: form.control, + name: `items.${indexMng}`, + }); const plusHist = () => { - append( { + append({ choose: false, - pbnstRuseFcltFk: form.getValues(`items.${indexMng}.pbnstRuseFcltPk`) ?? "", + pbnstRuseFcltFk: + form.getValues(`items.${indexMng}.pbnstRuseFcltPk`) ?? "", rgtr: "", mdfr: "", operMthd: "", rprtvBzenty: "", bgngDt: new Date(), endDt: new Date(), - }) - + }); }; const removeSelected = () => { + const nowOpers = form.getValues(`items.${indexMng}.fcOpers`); + if (!nowOpers) return; - const nowOpers = form.getValues(`items.${indexMng}.fcOpers`); - if(!nowOpers) return; - - const selectedIdxs = nowOpers.map((item, idx) => (item.choose ? idx : -1)) - .filter((idx) => idx !== -1); - selectedIdxs.reverse().forEach((idx) => remove(idx)); + const selectedIdxs = nowOpers + .map((item, idx) => (item.choose ? idx : -1)) + .filter((idx) => idx !== -1); + selectedIdxs.reverse().forEach((idx) => remove(idx)); }; const fileHandler = (files: File[], type: string) => { @@ -209,32 +177,14 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; return [...exFileDatas, ...currentdata]; }; - // 등록할때 신규 값을 계속 가지고 있으려고 useEffect(() => { - // if ( - // formType === "reg" && - // firstFcltData && - // (form.getValues(`items.${indexMng}.swtrmtFcltFk`) === "" || - // form.getValues(`items.${indexMng}.swtrmtFcltFk`) === undefined) - // ) { - // form.setValue(`items.${indexMng}.swtrmtFcltFk`, firstFcltData.swtrmtFcltFk); - // form.setValue( - // `items.${indexMng}.pbnstRuseFcltPk`, - // String(firstFcltData.pbnstRuseFcltPk) - // ); - // form.setValue(`items.${indexMng}.fcBizs`, firstFcltData.fcBizs); - // } - console.log('indexMng ', indexMng) - }, [indexMng]); - - useEffect(() => { - if(indexMng>=0){ - const defaultFiles = form.getValues(`items.${indexMng}.fcFiles`); + if (indexMng >= 0) { + const defaultFiles = watchedItem?.fcFiles; if (defaultFiles && defaultFiles.length > 0) { const relationFileList = defaultFiles.filter( (item) => item.fileKnd === "계통도" ); - + const planFileList = defaultFiles.filter( (item) => item.fileKnd === "평면도" ); @@ -244,8 +194,11 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; atflCd: item.fileTkn, file: new File([] as BlobPart[], item.filePath), })) - ); // 또는 파일 형식 변환 로직이 있다면 여기에 추가 - + ); + else { + setRelationFiles(null); + } + if (planFileList.length > 0) setPlanFiles( planFileList.map((item) => ({ @@ -253,46 +206,15 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; file: new File([] as BlobPart[], item.filePath), })) ); - }else{ + else { + setPlanFiles(null); + } + } else { setRelationFiles(null); setPlanFiles(null); } } - }, [form.watch(`items.${indexMng}`),indexMng]); // 초기화 이후 1회 실행 - - // 등록할때 신규 값을 계속 가지고 있으려고 - useEffect(() => { - // if ( - // formType === "update" && - // pbnst.pbnsUpdateIndex.biz >= 0 && - // pbnst.pbnstRes - // ) { - // const bizData = pbnst.pbnstRes[pbnst.pbnsUpdateIndex.biz]; - - // if (bizData) { - // getBizCycle(bizData); - // } - // } - }, [pbnst.pbnsUpdateIndex, pbnst.pbnstRes, formType, getBizCycle]); - - //신규 등록시 입력할때 데이터 넣기 - useEffect(() => { - // const formData = form.watch(); - // formData.fcOpers = ref.current ? [...ref.current] : []; - // formData.fcFiles = regFileList ? [...regFileList] : []; - // if (formType === "reg") { - // console.log("formData ", formData); - // pbnstMngData([formData] as customPbnst[]); - // } else if (formType === "update") { - // const updateRes = pbnst.pbnstRes?.map((item) => { - // if (item.pbnstRuseFcltPk === item.pbnstRuseFcltPk) { - // item = formData as customPbnst; - // } - // return item; - // }); - // pbnstMngData(updateRes as customPbnst[]); - // } - }, [form.formState, regFileList, formType, pbnst.pbnstRes]); + }, [watchedItem, indexMng]); useEffect(() => { // pbnstMngData(pbnst.pbnstMngRegData); @@ -309,7 +231,7 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; // 2. Define a submit handler. function onSubmit(values: z.infer) { - values.fcOpers = []; + values.fcOpers = []; values.fcFiles = regFileList || []; pbnstInsert(values); } @@ -325,15 +247,12 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; } }, [planFiles]); - useEffect(() => { if (code.ruseMngMtd) { setMngMtdCode([{ name: "ruseMngMtd", val: code.ruseMngMtd }]); } }, [code]); - - return (
@@ -348,7 +267,7 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; {formType === "update" ? ( ( @@ -381,6 +300,7 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; field.onChange(String(e.target.value)); }} value={field.value ?? ""} + readOnly={formType === "sttn" ? true : false} /> )} @@ -393,28 +313,41 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
재이용시설 운영정보 -
- - -
+ {formType === "sttn" ? ( + <> + ) : ( +
+ + +
+ )}
{ + return { + ...item, + readonly: true, + }; + }) + : pbnst.pbnstMngUpHeadList + } upHeadList={pbnst.pbnstMngNm} code={mngMtdCode || []} onTableSet={(val) => { @@ -423,7 +356,7 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; indexMng={indexMng} form={form} formNm={"fcOpers"} - // ref={ref} + // ref={ref} >
@@ -445,6 +378,7 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>; field.onChange(Number(e.target.value)); }} value={field.value ?? 0} + readOnly={formType === "sttn" ? true : false} /> )} @@ -453,19 +387,20 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
( { field.onChange(Number(e.target.value)); }} value={field.value ?? 0} + readOnly={formType === "sttn" ? true : false} /> )} @@ -473,19 +408,20 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
( { field.onChange(Number(e.target.value)); }} value={field.value ?? 0} + readOnly={formType === "sttn" ? true : false} /> )} @@ -497,40 +433,78 @@ form: UseFormReturn<{items:PbnstRegArrrayType}>;
- - item.file) || []} - setFiles={(files: File[] | null) => { - if (files) fileHandler(files, "relation"); - }} - fileTypes="PDF" - onFileClick={(index) => { - fileDownLoad( - relationfiles?.find( - (item, fileIndex) => fileIndex === index - )?.atflCd as string - ); - }} - > - + {formType === "sttn" ? ( + relationfiles && relationfiles?.length > 0 ? ( + <> + + {relationfiles?.map((item, index) => ( + fileDownLoad(item.atflCd)} + > + {item.file.name} + + ))} + + ) : ( + <> + ) + ) : ( + + item.file) || []} + setFiles={(files: File[] | null) => { + if (files) fileHandler(files, "relation"); + }} + fileTypes="PDF" + onFileClick={(index) => { + fileDownLoad( + relationfiles?.find( + (item, fileIndex) => fileIndex === index + )?.atflCd as string + ); + }} + > + + )}
- - item.file) || []} - setFiles={(files: File[] | null) => { - if (files) fileHandler(files, "plan"); - }} - fileTypes="PDF" - onFileClick={(index) => { - fileDownLoad( - planFiles?.find( - (item, fileIndex) => fileIndex === index - )?.atflCd as string - ); - }} - > - + {formType === "sttn" ? ( + planFiles && planFiles?.length > 0 ? ( + <> + + {planFiles?.map((item, index) => ( + fileDownLoad(item.atflCd)} + > + {item.file.name} + + ))} + + ) : ( + <> + ) + ) : ( + + item.file) || []} + setFiles={(files: File[] | null) => { + if (files) fileHandler(files, "plan"); + }} + fileTypes="PDF" + onFileClick={(index) => { + fileDownLoad( + planFiles?.find( + (item, fileIndex) => fileIndex === index + )?.atflCd as string + ); + }} + > + + )}
diff --git a/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx b/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx index 9fe45fc33..28dc882c3 100644 --- a/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx @@ -99,7 +99,7 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { selectClass={""} label="" selectArray={yearOptions} - value={field.value} + value={field.value||new Date().getFullYear()} onSelectValue={(val) => field.onChange(val)} /> @@ -113,7 +113,7 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { @@ -127,7 +127,7 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { @@ -146,6 +146,7 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { if (files) setFiles(files); }} fileTypes="xlsx" + maxFiles={1} > )} diff --git a/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx b/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx index 6748ef487..efd47c69b 100644 --- a/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx +++ b/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx @@ -23,12 +23,12 @@ export function ConstCostFeeTable({ const [constCostData, setConstCostData] = useState([]); - function getFctDescription(fctCd: string) { + const getFctDescription = (fctCd: string) => { const fctMap: { [key: string]: string } = { - "001": "총인", - "002": "염소.소독", - "003": "uv소독", - "004": "생물학적탈질", + "001": "총인처리시설", + "002": "염소소독", + "003": "UV소독", + "004": "전처리시설", "005": "RO", }; @@ -61,7 +61,6 @@ export function ConstCostFeeTable({ }, [] ); - console.log("tableData", tableData); const formattedTableData = tableData?.map((item: ContCostMap) => { return { ...item, @@ -73,7 +72,7 @@ export function ConstCostFeeTable({ return ( <> - +

공사비 산정표 보기

@@ -89,7 +88,6 @@ export function ConstCostFeeTable({ onSelectValue={(val: string | number) => setYear(String(val))} /> - {}} onPageChange={() => {}} /> -
); diff --git a/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx b/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx index c5131097c..ee82420a8 100644 --- a/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx +++ b/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx @@ -5,7 +5,7 @@ import type { rateFeeType } from "@/app/store/common/searchCode/type"; import { yearOptions } from "@/components/lib/func/commom"; import { SelectBox, UiTable } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; -import { Label, ScrollArea } from "@common/components/ui"; +import { Input, Label, ScrollArea } from "@common/components/ui"; import { Scroll } from "lucide-react"; import { useEffect, useState } from "react"; @@ -14,7 +14,7 @@ export function RateFeeTableModal({ }: { setReturnData: (data: any) => void; }) { - const { code, coRvw,rateFeeRes } = useWrStore((state) => state); + const { code, coRvw, rateFeeRes } = useWrStore((state) => state); const [year, setYear] = useState(String(new Date().getFullYear())); const [reateFeeTable, setRateFeeTable] = useState([]); @@ -31,26 +31,24 @@ export function RateFeeTableModal({ 10000: "100억원까지", 20000: "200억원까지", 30000: "300억원까지", - 40000: "400억원까지", 50000: "500억원까지", - 70000: "700억원까지", 100000: "1000억원까지", - 150000: "1500억원까지", 200000: "2000억원까지", 300000: "3000억원까지", 500000: "5000억원까지", }; - const fetchData = async (rateFeeRes: rateFeeType[]) => { - const data = await rateFeeRes?.reduce((acc: any, cur: rateFeeType) => { + const data = await rateFeeRes?.filter((item: rateFeeType) => { + return item.incExpCd !== "SS"; + }) + .reduce((acc: any, cur: rateFeeType) => { const key = cur.stdCost; let target = acc.find((item: any) => item.stdCost === key); if (!target) { target = { stdCost: cur.stdCost, BD: 0, - WD: 0, SE: 0, CE: 0, }; @@ -60,18 +58,18 @@ export function RateFeeTableModal({ return acc; }, []); + const dataGubun = data?.map((item: any) => { return { ...item, gubun: gubunLabelMap[item.stdCost] || item.stdCost, }; - }); + }) return dataGubun?.sort((a: any, b: any) => a.stdCost - b.stdCost); }; useEffect(() => { - console.log("rateFeeRes ", rateFeeRes); if (rateFeeRes?.length >= 0) { fetchData(rateFeeRes).then((data) => { setRateFeeTable(data); @@ -81,28 +79,26 @@ export function RateFeeTableModal({ return ( <> - +

요율표 보기


-
- - setYear(String(val))} +
+ + {}} + value={new Date().getFullYear() || ""} />
-
- +
-
diff --git a/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx b/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx index 438ab439c..d20d10591 100644 --- a/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx +++ b/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx @@ -53,6 +53,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { mode: "onChange", }); + const { monthHeadList } = prfmnc; useEffect(() => { let tableData; @@ -77,6 +78,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { majorPrcsMsrcCd: item.majorPrcsMsrcCd ?? "-", inoutYn: item.inoutYn ?? "-", addr: item.addr ?? "-", + mainSplyPumpCpct: item.mainSplyPumpCpct ?? "-", }; }); } else if (fcltTab === "sply") { @@ -113,6 +115,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { smll: item.smll, crmty: item.crmty, tph: item.tph, + tn: item.tn, ph: item.ph, cdtnv: item.cdtnv, @@ -121,7 +124,6 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { } else if (fcltTab === "dmdCo") { tableData = data.fcBizs?.flatMap((item: fcBizType) => { - console.log("item.fcDemands", item.fcDemands); return item?.fcDemands?.map((dmd) => { return { cycl: item.cycl + "차", @@ -163,10 +165,10 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { ]); const getTablePrfData = (prfList: PrfType[]) => { - const inUsageData = [...initValInUsage]; - const outUsageData = [...initValOutUsage]; - const inSubtotal = subTotalObj; - const outSubtotal = subTotalObj; + const inUsageData = structuredClone(initValInUsage); + const outUsageData = structuredClone(initValOutUsage); + const inSubtotal = structuredClone(subTotalObj); + const outSubtotal = structuredClone(subTotalObj); if (prfList) { prfList?.forEach((prfItem) => { @@ -203,7 +205,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { }); inUsageData.push(inSubtotal); outUsageData.push(outSubtotal); - const usageTotalObj: { [key: string]: any } = totalObj; + const usageTotalObj: { [key: string]: any } = structuredClone(totalObj); for (const key in usageTotalObj) { if (["usage", "gubun", "edit"].includes(key)) continue; const val = @@ -227,14 +229,13 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { (item) => item.pbnstRuseFcltPk === data.pbnstRuseFcltPk )?.prfList; - if (prfList) { + if (prfList) {console.log("prfList", prfList); + getTablePrfData(prfList); } } }, [pbnstSttn.pbnstSttnRes, data]); - useEffect(() => {}, [ruseBizData?.head]); - useEffect(()=>{ @@ -243,6 +244,11 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { } },[data, form]) + + + useEffect(()=>{ + console.log("prfData", prfData); + },[prfData]) return ( <>
@@ -254,7 +260,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { indexMng={indexMng} setIndexMng={setIndexMng} /> - + 하수처리수 재이용시설 현황 @@ -292,7 +298,7 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { - + 장내외합계 diff --git a/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx b/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx index 2eeba6c69..11c183f1b 100644 --- a/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx +++ b/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx @@ -21,6 +21,7 @@ import { TableHeader, TableRow, } from "@common/components/ui"; +import { read } from "fs"; import React, { useEffect, useState } from "react"; type RuseMngTableProps = { @@ -37,22 +38,9 @@ type RuseMngTableProps = { const RuseMngTableForm = React.forwardRef( ({ tableData, headList, upHeadList, code, onTableSet, indexMng, form,formNm,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]); - - // useEffect(() => { - - // if (tableData) - // setTableState(tableData); - // }, [tableData]); - + console.log('tableData ', tableData) return ( <> @@ -107,6 +95,7 @@ const RuseMngTableForm = React.forwardRef( ? (Number(field.value) ?? 0) : field.value || "" } + readOnly ={head.readonly ? true : false} /> ) : head.type === "select" ? ( ( className={""} selectClass={selectClass} onSelectValue={(val) => { - field.onChange(val); + + if(head.readonly === true){ + return + }else{ + + field.onChange(val); + } }} + // Disabled prop removed as SelectBox does not support it > ) : head.type === "date" ? ( - field.onChange(date), + value:typeof field.value === "string" ? new Date(field.value) : field.value, + onChange: (date: Date | undefined) => { + + console.log("date", date); + field.onChange(date); // readonly 상태가 아닐 때만 값 변경 + }, }} selectClass={"w-full"} /> @@ -141,7 +140,6 @@ const RuseMngTableForm = React.forwardRef( checked={ field.value || false} onCheckedChange={(checked) => { field.onChange(checked); - }} > ) : (