From 347fd44ab12c14978addaf37bd12cf58b917a75c Mon Sep 17 00:00:00 2001 From: leedj312 Date: Sun, 22 Jun 2025 16:41:42 +0900 Subject: [PATCH 01/12] =?UTF-8?q?=EC=88=98=EC=9A=94=EC=B2=98=EB=A7=A4?= =?UTF-8?q?=EC=B9=AD=20=EA=B3=84=EC=82=B0=EC=8B=9D=20=EC=A7=84=ED=96=89?= =?UTF-8?q?=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wr/app/matMng/coMat/ruseRvwHstry/page.tsx | 2 - .../wr/app/store/matDmd/coMatRvw/headList.tsx | 18 +- apps/wr/app/store/matDmd/coMatRvw/type.tsx | 2 + .../lib/func/calculateConstCost .tsx | 80 ++++++ apps/wr/components/lib/func/commom.tsx | 3 + .../ui/form/coMat/conCostForm/conCostForm.tsx | 243 +++++++++++++----- .../ui/modal/coMat/constCostFeeTable.tsx | 10 +- 7 files changed, 271 insertions(+), 87 deletions(-) create mode 100644 apps/wr/components/lib/func/calculateConstCost .tsx diff --git a/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx b/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx index 7a5a59a93..4d0d4ea54 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); } }; @@ -193,7 +192,6 @@ export default function RuseRvwHstry() { } }, [rvwHistRes]); - useEffect(() => {}, [form.formState]); useEffect(() => { console.log("변경여부 ", form.formState.isDirty); diff --git a/apps/wr/app/store/matDmd/coMatRvw/headList.tsx b/apps/wr/app/store/matDmd/coMatRvw/headList.tsx index b13796950..7b43e4b00 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/headList.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/headList.tsx @@ -187,13 +187,13 @@ export const rateFeeHeadListExport: CommonTableProps[] = [ ]; export const usageProcData = [ - { usage: "청소", process: "총인처리시설 + 염소소독" }, - { usage: "화장실용수", process: "총인처리시설 + 염소소독" }, - { usage: "세척", process: "총인처리시설 + UV소독" }, - { usage: "살수", process: "총인처리시설 + UV소독" }, - { usage: "조경", process: "총인처리시설 + UV소독" }, - { usage: "농업", process: "총인처리시설 + UV소독" }, - { usage: "하천", process: "총인처리시설 + UV소독" }, - { usage: "지하수", process: "전처리시설 + RO" }, - { usage: "공업", process: "전처리시설 + RO" }, + { usage: "청소", process: "총인처리시설+염소소독" }, + { usage: "화장실용수", process: "총인처리시설+염소소독" }, + { usage: "세척", process: "총인처리시설+UV소독" }, + { usage: "살수", process: "총인처리시설+UV소독" }, + { usage: "조경", process: "총인처리시설+UV소독" }, + { usage: "농업", process: "총인처리시설+UV소독" }, + { usage: "하천", process: "총인처리시설+UV소독" }, + { usage: "지하수", process: "전처리시설+RO" }, + { usage: "공업", process: "전처리시설+RO" }, ]; diff --git a/apps/wr/app/store/matDmd/coMatRvw/type.tsx b/apps/wr/app/store/matDmd/coMatRvw/type.tsx index b4990c7eb..90c2790d5 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/type.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/type.tsx @@ -93,6 +93,8 @@ import { z } from "zod"; demandMatching: DemandMatchingSchema.nullish(), demandCst: DemandCstSchema, ruseUtztnFcltNm:z.string().nullish(), + totalConstCost:z.number().nullish(), + }); diff --git a/apps/wr/components/lib/func/calculateConstCost .tsx b/apps/wr/components/lib/func/calculateConstCost .tsx new file mode 100644 index 000000000..73cd506b4 --- /dev/null +++ b/apps/wr/components/lib/func/calculateConstCost .tsx @@ -0,0 +1,80 @@ +export const findBounds = ( + data: any[], + fctCd: string, + qty: number +): { lower?: any; upper?: any } => { + const filtered = data.filter((item) => item.fctCd === fctCd); + + const lowers = filtered.filter((item) => Number(item.fctCpc) <= qty); + const uppers = filtered.filter((item) => Number(item.fctCpc) > qty); + + const lower = + lowers.length > 0 + ? lowers.reduce((acc, curr) => + Number(curr.fctCpc) > Number(acc.fctCpc) ? curr : acc + ) + : undefined; + const upper = + uppers.length > 0 + ? uppers.reduce((acc, curr) => + Number(curr.fctCpc) < Number(acc.fctCpc) ? curr : acc + ) + : undefined; + + return { lower, upper }; +}; + +// (기울기) a = (y2 - y1) / (x2 - x1) +// (절편) b = y1 - a * x1 +// ↓ +// 결과값 y = a * x + b + +export const getInterpolation = ( + Upper: { stdCost: number; fctCpc: number }, + Lower: { stdCost: number; fctCpc: number }, + qtyYear: number +): number => { + const slope = + (Number(Upper?.stdCost) - Number(Lower?.stdCost)) / + (Number(Upper?.fctCpc) - Number(Lower?.fctCpc)); + const intercept = Number(Lower?.stdCost) - slope * Number(Lower?.fctCpc); + return slope * qtyYear + intercept; +}; + +export const transformAndInterpolate = ( + rawData: any, + dmndQtyYear: number +): any => { + const result: any = {}; + + for (const key in rawData) { + const item = rawData[key]; + + const range = { + Lower: { + fctCpc: item.lower?.stdCost, + stdCost: item.lower?.rt, + }, + Upper: { + fctCpc: item.upper?.stdCost, + stdCost: item.upper?.rt, + }, + }; + console.log("range ", range); + result[key] = getInterpolation(range.Upper, range.Lower, dmndQtyYear); + } + + return result; +}; + +export const getConstFctCode = (fctCd: string) => { + const fctMap: { [key: string]: string } = { + 총인처리시설: "001", + 염소소독: "002", + UV소독: "003", + 전처리시설: "004", + RO: "005", + }; + + return fctMap[fctCd]; +}; diff --git a/apps/wr/components/lib/func/commom.tsx b/apps/wr/components/lib/func/commom.tsx index ba0f5c588..85e1a36b0 100644 --- a/apps/wr/components/lib/func/commom.tsx +++ b/apps/wr/components/lib/func/commom.tsx @@ -153,3 +153,6 @@ export const getdmdMatFlag = (flag: string|undefined) => { } return flagMat; }; + + + diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx index 21746c099..f62e8b2a2 100644 --- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -6,6 +6,12 @@ import type { } from "@/app/store/matDmd/coMatRvw/type"; import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { formH1Class } from "@/components/lib/class/comClass"; +import { + findBounds, + getConstFctCode, + getInterpolation, + transformAndInterpolate, +} from "@/components/lib/func/calculateConstCost "; import { ConstCostFeeTable } from "@/components/ui/modal/coMat/constCostFeeTable"; import { RateFeeTableModal } from "@/components/ui/modal/coMat/rateFeeModal"; import { @@ -17,7 +23,8 @@ import { } from "@common/business_components/ui"; import PopoverUi from "@common/business_components/ui/popover_ui"; import { Button, Input, Label } from "@common/components/ui"; -import { useEffect, useRef, useState } from "react"; +import type { read } from "fs"; +import { useCallback, useEffect, useRef, useState } from "react"; import { type UseFormReturn } from "react-hook-form"; export default function ConCostForm({ @@ -27,7 +34,14 @@ export default function ConCostForm({ form: UseFormReturn; type: string; }) { - const { coMatRvwUpdate, ruseRvwCalUpdate,getRateFee ,getConstCostFee} = useWrStore((state) => state); + const { + constCostRes, + rateFeeRes, + coMatRvwUpdate, + ruseRvwCalUpdate, + getRateFee, + getConstCostFee, + } = useWrStore((state) => state); const ref = useRef(false); @@ -38,9 +52,8 @@ export default function ConCostForm({ getRateFee(String(currentYear)); ref.current = true; } - }, [ref, getConstCostFee ,getRateFee ]); + }, [ref, getConstCostFee, getRateFee]); - const [isTrfMo, setIsTrfMo] = useState<{ isModal: boolean; }>({ isModal: false }); @@ -59,6 +72,82 @@ export default function ConCostForm({ link.click(); }); }; + const usgPrcsProcsWatch = form.watch("demandCst.usgPrcsProcs"); + const dmndQtyWatch = form.watch("dmndQty"); + const totalConstCost = form.watch("totalConstCost"); + const cstrnCst = form.watch("demandCst.cstrnCst"); + + const calculateConstCost = useCallback(() => { + const usgPrcsProcs = usgPrcsProcsWatch; + const dmndQtyYear = dmndQtyWatch * 365; + if (usgPrcsProcs && usgPrcsProcs?.length > 0) { + const firstProc = + getConstFctCode(usgPrcsProcs?.split("+")[0] || "") || ""; + const secondProc = + getConstFctCode(usgPrcsProcs?.split("+")[1] || "") || ""; + + const { lower: firstLower, upper: firstUpper } = findBounds( + constCostRes, + firstProc || "", + Number(dmndQtyYear) + ); + const { lower: secondLower, upper: secondUpper } = findBounds( + constCostRes, + secondProc || "", + Number(dmndQtyYear) + ); + + const firstConstFee = getInterpolation( + firstUpper, + firstLower, + dmndQtyYear + ); + const secondConstFee = getInterpolation( + secondUpper, + secondLower, + dmndQtyYear + ); + const result = Math.round(firstConstFee + secondConstFee) / 100; + + const groupCodes = ["BD", "CE", "SE", "WD"]; + const groupedBounds: { [key: string]: { lower?: any; upper?: any } } = {}; + for (const code of groupCodes) { + const groupItems = rateFeeRes.filter((item) => item.incExpCd === code); + const lowers = groupItems.filter( + (item) => Number(item.stdCost) <= result + ); + const uppers = groupItems.filter( + (item) => Number(item.stdCost) > result + ); + + const lower = + lowers.length > 0 + ? lowers.reduce((acc, curr) => + Number(curr.stdCost) > Number(acc.stdCost) ? curr : acc + ) + : undefined; + + const upper = + uppers.length > 0 + ? uppers.reduce((acc, curr) => + Number(curr.stdCost) < Number(acc.stdCost) ? curr : acc + ) + : undefined; + + groupedBounds[code] = { lower, upper }; + } + + const resultRate = transformAndInterpolate(groupedBounds, result); + const fcltSbsdEpsTrf =result * (resultRate.BD + resultRate.CE + resultRate.SE + resultRate.WD); + + const realResult = + result +fcltSbsdEpsTrf; + + form.setValue("demandCst.prcsFcltCpctCstrnCst", result); + form.setValue( "demandCst.fcltSbsdEpsTrf",fcltSbsdEpsTrf); + form.setValue("totalConstCost", realResult); + } + }, [constCostRes, rateFeeRes, usgPrcsProcsWatch, dmndQtyWatch]); const onSubmit = (value: DmdCoReqType) => { if (type === "mat") { @@ -77,7 +166,7 @@ export default function ConCostForm({ }; useEffect(() => { - console.log(" form ", form.formState.errors); + // console.log(" form ", form.formState.errors); }, [form.formState]); return ( @@ -90,7 +179,7 @@ export default function ConCostForm({

처리시설 표준공사비 산정

-
@@ -323,75 +419,80 @@ export default function ConCostForm({ />
- ( - + ( + + { + field.onChange(Number(e.target.value)); + }} + value={field.value ?? 0} + /> + + )} + /> +
+
+ ( +
-
- ( - - )} - /> -
-
- - -
+ + )} + /> + +
+ + +
+ {}}>} + body={ + {}}> + } + bodyClass="w-[40vw] max-w-none h-[40vh]" + open={isCmpttnMo.isModal} + onOpenChange={(open) => { + setIsCmpttnMo({ isModal: open }); + }} + /> + {}}> + } 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/modal/coMat/constCostFeeTable.tsx b/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx index 6748ef487..b47047d9a 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", }; From dc6491862753d842b418389a6360dacdfb644e60 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Mon, 23 Jun 2025 11:13:11 +0900 Subject: [PATCH 02/12] =?UTF-8?q?=EC=88=98=EC=9A=94=EB=A7=A4=EC=B9=AD=20?= =?UTF-8?q?=EB=B0=8F=20=EC=9E=AC=EC=9D=B4=EC=9A=A9=20=EA=B2=80=ED=86=A0=20?= =?UTF-8?q?=EC=9D=B4=EB=A0=A5=20=EA=B3=84=EC=82=B0=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/fcltSttn/pbnstSttn/page.tsx | 1 + .../prfmncReg/pbnstPrfmncReg/page.tsx | 11 +- .../prfmncSttn/pbnstPrfmncSttn/page.tsx | 10 +- apps/wr/app/store/common/type/header.tsx | 1 + apps/wr/app/store/matDmd/coMatRvw/type.tsx | 22 +- .../fcltSttn/pbnstSttn/headList.tsx | 31 +- .../lib/func/calculateConstCost .tsx | 57 +++- .../ui/form/coMat/conCostForm/conCostForm.tsx | 158 ++++----- .../fcltReg/pbnstReg/mngReg/mngRegForm.tsx | 316 ++++++++---------- .../pbnPrfExcelModal/pbnPrfExcelModal.tsx | 7 +- .../ui/modal/coMat/constCostFeeTable.tsx | 4 +- .../ui/modal/coMat/rateFeeModal.tsx | 44 ++- .../sttn/pbnstSttnModal/pbnstSttnModal.tsx | 28 +- .../ruseMngTableForm/ruseMngTableForm.tsx | 36 +- 14 files changed, 346 insertions(+), 380 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx index 862e260fd..8823abf6d 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx @@ -87,6 +87,7 @@ export default function PbnstSttn() { } }, [pbnstSttn.isInit, pbnSttnInit, ref.current]); useEffect(() => { + setBdstTable(pbnstSttn.pbnstSttnRes); }, [pbnstSttn.pbnstSttnRes]); diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx index 46ec39658..0714c9306 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx @@ -84,10 +84,10 @@ export default function prfmncPrfmncReg() { isModal: false, data: prfmncRes[index] || ({} as FcPrfType), }); - 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 (prfmncRes[index]?.prfList) { prfmncRes[index].prfList?.forEach((prfItem) => { const month = Number(prfItem?.ym?.slice(4)); // "MM" @@ -123,7 +123,7 @@ export default function prfmncPrfmncReg() { }); 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 = @@ -135,7 +135,6 @@ export default function prfmncPrfmncReg() { const tableData = [...inUsageData, ...outUsageData, usageTotalObj]; setPbnstRuseFcltPk(prfmncRes[index].pbnstRuseFcltPk); - console.log(' tableData ' ,tableData) setInputData(tableData); } else { setInputData([]); diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx index 74c566c03..95ce7d7d9 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx @@ -65,11 +65,11 @@ export default function PbnstPrfmncSttn() { type lineChartDataProps = { label: string, val: number, color: string }; const prfTableData = (prfList: PrfType[], year:string) => { - const inUsageData = initValInUsage; - const outUsageData = initValOutUsage; + const inUsageData = structuredClone(initValInUsage); + const outUsageData = structuredClone(initValOutUsage); - const inSubtotal = subTotalObj; - const outSubtotal = subTotalObj; + const inSubtotal = structuredClone(subTotalObj); + const outSubtotal = structuredClone(subTotalObj); console.log(' prfList ', prfList) const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year) @@ -108,7 +108,7 @@ export default function PbnstPrfmncSttn() { }); 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 = diff --git a/apps/wr/app/store/common/type/header.tsx b/apps/wr/app/store/common/type/header.tsx index 45ef9e291..f064b7580 100644 --- a/apps/wr/app/store/common/type/header.tsx +++ b/apps/wr/app/store/common/type/header.tsx @@ -22,5 +22,6 @@ export type TableUpperProps = { selectData ?:string; // type 이 seelct 일경우 selectarray 정하기 위해 row?:number; mergeCell?:boolean // 셀을 합칠경우 + readonly?:boolean }; diff --git a/apps/wr/app/store/matDmd/coMatRvw/type.tsx b/apps/wr/app/store/matDmd/coMatRvw/type.tsx index 90c2790d5..739ba7a44 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/type.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/type.tsx @@ -73,19 +73,19 @@ import { z } from "zod"; dmdInfoFk: z.string(), dmndTmng: z.coerce.date(), dmndQty: z.number(), - wntUntprc: z.number(), - grssClfg: z.number(), - combResdch: z.number(), - trbt: z.number(), + wntUntprc: z.number().nullish(), + grssClfg: z.number().nullish(), + combResdch: z.number().nullish(), + trbt: z.number().nullish(), blgcOxygDmndQnt: z.number(), - smll: z.number(), - crmty: z.number(), - tn: z.number(), - tph: z.number(), - ph: z.number(), - clIonQnt: z.number(), + smll: z.number().nullish(), + crmty: z.number().nullish(), + tn: z.number().nullish(), + tph: z.number().nullish(), + ph: z.number().nullish(), + clIonQnt: z.number().nullish(), cdtnv: z.number(), - rmrk: z.string(), + rmrk: z.string().nullish(), useUsgCd: z.string().nullish(), mtchnCmptnYmd: z.string().nullish(), rvwCmptnYmd: z.string().nullish(), diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/headList.tsx index 9fe7fddc9..7c2953932 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/headList.tsx @@ -31,8 +31,8 @@ export const pbnSttHeadListExport: z.infer = [ { id: "bscFctNm", title: "시설명", visible: true }, { id: "efflWqltStndrdNm", title: "지역구분", visible: true }, - { id: "fctCpc", title: "시설용량(톤/일)", visible: true }, { id: "tel", title: "전화번호", visible: true }, + { id: "fctCpc", title: "시설용량(톤/일)", visible: true }, { id: "ruseUtztnFcltNm", title: "재이용시설명", visible: true }, { @@ -132,7 +132,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "phone", + id: "tel", title: "전화번호", visible: true, row: 1, @@ -140,7 +140,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "fcltQuantity", + id: "fctCpc", title: "시설용량(톤/일)", visible: true, row: 1, @@ -325,7 +325,7 @@ export const ruseFcltNodeListExport: TableUpperProps[] = [ visible: true, row: 1, rowSpan: 1, - colSpan: 10, + colSpan: 9, }, { id: "ruseFclt", @@ -333,10 +333,10 @@ export const ruseFcltNodeListExport: TableUpperProps[] = [ visible: true, row: 1, rowSpan: 1, - colSpan: 5, + colSpan: 3, }, { - id: "mainSply", + id: "mainSplyPumpCpct", title: "메인공급펌프용량", visible: true, row: 1, @@ -349,7 +349,7 @@ export const ruseFcltNodeListExport: TableUpperProps[] = [ visible: true, row: 2, rowSpan: 1, - colSpan: 6, + colSpan: 5, }, { id: "instlAprvSncnDt", @@ -424,14 +424,7 @@ export const ruseFcltNodeListExport: TableUpperProps[] = [ rowSpan: 1, colSpan: 1, }, - { - id: "cusrAlotm2", - title: "원인자부담금", - visible: true, - row: 3, - rowSpan: 1, - colSpan: 1, - }, + { id: "etc", title: "기타", visible: true, row: 3, rowSpan: 1, colSpan: 1 }, { id: "totalMoney", @@ -498,11 +491,7 @@ export const ruseFcltHeadListExport: CommonTableProps[] = [ title: "민간투자비", visible: true, }, - { - id: "cusrAlotm2", - title: "원인자부담금", - visible: true, - }, + { id: "etc", title: "기타", visible: true }, { id: "totalMoney", @@ -545,7 +534,7 @@ export const ruseFcltHeadListExport: CommonTableProps[] = [ visible: true, }, { - id: "mainSply", + id: "mainSplyPumpCpct", title: "메인공급펌프용량", visible: true, }, diff --git a/apps/wr/components/lib/func/calculateConstCost .tsx b/apps/wr/components/lib/func/calculateConstCost .tsx index 73cd506b4..5e9387385 100644 --- a/apps/wr/components/lib/func/calculateConstCost .tsx +++ b/apps/wr/components/lib/func/calculateConstCost .tsx @@ -1,44 +1,66 @@ export const findBounds = ( data: any[], fctCd: string, + dataCode: string, + qtyCode:string, qty: number -): { lower?: any; upper?: any } => { - const filtered = data.filter((item) => item.fctCd === fctCd); +): { lower: any; upper: any } => { - const lowers = filtered.filter((item) => Number(item.fctCpc) <= qty); - const uppers = filtered.filter((item) => Number(item.fctCpc) > qty); + + const filtered = data.filter((item) => item[dataCode] === fctCd); + + const lowers = filtered.filter((item) => Number(item[qtyCode]) <= qty); + const uppers = filtered.filter((item) => Number(item[qtyCode]) > qty); const lower = lowers.length > 0 ? lowers.reduce((acc, curr) => - Number(curr.fctCpc) > Number(acc.fctCpc) ? curr : acc - ) - : undefined; - const upper = - uppers.length > 0 - ? uppers.reduce((acc, curr) => - Number(curr.fctCpc) < Number(acc.fctCpc) ? curr : acc + Number(curr[qtyCode]) > Number(acc[qtyCode]) ? curr : acc ) : undefined; - return { lower, upper }; + const upper = + uppers.length > 0 + ? uppers.reduce((acc, curr) => + Number(curr[qtyCode]) < Number(acc[qtyCode]) ? curr : acc + ) + : undefined; + + // ✅ 바운더리 하나만 있을 경우 대체 처리 + if (!lower && upper) return { lower: upper, upper }; + if (!upper && lower) return { lower, upper: lower }; + + // ✅ 정상 보간 구간 + if (lower && upper) return { lower, upper }; + + // ❌ 둘 다 없을 경우 (fctCd 필터 결과가 없음) + throw new Error(`No matching bounds found for fctCd: ${fctCd}, qty: ${qty}`); }; + // (기울기) a = (y2 - y1) / (x2 - x1) // (절편) b = y1 - a * x1 // ↓ // 결과값 y = a * x + b + export const getInterpolation = ( Upper: { stdCost: number; fctCpc: number }, Lower: { stdCost: number; fctCpc: number }, qtyYear: number ): number => { - const slope = - (Number(Upper?.stdCost) - Number(Lower?.stdCost)) / - (Number(Upper?.fctCpc) - Number(Lower?.fctCpc)); - const intercept = Number(Lower?.stdCost) - slope * Number(Lower?.fctCpc); - return slope * qtyYear + intercept; + const x1 = Number(Lower.fctCpc); // 최소 처리 용량 + const y1 = Number(Lower.stdCost); // 최소 공사비/요율 + const x2 = Number(Upper.fctCpc); // 최대 처리 용량 + const y2 = Number(Upper.stdCost); // 최대 공사비/요율 + + if (qtyYear <= x1) return y1; // 최소 이하면 y1 반환 + if (qtyYear >= x2) return y2; // 최대 이상이면 y2 반환 + + const slope = (y2 - y1) / (x2 - x1); // 기울기 a + const intercept = y1 - slope * x1; // 절편 b + + return slope * qtyYear + intercept; // 보간 계산 }; export const transformAndInterpolate = ( @@ -60,7 +82,6 @@ export const transformAndInterpolate = ( stdCost: item.upper?.rt, }, }; - console.log("range ", range); result[key] = getInterpolation(range.Upper, range.Lower, dmndQtyYear); } diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx index f62e8b2a2..5809ce120 100644 --- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -26,6 +26,7 @@ import { Button, Input, Label } from "@common/components/ui"; import type { read } from "fs"; import { useCallback, useEffect, useRef, useState } from "react"; import { type UseFormReturn } from "react-hook-form"; +import toast from "react-hot-toast"; export default function ConCostForm({ form, @@ -89,11 +90,15 @@ export default function ConCostForm({ const { lower: firstLower, upper: firstUpper } = findBounds( constCostRes, firstProc || "", + 'fctCd', + 'fctCpc', Number(dmndQtyYear) ); const { lower: secondLower, upper: secondUpper } = findBounds( constCostRes, secondProc || "", + 'fctCd', + 'fctCpc', Number(dmndQtyYear) ); @@ -112,44 +117,32 @@ export default function ConCostForm({ const groupCodes = ["BD", "CE", "SE", "WD"]; const groupedBounds: { [key: string]: { lower?: any; upper?: any } } = {}; for (const code of groupCodes) { - const groupItems = rateFeeRes.filter((item) => item.incExpCd === code); - const lowers = groupItems.filter( - (item) => Number(item.stdCost) <= result - ); - const uppers = groupItems.filter( - (item) => Number(item.stdCost) > result - ); - - const lower = - lowers.length > 0 - ? lowers.reduce((acc, curr) => - Number(curr.stdCost) > Number(acc.stdCost) ? curr : acc - ) - : undefined; - - const upper = - uppers.length > 0 - ? uppers.reduce((acc, curr) => - Number(curr.stdCost) < Number(acc.stdCost) ? curr : acc - ) - : undefined; - - groupedBounds[code] = { lower, upper }; + + groupedBounds[code] = findBounds(rateFeeRes, code, 'incExpCd', 'stdCost',result); } const resultRate = transformAndInterpolate(groupedBounds, result); - const fcltSbsdEpsTrf =result * (resultRate.BD + resultRate.CE + resultRate.SE + resultRate.WD); + const fcltSbsdEpsTrf = + result * + (resultRate.BD + resultRate.CE + resultRate.SE + resultRate.WD); - const realResult = - result +fcltSbsdEpsTrf; + const realResult = result + fcltSbsdEpsTrf; - form.setValue("demandCst.prcsFcltCpctCstrnCst", result); - form.setValue( "demandCst.fcltSbsdEpsTrf",fcltSbsdEpsTrf); - form.setValue("totalConstCost", realResult); + form.setValue("demandCst.prcsFcltCpctCstrnCst", Math.round(result) ); + form.setValue("demandCst.fcltSbsdEpsTrf", Math.round(fcltSbsdEpsTrf)) ; + form.setValue("totalConstCost", Math.round(realResult)); } }, [constCostRes, rateFeeRes, usgPrcsProcsWatch, dmndQtyWatch]); - const onSubmit = (value: DmdCoReqType) => { + + if( !form.getValues('demandCst.prcsFcltCpctCstrnCst') ){ + + console.log(" form ", form.getValues()); + toast.error('공사비 계산 진행 후 저장을 눌러주새요') + return + } + + if (type === "mat") { const data: DedMatUpdateType = { dmdInfoSn: form.getValues("dmdInfoSn"), @@ -159,14 +152,14 @@ export default function ConCostForm({ prcsFcltCpctCstrnCst: form.getValues("demandCst.prcsFcltCpctCstrnCst"), rgtr: TEST_UUID, }; - coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data); + coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data); } else if (type === "hist") { ruseRvwCalUpdate(value); } }; useEffect(() => { - // console.log(" form ", form.formState.errors); + console.log(" form ", form.formState.errors); }, [form.formState]); return ( @@ -297,14 +290,23 @@ export default function ConCostForm({
- - + + + + } + childrenBody={ + <> + {}} + > + + } + bodyClassName={"w-[40vw] h-full"} + >
)} @@ -326,13 +329,23 @@ export default function ConCostForm({
- - + + + + } + childrenBody={ + <> + {}} + > + + } + bodyClassName={"w-[22vw]"} + >
)} @@ -438,26 +452,15 @@ export default function ConCostForm({ />
- ( - - )} + +
@@ -472,27 +475,6 @@ export default function ConCostForm({
- - {}}> - } - bodyClass="w-[40vw] max-w-none h-[40vh]" - open={isCmpttnMo.isModal} - onOpenChange={(open) => { - setIsCmpttnMo({ isModal: open }); - }} - /> - {}}> - } - bodyClass="w-[40vw] h-[40vh] " - open={isTrfMo.isModal} - onOpenChange={(open) => { - setIsTrfMo({ 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 b47047d9a..428e1ec3b 100644 --- a/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx +++ b/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx @@ -73,7 +73,7 @@ export function ConstCostFeeTable({ return ( <> - +

공사비 산정표 보기

@@ -89,7 +89,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..1041785eb 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,19 @@ export function RateFeeTableModal({ return acc; }, []); + + console.log(' data ', data) 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 +80,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); - }} > ) : ( From 8ac291dda645d9794f3c866a85b7168a71385ad0 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Mon, 23 Jun 2025 14:24:13 +0900 Subject: [PATCH 03/12] =?UTF-8?q?=EB=B9=97=EB=AC=BC/=EC=A4=91=EC=88=98?= =?UTF-8?q?=EB=8F=84/=EC=98=A8=EB=B0=B0=EC=88=98=20=EC=8B=9C=EC=84=A4?= =?UTF-8?q?=ED=98=84=ED=99=A9=20=EC=97=91=EC=85=80=20=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EC=8B=9C=EB=8F=84=EB=AA=85=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/fcltSttn/htdflSttn/page.tsx | 3 +- .../ruseFcltMng/fcltSttn/rainSttn/page.tsx | 8 ++--- .../ruseFcltMng/fcltSttn/rswtSttn/page.tsx | 35 ++++++++----------- .../ruseFcltMng/fcltSttn/htdflSttn/excel.tsx | 22 +++++++----- .../fcltSttn/htdflSttn/headList.tsx | 32 ++--------------- .../ruseFcltMng/fcltSttn/rainSttn/excel.tsx | 19 ++++++---- .../ruseFcltMng/fcltSttn/rainSttn/index.tsx | 9 +++-- .../ruseFcltMng/fcltSttn/rswtSttn/excel.tsx | 20 +++++++---- .../ruseFcltMng/fcltSttn/rswtSttn/index.tsx | 14 ++++---- 9 files changed, 73 insertions(+), 89 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx index a738b73cc..e43d5b04f 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx @@ -71,7 +71,7 @@ export default function HtdflSttn() { if (htdflSttn.excelList.length > 0) { if (htdflSttn.excelList.length === 0) return; const excelData = await tableData(htdflSttn.excelList, { code }); - const htdflExcel = excelHtdflSttnParsing(excelData); + const htdflExcel = excelHtdflSttnParsing(excelData, code.cityCd, code.sggCd); excelDownload( htdflExcel as [[]], "온배수시설 현황", @@ -91,7 +91,6 @@ export default function HtdflSttn() { useEffect(() => { if (htdflSttnRes.length > 0 && code.cityCd.length > 0) { - console.log("htdflSttnRes", htdflSttnRes); const data = tableData(htdflSttnRes, { code }); const chData = data .map((item: any) => ({ diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx index 88b3c8649..631e24350 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx @@ -95,7 +95,7 @@ export default function RainSttn() { }, [code, rainSttnRes, rainSttn.rainSttHeadList]); useEffect(() => { - if (codeData != null) rainSttnSearch(pageNation, "20", codeData); + if (codeData != null) rainSttnSearch(pageNation, "20", codeData, code.cityCd, code.sggCd); }, [pageNation]); useEffect(() => { @@ -111,8 +111,8 @@ export default function RainSttn() { }, [rainSttn.excelList]); const excelClick = useCallback(() => { - if (codeData) rainSttnSearch(1, "10000", codeData); - }, [rainSttnSearch, codeData]); + if (codeData) rainSttnSearch(1, "10000", codeData, code.cityCd, code.sggCd); + }, [rainSttnSearch, codeData, code.cityCd, code.sggCd]); return ( <> @@ -146,7 +146,7 @@ export default function RainSttn() { } else { con = returnType.sidoValue; } - rainSttnSearch(1, "20", con); + rainSttnSearch(1, "20", con, code.cityCd, code.sggCd); }} excelClick={excelClick} initClick={function (): void { }} diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx index 2cecd8e91..7a3444a9b 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx @@ -42,7 +42,6 @@ export default function RswtSttn() { const codeCityOrSgg = getCityOrSgg(ref); - const cellClick = (index: number | undefined, headId: string) => { if (headId !== 'chBuildingYn' && index !== undefined && bdstTable !== undefined) { @@ -57,7 +56,6 @@ export default function RswtSttn() { setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding }); } } - } useEffect(() => { @@ -100,13 +98,13 @@ export default function RswtSttn() { const excelClick = useCallback( (returnType: ReturnType) => { if (codeCityOrSgg) - rswtSttnSearch(1, "10000", codeCityOrSgg); + rswtSttnSearch(1, "10000", codeCityOrSgg, code.cityCd, code.sggCd); }, - [rswtSttnSearch, codeCityOrSgg] + [rswtSttnSearch, code.cityCd, code.sggCd, codeCityOrSgg] ); useEffect(() => { - if (codeCityOrSgg != null) rswtSttnSearch(pageNation, "20", codeCityOrSgg); + if (codeCityOrSgg != null) rswtSttnSearch(pageNation, "20", codeCityOrSgg, code.cityCd, code.sggCd); }, [pageNation]); return ( @@ -122,27 +120,24 @@ export default function RswtSttn() { selectUnitWaterShedData={code.lgbsnCd} selectMiddleRegionData={code.mdmbsnCd} selectEnvPartData={code.lclgvrnmntCd} - rightChildren={ - - } + rightChildren={} leftChildren={undefined} queryClick={function (returnType: ReturnType): void { // '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}' if (codeCityOrSgg) - rswtSttnSearch(1, "20", codeCityOrSgg); - }} + rswtSttnSearch(1, "20", codeCityOrSgg, code.cityCd, code.sggCd); + } } excelClick={excelClick} - initClick={function (): void { }} + initClick={function (): void { } } btnClass={btnClass} - ref={ref} - /> + ref={ref} isAdmin={false} />
diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel.tsx index 671eacae8..591623911 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel.tsx @@ -1,30 +1,34 @@ +import type { SelectDataType } from "@common/business_components/ui"; import type { customHtdflBdst } from "../../fcltReg/htdflReg"; -export const excelHtdflSttnParsing = (data: customHtdflBdst[]): string[][] => { +export const excelHtdflSttnParsing = ( + data: customHtdflBdst[], + sidoCode: SelectDataType[], + sggCode: SelectDataType[] +): string[][] => { const excelExportData: string[][] = []; data.forEach((item) => { excelExportData.push([ - String(item.cityText??""), - String(item.sggText??""), + sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "", + sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "", item.bdstNm ?? "", item.daddr ?? "", String(item.frstArchPrmsnDt ?? ""), String(item.reuseBuilding?.[0]?.htdflObj.etgtType ?? ""), String(item.reuseBuilding?.[0]?.htdflObj.fclCpct ?? ""), // fix: added missing parenthesis - String(item.reuseBuilding?.[0]?.htdflObj.plwtYn ? "Y" :"N"), // fix: added missing parenthesis + String(item.reuseBuilding?.[0]?.htdflObj.plwtYn ? "Y" : "N"), // fix: added missing parenthesis String(item.reuseBuilding?.[0]?.htdflObj.orgwtWtritSpt ?? ""), // fix: added missing parenthesis String(item.reuseBuilding?.[0]?.htdflObj.wtritEntrcTp ?? ""), // fix: removed as it doesn't exist in the provided context String(item.reuseBuilding?.[0]?.htdflObj.orgwtOcrnProcs ?? ""), // fix: removed as it doesn't exist in the provided context - String( item.reuseBuilding?.[0]?.htdflObj?.amtgnr ?? ""), // fix: removed as it doesn't exist in the provided context + String(item.reuseBuilding?.[0]?.htdflObj?.amtgnr ?? ""), // fix: removed as it doesn't exist in the provided context String(item.reuseBuilding?.[0]?.htdflObj?.prcsProcsYn ?? ""), // fix: removed as it doesn't exist in the provided context - String( '컬럼확인'), // fix: removed as it doesn't exist in the provided context String(item.reuseBuilding?.[0]?.htdflObj?.prcsFcltCpct ?? ""), // fix: removed as it doesn't exist in the provided context String(item.reuseBuilding?.[0]?.htdflObj?.fmYn ?? ""), // fix: removed as it doesn't exist in the provided context String(item.reuseBuilding?.[0]?.htdflObj?.utztnCpct ?? ""), // fix: removed as it doesn't exist in the provided context String(item.reuseBuilding?.[0]?.htdflObj?.utztnUsg ?? ""), // fix: removed as it doesn't exist in the provided context String(item.reuseBuilding?.[0]?.htdflObj?.emsnExitTp ?? ""), // fix: removed as it doesn't exist in the provided context - ]); - }); - return excelExportData; + ]); + }); + return excelExportData; }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/headList.tsx index 8de673f16..756c47b9b 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/headList.tsx @@ -70,13 +70,6 @@ export const htdflSttHeadListExport: z.infer = [ title: "처리공정여부", visible: true, }, - { - id: "prcsProcstest", - title: "처리공정여부??", - visible: true, - }, - - { id: "prcsFcltCpct", title: "처리시설용량(m³)", @@ -259,36 +252,15 @@ export const htdflSttNodeListExport: CommonTableProps[] = [ rowSpan: 2, colSpan: 1, }, - { - id: "prcsProcs", - title: "처리공정", - upName: "htdflMngInfo", - visible: true, - row: 2, - rowSpan: 1, - colSpan: 2, - }, { id: "prcsProcsYn", title: "처리공정여부", upName: "prcsProcs", visible: true, - row: 3, - rowSpan: 1, + row: 2, + rowSpan: 2, colSpan: 1, }, - - { - id: "prcsProcstest", - title: "처리공정여부??", - upName: "prcsProcs", - visible: true, - row: 3, - rowSpan: 1, - colSpan: 1, - }, - - { id: "prcsFcltCpct", title: "처리시설용량(m³)", diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx index 8ae786488..13530a81f 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx @@ -1,18 +1,23 @@ +import type { SelectDataType } from "@common/business_components/ui"; import type { customRainBdst } from "../../fcltReg/rainReg"; -export const excelRainSttnParsing = (data: customRainBdst[]): string[][] => { +export const excelRainSttnParsing = ( + data: customRainBdst[], + sidoCode: SelectDataType[], + sggCode: SelectDataType[] +): string[][] => { const excelExportData: string[][] = []; data.forEach((item) => { excelExportData.push([ - String(item.ctpvCd), - String(item.sggCd), + sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "", + sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "", item.bdstNm ?? "", item.daddr ?? "", String(item.bdstInfoPk ?? ""), String(item.frstArchPrmsnDt ?? ""), String(item.archArea ?? ""), - String(item.chgBuilding.length>0 ? "Y" :"N"), + String(item.chgBuilding.length > 0 ? "Y" : "N"), String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""), String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""), String(item.reuseBuilding?.[0]?.instlCst ?? ""), @@ -28,8 +33,8 @@ export const excelRainSttnParsing = (data: customRainBdst[]): string[][] => { String(item.reuseBuilding?.[0]?.grntchBdstCertYr ?? ""), String(item.reuseBuilding?.[0]?.grntchBdstCertNo ?? ""), String(item.reuseBuilding?.[0]?.grntchBdstCertGrd ?? "") - ]); - }); - return excelExportData; + ]); + }); + return excelExportData; }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx index 853298d51..5aa54ee48 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx @@ -13,6 +13,7 @@ import { } from "./headList"; import type { z } from "zod"; import type { CommonTableProps } from "@/app/store/common/type/header"; +import type { SelectDataType } from "@common/business_components/ui"; // 테이블 헤드 리스트 const rainSttHeadList = rainSttHeadListExport; @@ -101,7 +102,7 @@ export type rainSttnState = { }; type rainSttnActions = { rainSttnInit:(con:string) => void - rainSttnSearch: (page: number, total: string, con: string) => void; + rainSttnSearch: (page: number, total: string, con: string, sidoCode: SelectDataType[], sggCode: SelectDataType[]) => void; rainChSttnHead: ( headList: z.infer, ) => void; @@ -148,14 +149,16 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = ( console.log(e) } }, - rainSttnSearch: async (page: number, total: string, con: string) => { + rainSttnSearch: async (page: number, total: string, con: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => { try { const rainSttnRes = await getFetch( fetchType.WR, `/reuseFc/rainyInfoList/${page}/${total}/${con}` ); if (Number(total) > 9000) { - const rainExcel = excelRainSttnParsing(rainSttnRes); + const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode); set((state: rainSttnState) => { return { ...state, diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx index 5c0ecf0b3..ac57a8016 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx @@ -1,19 +1,25 @@ +import type { SelectDataType } from "@common/business_components/ui"; import type { customRswtBdst } from "../../fcltReg/rswtReg"; +import { useWrStore } from "@/app/store"; -export const excelRSwtSttnParsing = (data: customRswtBdst[]): string[][] => { +export const excelRSwtSttnParsing = ( + data: customRswtBdst[], + sidoCode: SelectDataType[], + sggCode: SelectDataType[] +): string[][] => { const excelExportData: string[][] = []; data.forEach((item) => { excelExportData.push([ - String(item.ctpvCd), - String(item.sggCd), + sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "", + sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "", item.bdstNm ?? "", item.daddr ?? "", String(item.bdstUsgText ?? ""), String(item.frstArchPrmsnDt ?? ""), String(item.archArea ?? ""), String(item.reuseBuilding?.[0]?.rswtrObj.wtrUsqty ?? "0"), //물사용량 - String(item.chgBuilding.length>0 ? "Y" :"N"), //중축・개축・재축여부 + String(item.chgBuilding.length > 0 ? "Y" : "N"), //중축・개축・재축여부 String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""), //법적의무대상여부 String(item.reuseBuilding?.[0]?.rswtrObj.oblgTrgtWtrUsqty ?? ""), //의무대상물사용량 String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""), //설치완료일시 @@ -28,7 +34,7 @@ export const excelRSwtSttnParsing = (data: customRswtBdst[]): string[][] => { String(item.reuseBuilding?.[0]?.grntchBdstCertYr ?? ""), String(item.reuseBuilding?.[0]?.grntchBdstCertNo ?? ""), String(item.reuseBuilding?.[0]?.grntchBdstCertGrd ?? "") - ]); - }); - return excelExportData; + ]); + }); + return excelExportData; }; \ No newline at end of file diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx index 775e22e0c..301cd965e 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx @@ -6,6 +6,7 @@ import { controlHeadView } from "../rainSttn"; import type { sttnHeadListType } from "../rainSttn/headList"; import { excelRSwtSttnParsing } from "./excel"; import { rswtSttHeadListExport, rswtSttNodeListExport } from "./headList"; +import type { SelectDataType } from "@common/business_components/ui"; @@ -26,11 +27,10 @@ export type rswtSttnState = { }; }; - - type rswtSttnActions = { rswtSttnInit: (con: string) => void; - rswtSttnSearch: (page: number, total: string, con: string) => void; + rswtSttnSearch: (page: number, total: string, con: string, sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => void; rswtChSttnHead: ( headList: z.infer, ) => void; @@ -38,8 +38,6 @@ type rswtSttnActions = { export type rswtSttnType = rswtSttnState & rswtSttnActions; - - export const rswtSttnStateExport: rswtSttnState = { rswtSttn: { rswtSttHeadList: rswtSttHeadList, @@ -77,14 +75,16 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = ( console.log(e) } }, - rswtSttnSearch: async (page: number, total: string, con: string) => { + rswtSttnSearch: async (page: number, total: string, con: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => { try { const rswtSttnRes = await getFetch( fetchType.WR, `/reuseFc/waterreuseFc/${page}/${total}/${con}` ); if (Number(total) > 9000) { - const rswtExcel = excelRSwtSttnParsing(rswtSttnRes); + const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode); set((state: rswtSttnState) => { return { ...state, From 5b48dcaeaadaaecb540c839b7155311214172956 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Mon, 23 Jun 2025 17:46:50 +0900 Subject: [PATCH 04/12] =?UTF-8?q?=EC=88=98=EC=9A=94=20=EB=A7=A4=EC=B9=AD?= =?UTF-8?q?=20=EB=B0=8F=20=EC=9E=AC=EC=9D=B4=EC=9A=A9=20=EA=B2=80=ED=86=A0?= =?UTF-8?q?=20=EC=9D=B4=EB=A0=A5=20=EC=A0=80=EC=9E=A5=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20=EB=B0=8F=20=EC=8B=A4=EC=A0=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/coMatRvw/page.tsx | 6 +- .../wr/app/matMng/coMat/ruseRvwHstry/page.tsx | 7 +-- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 4 +- apps/wr/app/store/matDmd/coMatRvw/type.tsx | 4 +- .../app/store/matDmd/ruseRvwHstry/index.tsx | 29 +++++++-- .../store/prfmncReg/pbnstPrfmncReg/type.tsx | 6 +- .../ruseFcltMng/fcltReg/pbnstReg/type.tsx | 6 +- apps/wr/components/lib/config/index.ts | 2 +- .../ui/form/coMat/conCostForm/conCostForm.tsx | 60 +++++++------------ .../ui/modal/coMat/constCostFeeTable.tsx | 1 - .../ui/modal/coMat/rateFeeModal.tsx | 1 - 11 files changed, 63 insertions(+), 63 deletions(-) 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 4d0d4ea54..2d339b869 100644 --- a/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx @@ -121,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); @@ -135,7 +135,7 @@ export default function RuseRvwHstry() { - + +

기본사항

@@ -349,7 +346,7 @@ export default function ConCostForm({
( -
- - -
diff --git a/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx b/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx index 428e1ec3b..efd47c69b 100644 --- a/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx +++ b/apps/wr/components/ui/modal/coMat/constCostFeeTable.tsx @@ -61,7 +61,6 @@ export function ConstCostFeeTable({ }, [] ); - console.log("tableData", tableData); const formattedTableData = tableData?.map((item: ContCostMap) => { return { ...item, diff --git a/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx b/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx index 1041785eb..ee82420a8 100644 --- a/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx +++ b/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx @@ -59,7 +59,6 @@ export function RateFeeTableModal({ }, []); - console.log(' data ', data) const dataGubun = data?.map((item: any) => { return { ...item, From f82b90b3fa63770e43c9e758645a3d1132db3707 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Mon, 23 Jun 2025 17:48:38 +0900 Subject: [PATCH 05/12] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=A4?= =?UTF-8?q?=EC=A0=81=20=ED=98=84=ED=99=A9=20effect=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prfmncSttn/pbnstPrfmncSttn/page.tsx | 508 ++++++++---------- .../prfmncSttn/pbnstPrfmncSttn/index.tsx | 3 +- 2 files changed, 224 insertions(+), 287 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx index 74c566c03..7fb399f6d 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx @@ -3,20 +3,25 @@ import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; import { initValInUsage, initValOutUsage, subTotalObj, totalObj, type FcPrfType, type PrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type"; -import { yearOptions } from "@/components/lib/func/commom"; -import { InputTableBody } from "@/components/lib/func/TableData"; -import { ContentsDiv, Title, SearchBaseForm, SelectBox, SearchInput, UiTable, type ReturnType, MainChart, type ChartConfig, CHART_FORM, ScrollArea } from "@common/business_components"; -import DoughnutChart from "@common/business_components/ui/chart/DoughnutChart"; +import { excelDownload, yearOptions } from "@/components/lib/func/commom"; +import SearchInputText from "@/components/ui/searchInput/searchInput"; +import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components"; import ListDiv from "@common/business_components/ui/list_div"; -import { Button, Label, Table, TableBody, TableHeader } from "@common/components/ui"; -import { useEffect, useRef, useState } from "react"; -import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/TableHead"; +import { Button, Label } from "@common/components/ui"; +import { useCallback, useEffect, useRef, useState } from "react"; import toast, { Toaster } from "react-hot-toast"; - - export default function PbnstPrfmncSttn() { - const { code, tableHeadMaker, pbnstPrfmncSttn, pbnstPrfmncInit, pbnstPrfmncSearch, prfmnc } = useWrStore((state) => state); + const { + code, + tableHeadMaker, + pbnstPrfmncSttn, + pbnstPrfmncInit, + pbnstPrfmncSearch, + prfmnc, + pbnstSttn, + pbnNmSearch + } = useWrStore((state) => state); const { monthHeadList } = prfmnc const { pbnstPrfHeadList, pbnstPrfmncRes, prfmncRes, rawData, selectYearList } = pbnstPrfmncSttn; const [isChHead, setIsChHead] = useState(false); @@ -26,6 +31,16 @@ export default function PbnstPrfmncSttn() { const [bdstTable, setbdstTable] = useState(); const ref = useRef({} as ReturnType); const [swtrmtFcltNm, setSwtrmtFcltNm] = useState(); + const [pbnRuseNm, setPbnRuseNm] = useState(""); + const excelClick = useCallback(() => { + excelDownload( + [[]], + "하수재이용실적 현황", + "sample_pbnstPrfmncReg.xlsx", + "A1:O1" + ); + }, [prfmnc.excelList]); + const [chartConfig, setChartConfig] = useState({}); const [chartData, setChartData] = useState([]); const [dnInUsage, setDnInUsage] = useState([]); @@ -48,7 +63,6 @@ export default function PbnstPrfmncSttn() { chartData8: lineChartDataProps[]; chartData9: lineChartDataProps[]; }>(); - // const [lnInChartConfig, setLnInChartConfig] = useState({}); const [outLineData, setOutLineData] = useState<{ chartData1: lineChartDataProps[]; chartData2: lineChartDataProps[]; @@ -64,15 +78,14 @@ export default function PbnstPrfmncSttn() { type barChartForm = { label: string, "장내용수": number, "장외용수": number }; type lineChartDataProps = { label: string, val: number, color: string }; - const prfTableData = (prfList: PrfType[], year:string) => { + const prfTableData = (prfList: PrfType[], year: string) => { const inUsageData = initValInUsage; const outUsageData = initValOutUsage; const inSubtotal = subTotalObj; const outSubtotal = subTotalObj; - console.log(' prfList ', prfList) - const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year) + const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year) if (prfList && prfFilter.length > 0) { prfList?.forEach((prfItem) => { const month = Number(prfItem?.ym?.slice(4)); // "MM" @@ -119,71 +132,190 @@ export default function PbnstPrfmncSttn() { } const tableData = [...inUsageData, ...outUsageData, usageTotalObj]; setPrfData(tableData); - + } else { setPrfData([]); } } + useEffect(() => { - let wshwtr = 0; - let coolUswtr = 0; - let cleanUswtr = 0; - let drwtUswtr = 0; - let dltnUswtr = 0; - let ithlRswtr = 0; - let ithlEtcUswtr = 0; - let cleanToilUswtr = 0; - let resn = 0; - let lndwtr = 0; - let hydUswtr = 0; - let ugwtChr = 0; - let farmUswtr = 0; - let rvrKeepUswtr = 0; - let indstUswtr = 0; + // 누적 변수 초기화 + let wshwtr = 0, + coolUswtr = 0, + cleanUswtr = 0, + drwtUswtr = 0, + dltnUswtr = 0, + ithlRswtr = 0, + ithlEtcUswtr = 0, + cleanToilUswtr = 0, + resn = 0; + + let lndwtr = 0, + hydUswtr = 0, + ugwtChr = 0, + farmUswtr = 0, + rvrKeepUswtr = 0, + indstUswtr = 0; + + let inUsageSum = 0, + outUsageSum = 0; + + let inUsageArr: number[] = [], + outUsageArr: number[] = []; + + // 라인차트용 데이터 + const wshwtrData: lineChartDataProps[] = [], + coolUswtrData: lineChartDataProps[] = [], + cleanUswtrData: lineChartDataProps[] = [], + drwtUswtrData: lineChartDataProps[] = [], + dltnUswtrData: lineChartDataProps[] = [], + ithlRswtrData: lineChartDataProps[] = [], + ithlEtcUswtrData: lineChartDataProps[] = [], + cleanToilUswtrData: lineChartDataProps[] = [], + resnData: lineChartDataProps[] = []; + const lndwtrData: lineChartDataProps[] = [], + hydUswtrData: lineChartDataProps[] = [], + ugwtChrData: lineChartDataProps[] = [], + farmUswtrData: lineChartDataProps[] = [], + rvrKeepUswtrData: lineChartDataProps[] = [], + indstUswtrData: lineChartDataProps[] = []; + + // 막대차트 데이터 + const barData: barChartForm[] = []; + + // 도넛차트 데이터 + const dnData: dnChartForm[] = []; + const dnInData: dnChartForm[] = []; + const dnOutData: dnChartForm[] = []; + if (rawData) { rawData.forEach((item) => { + // 실적 테이블 데이터 prfTableData(item.prfList, year); - item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => { - - wshwtr += element.wshwtr; //세척수 - coolUswtr += element.coolUswtr; //냉각수 - cleanUswtr += element.cleanUswtr; //청소수 - drwtUswtr += element.drwtUswtr; //식수대 - dltnUswtr += element.dltnUswtr //희석용수 - ithlRswtr += element.ithlRswtr //중수도 - ithlEtcUswtr += element.ithlEtcUswtr //기타 - cleanToilUswtr += element.cleanToilUswtr //청소화장실용수 - resn += element.resn //세척살수용수 - lndwtr += element.lndwtr; //조경용수 - hydUswtr += element.hydUswtr; //친수용수 - ugwtChr += element.ugwtChr; //지하수충전 - farmUswtr += element.farmUswtr //농업용수 - rvrKeepUswtr += element.rvrKeepUswtr //하천등유지용수 - indstUswtr += element.indstUswtr //공업용수 + item.prfList.filter((e) => e.ym.slice(0, 4) === year).forEach((element) => { + // 누적 + wshwtr += element.wshwtr; + coolUswtr += element.coolUswtr; + cleanUswtr += element.cleanUswtr; + drwtUswtr += element.drwtUswtr; + dltnUswtr += element.dltnUswtr; + ithlRswtr += element.ithlRswtr; + ithlEtcUswtr += element.ithlEtcUswtr; + cleanToilUswtr += element.cleanToilUswtr; + resn += element.resn; + lndwtr += element.lndwtr; + hydUswtr += element.hydUswtr; + ugwtChr += element.ugwtChr; + farmUswtr += element.farmUswtr; + rvrKeepUswtr += element.rvrKeepUswtr; + indstUswtr += element.indstUswtr; + // 월별 합계 + inUsageSum = element.wshwtr + + element.coolUswtr + + element.cleanUswtr + + element.drwtUswtr + + element.dltnUswtr + + element.ithlRswtr + + element.ithlEtcUswtr + + element.cleanToilUswtr + + element.resn; + outUsageSum = element.lndwtr + + element.hydUswtr + + element.ugwtChr + + element.farmUswtr + + element.rvrKeepUswtr + + element.indstUswtr; + inUsageArr.push(inUsageSum); + outUsageArr.push(outUsageSum); + + // 막대차트 + const month = Number(element.ym.slice(4, 6)); + barData.push({ label: `${month}월`, "장내용수": inUsageSum, "장외용수": outUsageSum }); + + // 라인차트 + wshwtrData.push({ label: `${month}월`, val: element.wshwtr, color: "red" }); + coolUswtrData.push({ label: `${month}월`, val: element.coolUswtr, color: "orange" }); + cleanUswtrData.push({ label: `${month}월`, val: element.cleanUswtr, color: "yellow" }); + drwtUswtrData.push({ label: `${month}월`, val: element.drwtUswtr, color: "pink" }); + dltnUswtrData.push({ label: `${month}월`, val: element.dltnUswtr, color: "purple" }); + ithlRswtrData.push({ label: `${month}월`, val: element.ithlRswtr, color: "green" }); + ithlEtcUswtrData.push({ label: `${month}월`, val: element.ithlEtcUswtr, color: "blue" }); + cleanToilUswtrData.push({ label: `${month}월`, val: element.cleanToilUswtr, color: "magenta" }); + resnData.push({ label: `${month}월`, val: element.resn, color: "skyblue" }); + + lndwtrData.push({ label: `${month}월`, val: element.lndwtr, color: "red" }); + hydUswtrData.push({ label: `${month}월`, val: element.hydUswtr, color: "orange" }); + ugwtChrData.push({ label: `${month}월`, val: element.ugwtChr, color: "yellow" }); + farmUswtrData.push({ label: `${month}월`, val: element.farmUswtr, color: "green" }); + rvrKeepUswtrData.push({ label: `${month}월`, val: element.rvrKeepUswtr, color: "blue" }); + indstUswtrData.push({ label: `${month}월`, val: element.indstUswtr, color: "purple" }); }); - }) - const data: dnChartForm[] = [] - data?.push({ label: "세척수", val: wshwtr, fill: "red" }) - data?.push({ label: "냉각수", val: coolUswtr, fill: "orange" }) - data?.push({ label: "청소수", val: cleanUswtr, fill: "yellow" }) - data?.push({ label: "식수대", val: drwtUswtr, fill: "green" }) - data?.push({ label: "희석용수", val: dltnUswtr, fill: "skyblue" }) - data?.push({ label: "중수도", val: ithlRswtr, fill: "blue" }) - data?.push({ label: "기타", val: ithlEtcUswtr, fill: "purple" }) - data?.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "red" }) - data?.push({ label: "세척살수용수", val: resn, fill: "orange" }) - data?.push({ label: "조경용수", val: lndwtr, fill: "yellow" }) - data?.push({ label: "친수용수", val: hydUswtr, fill: "green" }) - data?.push({ label: "지하수충전", val: ugwtChr, fill: "skyblue" }) - data?.push({ label: "농업용수", val: farmUswtr, fill: "blue" }) - data?.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "purple" }) - data?.push({ label: "공업용수", val: indstUswtr, fill: "black" }) - setChartData(data); - } - }, [rawData, year]) + }); + // 도넛차트 데이터 + dnData.push({ label: "세척수", val: wshwtr, fill: "red" }); + dnData.push({ label: "냉각수", val: coolUswtr, fill: "orange" }); + dnData.push({ label: "청소수", val: cleanUswtr, fill: "yellow" }); + dnData.push({ label: "식수대", val: drwtUswtr, fill: "green" }); + dnData.push({ label: "희석용수", val: dltnUswtr, fill: "skyblue" }); + dnData.push({ label: "중수도", val: ithlRswtr, fill: "blue" }); + dnData.push({ label: "기타", val: ithlEtcUswtr, fill: "purple" }); + dnData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "red" }); + dnData.push({ label: "세척살수용수", val: resn, fill: "orange" }); + dnData.push({ label: "조경용수", val: lndwtr, fill: "yellow" }); + dnData.push({ label: "친수용수", val: hydUswtr, fill: "green" }); + dnData.push({ label: "지하수충전", val: ugwtChr, fill: "skyblue" }); + dnData.push({ label: "농업용수", val: farmUswtr, fill: "blue" }); + dnData.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "purple" }); + dnData.push({ label: "공업용수", val: indstUswtr, fill: "black" }); + + // 장내용수 도넛 + dnInData.push({ label: "세척수", val: wshwtr, fill: "yellow" }); + dnInData.push({ label: "냉각수", val: coolUswtr, fill: "green" }); + dnInData.push({ label: "청소수", val: cleanUswtr, fill: "yellow" }); + dnInData.push({ label: "식수대", val: drwtUswtr, fill: "green" }); + dnInData.push({ label: "희석용수", val: dltnUswtr, fill: "yellow" }); + dnInData.push({ label: "중수도", val: ithlRswtr, fill: "green" }); + dnInData.push({ label: "기타", val: ithlEtcUswtr, fill: "yellow" }); + dnInData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "green" }); + dnInData.push({ label: "세척살수용수", val: resn, fill: "yellow" }); + + // 장외용수 도넛 + dnOutData.push({ label: "조경용수", val: lndwtr, fill: "yellow" }); + dnOutData.push({ label: "친수용수", val: hydUswtr, fill: "black" }); + dnOutData.push({ label: "지하수충전", val: ugwtChr, fill: "yellow" }); + dnOutData.push({ label: "농업용수", val: farmUswtr, fill: "black" }); + dnOutData.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "yellow" }); + dnOutData.push({ label: "공업용수", val: indstUswtr, fill: "black" }); + + // 라인차트 데이터 + setInLineData({ + chartData1: wshwtrData, + chartData2: coolUswtrData, + chartData3: cleanUswtrData, + chartData4: drwtUswtrData, + chartData5: dltnUswtrData, + chartData6: ithlRswtrData, + chartData7: ithlEtcUswtrData, + chartData8: cleanToilUswtrData, + chartData9: resnData + }); + setOutLineData({ + chartData1: lndwtrData, + chartData2: hydUswtrData, + chartData3: ugwtChrData, + chartData4: farmUswtrData, + chartData5: rvrKeepUswtrData, + chartData6: indstUswtrData, + }); + setBarData(barData); + setChartData(dnData); + setDnInUsage(dnInData); + setDnOutUsage(dnOutData); + } + }, [rawData, year]); useEffect(() => { const newChartConfig = chartData.reduce((config, element) => { @@ -196,46 +328,6 @@ export default function PbnstPrfmncSttn() { setChartConfig(newChartConfig); }, [chartData]); - // 장내용수 도넛차트 - useEffect(() => { - let wshwtr = 0; - let coolUswtr = 0; - let cleanUswtr = 0; - let drwtUswtr = 0; - let dltnUswtr = 0; - let ithlRswtr = 0; - let ithlEtcUswtr = 0; - let cleanToilUswtr = 0; - let resn = 0; - if (rawData) { - rawData.forEach((item) => { - item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => { - - wshwtr += element.wshwtr; //세척수 - coolUswtr += element.coolUswtr; //냉각수 - cleanUswtr += element.cleanUswtr; //청소수 - drwtUswtr += element.drwtUswtr; //식수대 - dltnUswtr += element.dltnUswtr //희석용수 - ithlRswtr += element.ithlRswtr //중수도 - ithlEtcUswtr += element.ithlEtcUswtr //기타 - cleanToilUswtr += element.cleanToilUswtr //청소화장실용수 - resn += element.resn //세척살수용수 - }); - }) - const data: dnChartForm[] = [] - data?.push({ label: "세척수", val: wshwtr, fill: "yellow" }) - data?.push({ label: "냉각수", val: coolUswtr, fill: "green" }) - data?.push({ label: "청소수", val: cleanUswtr, fill: "yellow" }) - data?.push({ label: "식수대", val: drwtUswtr, fill: "green" }) - data?.push({ label: "희석용수", val: dltnUswtr, fill: "yellow" }) - data?.push({ label: "중수도", val: ithlRswtr, fill: "green" }) - data?.push({ label: "기타", val: ithlEtcUswtr, fill: "yellow" }) - data?.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "green" }) - data?.push({ label: "세척살수용수", val: resn, fill: "yellow" }) - setDnInUsage(data); - } - }, [rawData, year]) - useEffect(() => { const newChartConfig = dnInUsage.reduce((config, element) => { config[element.label] = { @@ -247,37 +339,6 @@ export default function PbnstPrfmncSttn() { setDnInChartConfig(newChartConfig); }, [dnInUsage]); - // 장외용수 도넛차트 - useEffect(() => { - let lndwtr = 0; - let hydUswtr = 0; - let ugwtChr = 0; - let farmUswtr = 0; - let rvrKeepUswtr = 0; - let indstUswtr = 0; - if (rawData) { - rawData.forEach((item) => { - item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => { - lndwtr += element.lndwtr; //조경용수 - hydUswtr += element.hydUswtr; //친수용수 - ugwtChr += element.ugwtChr; //지하수충전 - farmUswtr += element.farmUswtr //농업용수 - rvrKeepUswtr += element.rvrKeepUswtr //하천등유지용수 - indstUswtr += element.indstUswtr //공업용수 - - }); - }) - const data: dnChartForm[] = [] - data?.push({ label: "조경용수", val: lndwtr, fill: "yellow" }) - data?.push({ label: "친수용수", val: hydUswtr, fill: "black" }) - data?.push({ label: "지하수충전", val: ugwtChr, fill: "yellow" }) - data?.push({ label: "농업용수", val: farmUswtr, fill: "black" }) - data?.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "yellow" }) - data?.push({ label: "공업용수", val: indstUswtr, fill: "black" }) - setDnOutUsage(data); - } - }, [rawData, year]) - useEffect(() => { const newChartConfig = dnOutUsage.reduce((config, element) => { config[element.label] = { @@ -289,69 +350,6 @@ export default function PbnstPrfmncSttn() { setDnOutChartConfig(newChartConfig); }, [dnOutUsage]); - //월별 장내외 용수 총 실적 막대차트 - useEffect(() => { - let wshwtr = 0; - let coolUswtr = 0; - let cleanUswtr = 0; - let drwtUswtr = 0; - let dltnUswtr = 0; - let ithlRswtr = 0; - let ithlEtcUswtr = 0; - let cleanToilUswtr = 0; - let resn = 0; - let lndwtr = 0; - let hydUswtr = 0; - let ugwtChr = 0; - let farmUswtr = 0; - let rvrKeepUswtr = 0; - let indstUswtr = 0; - let inUsageSum = 0; - let outUsageSum = 0; - let inUsageArr = []; - let outUsageArr = []; - - - if (rawData) { - const data: barChartForm[] = [] - rawData.forEach((item) => { - item.prfList - .filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => { - - wshwtr = element.wshwtr; //세척수 - coolUswtr = element.coolUswtr; //냉각수 - cleanUswtr = element.cleanUswtr; //청소수 - drwtUswtr = element.drwtUswtr; //식수대 - dltnUswtr = element.dltnUswtr //희석용수 - ithlRswtr = element.ithlRswtr //중수도 - ithlEtcUswtr = element.ithlEtcUswtr //기타 - cleanToilUswtr = element.cleanToilUswtr //청소화장실용수 - resn = element.resn //세척살수용수 - - lndwtr = element.lndwtr; //조경용수 - hydUswtr = element.hydUswtr; //친수용수 - ugwtChr = element.ugwtChr; //지하수충전 - farmUswtr = element.farmUswtr //농업용수 - rvrKeepUswtr = element.rvrKeepUswtr //하천등유지용수 - indstUswtr = element.indstUswtr //공업용수 - - inUsageSum = wshwtr + coolUswtr + cleanUswtr + drwtUswtr + dltnUswtr + ithlRswtr + ithlEtcUswtr + cleanToilUswtr + resn; - inUsageArr.push(inUsageSum) - outUsageSum = lndwtr + hydUswtr + ugwtChr + farmUswtr + rvrKeepUswtr + indstUswtr; - outUsageArr.push(outUsageSum) - - const month = Number(element.ym.slice(4, 6)) - data.push({ label: `${month}월`, "장내용수": inUsageSum, "장외용수": outUsageSum }) - - }, - ); - - }) - - setBarData(data); - } - }, [rawData, year]) - useEffect(() => { const newChartConfig = barData.reduce((config, element) => { config[element.label] = { @@ -363,51 +361,6 @@ export default function PbnstPrfmncSttn() { setBarChartConfig(newChartConfig); }, [barData]); - //월별 장내 용수 실적 라인차트 - useEffect(() => { - - if (rawData) { - const wshwtrData: lineChartDataProps[] = [] - const coolUswtrData: lineChartDataProps[] = [] - const cleanUswtrData: lineChartDataProps[] = [] - const drwtUswtrData: lineChartDataProps[] = [] - const dltnUswtrData: lineChartDataProps[] = [] - const ithlRswtrData: lineChartDataProps[] = [] - const ithlEtcUswtrData: lineChartDataProps[] = [] - const cleanToilUswtrData: lineChartDataProps[] = [] - const resnData: lineChartDataProps[] = [] - rawData.forEach((item) => { - item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => { - const month = Number(element.ym.slice(4, 6)) - wshwtrData.push({ label: `${month}월`, val: element.wshwtr, color: "red" }) - coolUswtrData.push({ label: `${month}월`, val: element.coolUswtr, color: "red" }) - cleanUswtrData.push({ label: `${month}월`, val: element.cleanUswtr, color: "red" }) - drwtUswtrData.push({ label: `${month}월`, val: element.drwtUswtr, color: "red" }) - dltnUswtrData.push({ label: `${month}월`, val: element.dltnUswtr, color: "red" }) - ithlRswtrData.push({ label: `${month}월`, val: element.ithlRswtr, color: "red" }) - ithlEtcUswtrData.push({ label: `${month}월`, val: element.ithlEtcUswtr, color: "red" }) - cleanToilUswtrData.push({ label: `${month}월`, val: element.cleanToilUswtr, color: "red" }) - resnData.push({ label: `${month}월`, val: element.resn, color: "red" }) - - }, - ); - }) - const rtndata = { - chartData1: wshwtrData, - chartData2: coolUswtrData, - chartData3: cleanUswtrData, - chartData4: drwtUswtrData, - chartData5: dltnUswtrData, - chartData6: ithlRswtrData, - chartData7: ithlEtcUswtrData, - chartData8: cleanToilUswtrData, - chartData9: resnData - } - - setInLineData(rtndata) - } - }, [rawData, year]) - useEffect(() => { if (inLineData?.chartData1) { const newChartConfig = { @@ -452,37 +405,6 @@ export default function PbnstPrfmncSttn() { } }, [inLineData]); - //월별 장외 용수 실적 라인차트 - useEffect(() => { - if (rawData) { - const lndwtrData: lineChartDataProps[] = [] - const hydUswtrData: lineChartDataProps[] = [] - const ugwtChrData: lineChartDataProps[] = [] - const farmUswtrData: lineChartDataProps[] = [] - const rvrKeepUswtrData: lineChartDataProps[] = [] - const indstUswtrData: lineChartDataProps[] = [] - rawData.forEach((item) => { - item.prfList.filter((e) => e.ym.slice(0, 4) === year) .forEach((element) => { - const month = Number(element.ym.slice(4, 6)) - lndwtrData.push({ label: `${month}월`, val: element.lndwtr, color: "red" }) - hydUswtrData.push({ label: `${month}월`, val: element.hydUswtr, color: "red" }) - ugwtChrData.push({ label: `${month}월`, val: element.ugwtChr, color: "red" }) - farmUswtrData.push({ label: `${month}월`, val: element.farmUswtr, color: "red" }) - rvrKeepUswtrData.push({ label: `${month}월`, val: element.rvrKeepUswtr, color: "red" }) - indstUswtrData.push({ label: `${month}월`, val: element.indstUswtr, color: "red" }) - }, - ); - }) - setOutLineData({ - chartData1: lndwtrData, - chartData2: hydUswtrData, - chartData3: ugwtChrData, - chartData4: farmUswtrData, - chartData5: rvrKeepUswtrData, - chartData6: indstUswtrData, - }) - } - }, [rawData, year]) useEffect(() => { if (outLineData?.chartData1) { @@ -526,6 +448,16 @@ export default function PbnstPrfmncSttn() { setbdstTable(prfmncRes); }, [prfmncRes]); + const [searchYear, setSearchYear] = useState( + String(new Date().getFullYear()) + ); + + useEffect(() => { + if (pbnRuseNm.length > 1) + pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear); + }, [pbnRuseNm]); + + return ( <> @@ -566,13 +498,17 @@ export default function PbnstPrfmncSttn() { value={toDate} onSelectValue={(val: string | number) => setToDate(String(val))} /> - { - setSwtrmtFcltNm(e); - }} /> + { + setPbnRuseNm(searchNm || ""); + }} + setRtnData={function (rtnData: any[]): void { + setbdstTable(rtnData); + }} + searchList={pbnstSttn.pbnstSearchData || []} + > { }} + excelClick={excelClick} initClick={function (): void { }} btnClass={btnClass} ref={ref} isAdmin={false} /> @@ -680,7 +616,7 @@ export default function PbnstPrfmncSttn() { - + ) } diff --git a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx index e47301b48..8af811463 100644 --- a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx @@ -49,6 +49,7 @@ const hasuListFetch = async (page: string, sggOrCity: string) => { checkWrRegListRes?.fcltCds, fetchType.COMMON ); + console.log("api 호출", rainRes) const data = checkWrRegListRes.fcPrfList.map((item: FcPrfType) => { const findData = rainRes.data.find( (fclt: pubHasuType) => @@ -142,7 +143,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions bscFctCdList, `wr`, ) - + console.log("res", res) let inUsageSum = 0; let outUsageSum = 0; let usageSum = 0; From a7c8420e6a100d5034055496748d343283b379de Mon Sep 17 00:00:00 2001 From: swcho Date: Mon, 23 Jun 2025 18:20:04 +0900 Subject: [PATCH 06/12] =?UTF-8?q?feat:=20DatePicker=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20readOnly=20=EC=86=8D=EC=84=B1=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/date_picker/index.tsx | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/common/business_components/src/ui/date_picker/index.tsx b/packages/common/business_components/src/ui/date_picker/index.tsx index d3a6a05c1..9df32b3b5 100644 --- a/packages/common/business_components/src/ui/date_picker/index.tsx +++ b/packages/common/business_components/src/ui/date_picker/index.tsx @@ -12,37 +12,39 @@ import { FormControl } from "../form"; import { ko } from "date-fns/locale"; import { useState } from "react"; -type DatePickerProps = DayPickerSingleProps & { field: { value: Date; onChange: (date: Date | undefined) => void } ,selectClass:string|undefined }; - - -export function DatePicker({ field, selectClass }: DatePickerProps) { +type DatePickerProps = DayPickerSingleProps & { field: { value: Date; onChange: (date: Date | undefined) => void }, selectClass: string | undefined, readOnly?: boolean }; +export function DatePicker({ field, selectClass, readOnly = false, ...props }: DatePickerProps) { const [open, setOpen] = useState(false); const handleSelect = (date: Date | undefined) => { - field.onChange(date); // React Hook Form 업데이트 - setOpen(false); - }; + if (!readOnly) { // readOnly가 아닐 때만 변경 허용 + field.onChange(date); // React Hook Form 업데이트 + setOpen(false); + } + }; + return ( - + )} - /> + -
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
- ( - - - - )} - /> -
- -
-

- 온배수 시설 운영현황 -

-
+ {isModal && htdflForm != undefined ? : <>} + {isModal ? ( +

+ 온배수 시설 정보{" "} +

+ ) : ( + <> + )} -
-
- ( - - { - field.onChange(Number(e.target.value)); - }} - /> - - )} - /> -
-
- ( - - - - )} - /> -
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
- ( - - - - )} - /> -
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
- ( - - - - )} - /> -
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
- ( - - - - )} - /> -
-
+
+
+ ( + + { + if (!readonly) field.onChange(e) + }} + readOnly={readonly} + /> + + )} + /> +
-
-

- 요구수질 -

-
- -
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> +
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+
+ ( + + { } : field.onChange} + value={field.value ?? code.yn[0]?.val} + readOnly={readonly} + /> + + )} + /> +
+
+
+

+ 온배수 시설 운영현황 +

-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
- -
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> +
+
+ ( + + { + if (!readonly) field.onChange(Number(e.target.value)); + }} + readOnly={readonly} + /> + + )} + /> +
+
+ ( + + { + if (!readonly) field.onChange + }} + readOnly={readonly} + /> + + )} + /> +
+
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+
+ ( + + { } : field.onChange} + value={field.value ?? code.yn[0]?.val} + readOnly={readonly} + /> + + )} + /> +
+
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+
+ ( + + { } : field.onChange} + value={field.value ?? code.yn[0]?.val} + readOnly={readonly} + /> + + )} + /> +
+
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+
+ ( + + { + if (!readonly) field.onChange + }} + readOnly={readonly} + /> + + )} + /> +
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
- -
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> +
+

+ 요구수질 +

-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
+
+
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
-
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> +
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
+
+
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
-
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> +
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
+
+
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
-
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> +
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> +
+
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+ +
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
-
- - + +
+
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+ +
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+
+ +
+
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+ +
+ ( + + { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+
+ +
); } diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index 8c6f5f1db..48a0f5056 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -4,36 +4,36 @@ import { useWrStore } from "@/app/store"; import { rainZod, selectClass, - TEST_UUID, - type customRainBdst, + type customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; -import { DatePicker, FormUi } from "@common/business_components"; -import { Form, FormField, SelectBox } from "@common/business_components/ui"; -import { Button, Input } from "@common/components/ui"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useEffect, useState } from "react"; -import { useForm, useWatch, type UseFormReturn } from "react-hook-form"; -import { z } from "zod"; -import BdstReg from "../bdstReg/bdstReg"; +import { formH1Class, formH2Class } from "@/components/lib/class/comClass"; import { formatCommaNumber, handleCommaNumberChange, } from "@/components/lib/func/commom"; -import { formH1Class, formH2Class } from "@/components/lib/class/comClass"; +import { DatePicker, FormUi } from "@common/business_components"; +import { Form, FormField, SelectBox } from "@common/business_components/ui"; +import { Button, Input } from "@common/components/ui"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useEffect } from "react"; +import { useForm } from "react-hook-form"; +import { z } from "zod"; +import BdstReg from "../bdstReg/bdstReg"; export default function RainRegForm({ rainForm, isModal, + readonly = false }: { rainForm: customRainBdst; isModal: boolean; + readonly?: boolean; }) { const { code, rainBdstReg, rainBdstUpdate, rain } = useWrStore( (state) => state ); const { rainFcltCd } = code; const defaultValues: z.infer = rainZod.parse({}); - const form = useForm>({ resolver: zodResolver(rainZod), defaultValues: defaultValues, @@ -60,8 +60,8 @@ export default function RainRegForm({ typeof item?.grntchBdstCertYr === "string" ? item?.grntchBdstCertYr : "", // null → "" - rainObj: { - ...item?.rainObj, + rainyObj: { + ...item?.rainyObj, }, })), }; @@ -84,8 +84,7 @@ export default function RainRegForm({ useEffect(() => { const subscription = form.watch((value) => { }); - - + console.log("subscription:", subscription) return () => subscription.unsubscribe(); }, [form]); @@ -105,7 +104,6 @@ export default function RainRegForm({ if (rainZod) form.reset(cleanRainData(rainForm)); }, [rainForm]); - return (
@@ -115,9 +113,11 @@ export default function RainRegForm({

{isModal ? "건축물 운영정보" : "빗물이용시설 정보"}

- + {!readonly && ( + + )}
{isModal && rainForm != undefined ? : <>} @@ -149,6 +149,7 @@ export default function RainRegForm({ onChange: (date) => field.onChange(date), }} selectClass={"w-full"} + readOnly={readonly} /> )} @@ -166,9 +167,10 @@ export default function RainRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - handleCommaNumberChange(e, field.onChange); + if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} + readOnly={readonly} /> )} @@ -195,8 +197,9 @@ export default function RainRegForm({ selectClass={selectClass} label={""} selectArray={rainFcltCd} - onSelectValue={field.onChange} + onSelectValue={readonly ? () => { } : field.onChange} value={field.value ?? rainFcltCd[0]?.val} + readOnly={readonly} /> )} @@ -213,9 +216,10 @@ export default function RainRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - handleCommaNumberChange(e, field.onChange); + if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} + readOnly={readonly} /> )} @@ -238,8 +242,9 @@ export default function RainRegForm({ selectClass={selectClass} label={""} selectArray={code.yn} - onSelectValue={field.onChange} + onSelectValue={readonly ? () => { } : field.onChange} value={field.value ?? code.yn[0]?.val} + readOnly={readonly} /> )} @@ -256,7 +261,7 @@ export default function RainRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - handleCommaNumberChange(e, field.onChange); + if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={filtrTrtmfctYn !== "Y"} @@ -276,7 +281,9 @@ export default function RainRegForm({ placeholder="1,000,000" type="" value={field.value ?? ""} - onChange={field.onChange} + onChange={(e) => { + if (!readonly) handleCommaNumberChange(e, field.onChange); + }} readOnly={filtrTrtmfctYn !== "Y"} /> @@ -304,8 +311,9 @@ export default function RainRegForm({ selectClass={selectClass} label={""} selectArray={code.yn} - onSelectValue={field.onChange} + onSelectValue={readonly ? () => { } : field.onChange} value={field.value ?? code.yn[0]?.val} + readOnly={readonly} /> )} @@ -322,7 +330,7 @@ export default function RainRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - handleCommaNumberChange(e, field.onChange); + if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={instlCstSprtYn !== "Y"} @@ -348,7 +356,7 @@ export default function RainRegForm({ selectClass={selectClass} label={""} selectArray={code.yn} - onSelectValue={field.onChange} + onSelectValue={readonly ? () => { } : field.onChange} value={field.value ?? code.yn[0]?.val} /> @@ -366,7 +374,9 @@ export default function RainRegForm({ placeholder="2024" type="" value={field.value ?? ""} - onChange={field.onChange} + onChange={(e) => { + if (!readonly) field.onChange(e); + }} readOnly={grntchBdstCertYn !== "Y"} /> @@ -384,7 +394,9 @@ export default function RainRegForm({ placeholder="ab1234678" type="" value={field.value ?? ""} - onChange={field.onChange} + onChange={(e) => { + if (!readonly) field.onChange(e); + }} readOnly={grntchBdstCertYn !== "Y"} /> @@ -402,7 +414,9 @@ export default function RainRegForm({ placeholder="A" type="" value={field.value ?? ""} - onChange={field.onChange} + onChange={(e) => { + if (!readonly) field.onChange(e); + }} readOnly={grntchBdstCertYn !== "Y"} /> diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index f72e640e3..a4f29477a 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -28,9 +28,11 @@ import BdstReg from "../bdstReg/bdstReg"; export default function RswtrRegForm({ rswtForm, isModal, + readonly = false }: { rswtForm: customRswtBdst; isModal: boolean; + readonly?: boolean; }) { const { rswt, code, rswtBdstUpdate, rswtBdstReg } = useWrStore( (state) => state @@ -78,6 +80,10 @@ export default function RswtrRegForm({ }; }; + useEffect(()=>{ + console.log("rswtForm:", rswtForm) + }, [rswtForm]) + useEffect(() => { console.log("form errors:", form.formState.errors); }, [form.formState.errors]); @@ -105,13 +111,11 @@ export default function RswtrRegForm({

건축물 운영정보

- + {!readonly && ( + + )}
@@ -141,6 +145,7 @@ export default function RswtrRegForm({ onChange: (date) => field.onChange(date), }} selectClass={"w-full"} + readOnly={readonly} /> )} @@ -158,9 +163,10 @@ export default function RswtrRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - handleCommaNumberChange(e, field.onChange); + if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} + readOnly={readonly} /> )} @@ -179,9 +185,10 @@ export default function RswtrRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - handleCommaNumberChange(e, field.onChange); + if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} + readOnly={readonly} /> )} @@ -199,9 +206,10 @@ export default function RswtrRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - handleCommaNumberChange(e, field.onChange); + if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} + readOnly={readonly} /> )} @@ -225,8 +233,9 @@ export default function RswtrRegForm({ type="number" value={field.value ?? 0} onChange={(e) => { - field.onChange(Number(e.target.value)); + if (!readonly) field.onChange(Number(e.target.value)); }} + readOnly={readonly} /> )} @@ -243,8 +252,9 @@ export default function RswtrRegForm({ label={""} selectClass={selectClass} selectArray={code.orgwtKndCd} - onSelectValue={field.onChange} + onSelectValue={readonly ? () => { } : field.onChange} value={field.value ?? code.orgwtKndCd[0]?.val} + readOnly={readonly} /> )} @@ -261,7 +271,10 @@ export default function RswtrRegForm({ placeholder="" type="" value={field.value ?? ""} - onChange={field.onChange} + onChange={(e) => { + if (!readonly) field.onChange + }} + readOnly={readonly} /> )} @@ -287,8 +300,9 @@ export default function RswtrRegForm({ selectClass={selectClass} label={""} selectArray={code.yn} - onSelectValue={field.onChange} + onSelectValue={readonly ? () => { } : field.onChange} value={field.value ?? code.yn[0]?.val} + readOnly={readonly} /> )} @@ -305,7 +319,7 @@ export default function RswtrRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - handleCommaNumberChange(e, field.onChange); + if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={instlCstSprtYn !== "Y"} @@ -331,8 +345,9 @@ export default function RswtrRegForm({ selectClass={selectClass} label={""} selectArray={code.yn} - onSelectValue={field.onChange} + onSelectValue={readonly ? () => { } : field.onChange} value={field.value ?? code.yn[0]?.val} + readOnly={readonly} /> )} @@ -350,7 +365,9 @@ export default function RswtrRegForm({ type="text" {...field} value={field.value ?? ""} - onChange={field.onChange} + onChange={(e) => { + if (!readonly) field.onChange(e) + }} readOnly={grntchBdstCertYn !== "Y"} /> @@ -368,7 +385,9 @@ export default function RswtrRegForm({ placeholder="ab1234678" type="" value={field.value ?? ""} - onChange={field.onChange} + onChange={(e) => { + if (!readonly) field.onChange(e) + }} readOnly={grntchBdstCertYn !== "Y"} /> @@ -386,7 +405,9 @@ export default function RswtrRegForm({ placeholder="A" type="" value={field.value ?? ""} - onChange={field.onChange} + onChange={(e) => { + if (!readonly) field.onChange(e) + }} readOnly={grntchBdstCertYn !== "Y"} /> diff --git a/apps/wr/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal.tsx b/apps/wr/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal.tsx index 0ebd03ae2..0f7dbf706 100644 --- a/apps/wr/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal.tsx +++ b/apps/wr/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal.tsx @@ -90,10 +90,10 @@ export default function SttnDetailModal({ : "온배수시설 상세정보"}> 0?"h-[80vh]":"h-[70vh]"} > {type === "RNB" ? ( - + ) : type === "RST" ? ( - - ) : ()} + + ) : ()} {detailData.data.length>0? Date: Tue, 24 Jun 2025 19:14:47 +0900 Subject: [PATCH 12/12] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=20=EC=8B=9C=EC=84=A4=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 120 ++- .../store/prfmncReg/pbnstPrfmncReg/index.tsx | 12 +- .../ruseFcltMng/fcltReg/pbnstReg/index.tsx | 91 +- .../ruseFcltMng/fcltReg/pbnstReg/type.tsx | 4 +- .../fcltReg/pbnstReg/buseReg/bugRegForm.tsx | 986 +++++++++--------- .../fcltReg/pbnstReg/mngReg/mngRegForm.tsx | 72 +- .../ui/form/fcltReg/rainReg/rainRegForm.tsx | 2 + .../fcltReg/pbnstRegModal/pbnstRegModal.tsx | 50 +- .../ruseMngTableForm/ruseMngTableForm.tsx | 7 +- 9 files changed, 677 insertions(+), 667 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 3c489837d..7638e6cb4 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -42,14 +42,12 @@ export default function PublicReuseFaciltyInsert() { searchFclts, pubHasuInit, pbnstRegClick, - pbnstMngData, pbnstRuseFcltUpdate, pubHasuSearch, pbnstRuseBizUpdate, } = useWrStore((state) => state); const { pubFacHeadList, pbnstHasuRes, pbnstRes } = pbnst; const [currentTab, setCurrentTab] = useState("mng"); - const [pbnstBiz, setPbnstBiz] = useState(); const [isRuseReg, setIsRuseReg] = useState<{ isModal: boolean; data: pubHasuType; @@ -61,18 +59,12 @@ export default function PublicReuseFaciltyInsert() { const [bdstTable, setbdstTable] = useState(); const [selectRow, setSelectRow] = useState(); - // const form = useForm>({ - // resolver: zodResolver(pbnstRegArrayZod), - // defaultValues: pbnstRegArrayZod.parse([]), - // mode: "onChange", - // }); - const form = useForm<{ items: z.infer[]; }>({ resolver: zodResolver(z.object({ items: pbnstRegArrayZod })), - defaultValues: { items: pbnstRegArrayZod.parse([]) }, - mode:"onChange" + // defaultValues: { items: pbnstRegArrayZod.parse([]) }, + mode: "onChange", }); const { fields: items, @@ -84,21 +76,31 @@ export default function PublicReuseFaciltyInsert() { }); useEffect(() => { if (!pbnst.isInit) { - pubHasuInit("1", "11"); + pubHasuInit("1", "0"); } }, [pbnst.isInit, pubHasuInit]); const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => { - const data = writeRgtrAndMdfr(valuse.items); let bizs = [] as fcBizType[]; data.forEach((fclt) => { bizs = [...bizs, ...fclt.fcBizs]; }); + const pbnst =data.map((fclt) => { + return({ + pbnstRuseFcltPk: fclt.pbnstRuseFcltPk, + fcltCpct: fclt.fcltCpct, + ruseCpct: fclt.ruseCpct, + splyExtraCpct: fclt.splyExtraCpct, + rgtr: fclt.rgtr, + mdfr: fclt.mdfr, + fcFiles: fclt.fcFiles, + fcOpers: fclt.fcOpers, + }) + }) + await pbnstRuseFcltUpdate(pbnst as customPbnst[]); - await pbnstRuseFcltUpdate(data); - - await pbnstRuseBizUpdate(bizs); + await pbnstRuseBizUpdate(bizs); }; useEffect(() => { @@ -114,9 +116,8 @@ export default function PublicReuseFaciltyInsert() { const cellClick = (val: number | undefined) => { if (val === undefined) return; const selectRow = pbnstHasuRes?.[val]; - setSelectRow(pbnstHasuRes?.[val]) + setSelectRow(pbnstHasuRes?.[val]); if (selectRow) { - //setIsRuseReg({ ...isRuseReg, data: selectRow }); pbnstRegClick(selectRow); } }; @@ -126,8 +127,13 @@ export default function PublicReuseFaciltyInsert() { }; useEffect(() => { - if (pbnst.pbnstRes) { + if (pbnst.pbnstRes&& pbnst.pbnstRes?.length>0) { + console.log("pbnst.pbnstRes", pbnstRes); form.reset({ items: pbnstRegArrayZod.parse(pbnst.pbnstRes) }); + }else{ + + console.log("pbnst.pbnstRes is null", pbnstRes); + form.reset({ items: [] }); } }, [pbnst.pbnstRes]); useEffect(() => { @@ -137,39 +143,55 @@ export default function PublicReuseFaciltyInsert() { }, [indexMng]); useEffect(() => { - console.log("form errors:", form.formState.errors); - }, [form.formState.errors]); + console.log("form errors:", form.formState.errors); + }, [form.formState.errors]); + + const appendPbnstRuseFclt = useCallback(() => { + const selecTableRow = selectRow; - const appendPbnstRuseFclt = useCallback(() => { if (pbnstRes && pbnstRes.length > 0) { const lastPbnst = pbnstRes[pbnstRes.length - 1]; - console.log('lastPbnst.swtrmtFcltFk ', lastPbnst) - if(lastPbnst){ + if (lastPbnst && selecTableRow) { + append( pbnstRegZod.parse({ - pbnstRuseFcltPk: String(lastPbnst.pbnstRuseFcltPk) + String(pbnstRes.length + 1), + pbnstRuseFcltPk: + String(selecTableRow.bscFctCd) + String(pbnstRes.length + 1), ruseUtztnFcltNm: "", - fcBizs: [fcBizSchema.parse({pbnstRuseFcltFk:String(lastPbnst.pbnstRuseFcltPk) + String(pbnstRes.length + 1),cycl:1})] as fcBizType[], + fcBizs: [ + fcBizSchema.parse({ + pbnstRuseFcltFk: + String(lastPbnst.pbnstRuseFcltPk) + + String(pbnstRes.length + 1), + cycl: 1, + }), + ] as fcBizType[], }) ); - setIsRuseReg({ ...isRuseReg, isModal: true }) + setIsRuseReg({ ...isRuseReg, isModal: true }); } } else { - if(selectRow){ + if (selecTableRow) { append( - pbnstRegZod.parse({ - pbnstRuseFcltPk: String(selectRow.bscFctCd)+'1', - ruseUtztnFcltNm: "", - regDt: null, - mdfcnDt: null, - fcBizs: [fcBizSchema.parse({pbnstRuseFcltFk:String(selectRow.bscFctCd)+'1',cycl:1})] as fcBizType[], - }) - ); - setIsRuseReg({ ...isRuseReg, isModal: true }) + pbnstRegZod.parse({ + pbnstRuseFcltPk: String(selecTableRow.bscFctCd)+'1', + ruseUtztnFcltNm: "", + regDt: null, + mdfcnDt: null, + fcBizs: [fcBizSchema.parse({pbnstRuseFcltFk:String(selecTableRow.bscFctCd)+'1',cycl:1})] as fcBizType[], + }) + ) + setIsRuseReg({ ...isRuseReg, isModal: true }); } } - },[pbnstRegZod,pbnstRes,append,selectRow]) + }, [pbnstRegZod, pbnstRes, append, selectRow, form]); + useEffect(() => { + // console.log(" page getgetvaslue ", form.getValues()); + }, [form.getValues()]); + + + return ( <> @@ -192,8 +214,8 @@ export default function PublicReuseFaciltyInsert() { size={"sm"} onClick={(e) => { searchTxt && searchTxt?.length > 0 - ? pubHasuSearch("1", "11", searchTxt) - : pubHasuInit("1", "11"); + ? pubHasuSearch("1", "0", searchTxt) + : pubHasuInit("1", "0"); }} > 조회 @@ -202,13 +224,14 @@ export default function PublicReuseFaciltyInsert() { size={"sm"} className="" onClick={() => { - pbnstMngData([] as customPbnst[]); - if(!selectRow){ - toast.error("하수리시시설을 테이블을 선택하고 등록버튼을 눌러주세요") - return - }else{ - appendPbnstRuseFclt() - + // pbnstMngData([] as customPbnst[]); + if (!selectRow) { + toast.error( + "하수리시시설을 테이블을 선택하고 등록버튼을 눌러주세요" + ); + return; + } else { + appendPbnstRuseFclt(); } }} > @@ -260,6 +283,7 @@ export default function PublicReuseFaciltyInsert() { formType="update" form={form} setIndexMng={(index: number) => { + console.log("setIndexMng", index); setIndexMng(index); }} indexMng={indexMng} @@ -286,10 +310,10 @@ export default function PublicReuseFaciltyInsert() { data={isRuseReg.data || ({} as customPbnst)} > } - bodyClass="w-[68vw] max-w-none h-[90vh]" + bodyClass="w-[68vw] max-w-none h-[90vh]" open={isRuseReg.isModal} onOpenChange={(open) => { - remove(form.getValues("items").length - 1) + remove(form.getValues("items").length - 1); setIsRuseReg({ data: {} as pubHasuType, isModal: open }); }} /> diff --git a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx index e72d6def6..37c010890 100644 --- a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx +++ b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx @@ -4,6 +4,7 @@ import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type"; import type { FcPrfType, PrfType } from "./type"; import type { TableUpperProps } from "../../common/type/header"; import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; +import toast from "react-hot-toast"; const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport; const monthHeadList = monthHeadListExport; @@ -94,18 +95,13 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( console.log('ressponse ', ressponse) if(ressponse.status === 200){ - ToastFormUi({ - body: "하수재이용 시설 실적 등록이 완료되었습니다. ", - title: "하수재이용 시설 실적 등록", - }); + + toast.success("하수재이용 시설 실적 등록이 완료되었습니다.") } }catch(e){ console.log(e) - ToastFormUi({ - body: "하수재이용 시설 실적 등록이 실패하였습니다. ", - title: "하수재이용 시설 실적 등록", - }); + toast.error("하수재이용 시설 실적 등록이 실패하였습니다.") } }, diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx index 9fde9c092..fb799c26c 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx @@ -24,6 +24,7 @@ import { fcOrgwtsHeadListExport, } from "./headList"; import type { TableUpperProps } from "@/app/store/common/type/header"; +import toast from "react-hot-toast"; const selectLabel: SelectDataType[] = [{ text: "test", val: "1" }]; const pubFacHeadList = pubFacHeadListExport; @@ -62,9 +63,9 @@ type pubFacActions = { appendRuseFclt(array: customPbnst[]): void; fileDelete: (atflCd: string) => void; fileDownLoad: (atflCd: string) => void; - pbnstMngData: (data: customPbnst[]) => void; - pbnstBizData(data: fcBizType): void; - getBizCycle: (pbnstObj: customPbnst) => void; + //pbnstMngData: (data: customPbnst[]) => void; + //pbnstBizData(data: fcBizType): void; + // getBizCycle: (pbnstObj: customPbnst) => void; getpbnstInsertIndex: (data: pbnstInsertIndex) => void; pbnstRuseFcltUpdate: (ruseRes: customPbnst[]) => void; pbnstRuseBizUpdate: (ruseRes: fcBizType[]) => void; @@ -100,14 +101,20 @@ const checkWrRegList = async () => { const hasuListFetch = async (page: string, sggOrCity: string, searchTxt?:string) => { const checkWrRegListRes = await checkWrRegList(); -let url = `/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`; + + console.log(' checkWrRegListRes ', checkWrRegListRes) +let url = `/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity? sggOrCity : "11"}/0/1/SW`; + + +const data = checkWrRegListRes.filter((item:string) => item !== "") + console.log(' checkWrRegListRes ' ) if(searchTxt){ url= url +`/${searchTxt}` } const rainRes = await postFectch( url, - checkWrRegListRes, + data, fetchType.COMMON ); @@ -200,7 +207,6 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { pbnstRegClick: async (pubHasuRes: pubHasuType) => { try { const pbnstRes = await initFetch(pubHasuRes.bscFctCd); - console.log('pbnstRes ' , pbnstRes) return set((state: pubFacState) => ({ ...state, pbnst: { @@ -234,14 +240,19 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { const response = await postFectch( `/reuseFc/pubFc`, - JSON.stringify( pbnstRes) + pbnstRes ); + if( response.status === 200) { + toast.success(`${pbnstRes.ruseUtztnFcltNm} 하수재이용 시설이 등록되었습니다.`); + } + const pbnstHasuRes = await hasuListFetch('1', '0'); + return set((state: pubFacState) => ({ ...state, pbnst: { ...state.pbnst, - pbnstRes: response.data, + pbnstRes: pbnstHasuRes, isInit: false, }, })); @@ -334,41 +345,41 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { } }, - pbnstMngData: (data: customPbnst[]) => { - if (data.length > 0) { - } - return set((state: pubFacState) => { - state.pbnst.pbnstMngRegData = data; - state.pbnst.pbnstBizCycle = - data.length <= 0 - ? [{ text: "없음", val: "1" }] - : state.pbnst.pbnstBizCycle; - return state; - }); - }, + // pbnstMngData: (data: customPbnst[]) => { + // if (data.length > 0) { + // } + // return set((state: pubFacState) => { + // state.pbnst.pbnstMngRegData = data; + // state.pbnst.pbnstBizCycle = + // data.length <= 0 + // ? [{ text: "없음", val: "1" }] + // : state.pbnst.pbnstBizCycle; + // return state; + // }); + // }, - pbnstBizData: (data: fcBizType) => { - return set((state: pubFacState) => { - if (state.pbnst.pbnstMngRegData) { - const regData = state.pbnst.pbnstMngRegData.find( - (item) => data.pbnstRuseFcltFk === item.pbnstRuseFcltPk - ); - if (regData) { - const bizIdx = regData.fcBizs.findIndex( - (item) => item.pbnstRuseFcltBizPk == data.pbnstRuseFcltBizPk - ); + // pbnstBizData: (data: fcBizType) => { + // return set((state: pubFacState) => { + // if (state.pbnst.pbnstMngRegData) { + // const regData = state.pbnst.pbnstMngRegData.find( + // (item) => data.pbnstRuseFcltFk === item.pbnstRuseFcltPk + // ); + // if (regData) { + // const bizIdx = regData.fcBizs.findIndex( + // (item) => item.pbnstRuseFcltBizPk == data.pbnstRuseFcltBizPk + // ); - if (bizIdx >= 0) { - regData.fcBizs[bizIdx] = data; - const pbnstData = state.pbnst.pbnstMngRegData - state.pbnst.pbnstMngRegData= [...pbnstData] + // if (bizIdx >= 0) { + // regData.fcBizs[bizIdx] = data; + // const pbnstData = state.pbnst.pbnstMngRegData + // state.pbnst.pbnstMngRegData= [...pbnstData] - } - } - } - return state; - }); - }, + // } + // } + // } + // return state; + // }); + // }, getpbnstInsertIndex: async (data: pbnstInsertIndex) => { return set((state: pubFacState) => { state.pbnst.pbnsUpdateIndex = data; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx index 0c3bb452c..a34985810 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx @@ -57,7 +57,7 @@ export type PbnstDemandComType = { dmdAplyPswd: string | ''; splyCpct: number | 0; splyFmYn:string|'Y' - dmdInfoFk:string|'' +// dmdInfoFk:string|'' } const pubHasuZod = z.object({ @@ -129,7 +129,7 @@ const fcOrgwtSchema = z.object({ }); const dmdColist = z.object({ - dmdInfoFk: z.string().default(''), + dmdInfoPk: z.string().default(''), dmdCoNm: z.string().default(''), daddr: z.string(), useUsgCd: z.string().nullish(), 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 645a2fa07..df63b3520 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -11,7 +11,6 @@ import { } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/headList"; import { fcBizSchema, - type customPbnst, type fcBizType, type PbnstRegArrrayType, type ppInstlType, @@ -25,20 +24,9 @@ import { import FcOrgwtsRegModal from "@/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal"; import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable"; import { SelectBox } from "@common/business_components"; -import { - FormUi, - SearchInputSelect, - UiModal, - type SelectDataType, -} from "@common/business_components/ui"; +import { DatePicker, FormUi, UiModal } from "@common/business_components/ui"; import { Form, FormField } from "@common/business_components/ui/form"; -import { - Button, - DataTable, - DatePicker, - Input, - Label, -} from "@common/components"; +import { Button, DataTable, Input, Label } from "@common/components"; import { useEffect, useRef, useState } from "react"; import { useFieldArray, useForm, type UseFormReturn } from "react-hook-form"; import MngRegFormDetail from "../mngReg/mngRegFormDetail/mngRegFormDetail"; @@ -47,10 +35,9 @@ import SearchInputText from "@/components/ui/searchInput/searchInput"; import SdmInsertForm from "@common/business_components/ui/sdmInsertForm"; import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; import RuseMngTableForm from "@/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm"; +import type { SelectDataType } from "@common/business_components"; export function PbnstBuseForm({ - formType, - firstBizData, indexMng = 0, indexBiz = 0, setIndexBiz, @@ -68,14 +55,17 @@ export function PbnstBuseForm({ code, pbnst, demandCompList, - pbnstBizData, getpbnstInsertIndex, appendRuseFclt, - getBizCycle, getDemandCompList, regDemandCompany, } = useWrStore((state) => state); const { pbnstBizCycle, pbnstRes } = pbnst; + const { fields: fcBizs, append: appendBiz } = useFieldArray({ + control: form.control, + name: `items.${indexMng}.fcBizs`, + }); + const [bizCycle, setBizCycle] = useState("1"); const [ppiSelectList, setPpiSelectList] = useState<[{ name: string; val: SelectDataType[] }]>(); @@ -95,7 +85,6 @@ export function PbnstBuseForm({ data: DemandCompType; }>({ isMoal: false, data: {} as DemandCompType }); - useEffect(() => { const total = (form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.gvsbs`) ?? 0) + @@ -106,43 +95,29 @@ export function PbnstBuseForm({ }, [ form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.gvsbs`), form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.lcep`), - form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cusrAlotm`) + form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cusrAlotm`), ]); - // const form = useForm({ - // resolver: zodResolver(fcBizSchema), - // defaultValues: - // formType === "reg" && - // pbnst.pbnstMngRegData && - // pbnst.pbnstMngRegData[0]?.fcBizs - // ? (pbnst.pbnstMngRegData[0].fcBizs[0] ?? {}) - // : formType === "update" && - // typeof pbnst.pbnsUpdateIndex.biz === "number" && - // pbnst.pbnsUpdateIndex.biz >= 0 && - // pbnst.pbnstRes - // ? pbnst.pbnstRes[pbnst.pbnsUpdateIndex.mng]?.fcBizs[ - // pbnst.pbnsUpdateIndex.biz - // ] - // : fcBizSchema.parse({}), - // mode: "onChange", - // }); - - + // fcBizs 데이터가 변경될 때마다 차수 선택 목록을 업데이트합니다. useEffect(() => { - if (form) { - const cycleLength = form.getValues(`items.${indexMng}.fcBizs`).length; - setSelectBizCycle( - Array.from({ length: cycleLength }, (_, index) => ({ - text: `${index + 1}차`, // ✅ index + 1 - val: index, // 이건 그대로 유지 (value로는 0부터 시작) - })) - ); + const cycleLength = fcBizs.length; + const newSelectBizCycle = Array.from( + { length: cycleLength }, + (_, index) => ({ + text: `${index + 1}차`, + val: index, + }) + ); + setSelectBizCycle(newSelectBizCycle); + + // 현재 차수 인덱스가 유효하지 않게 되면 마지막 인덱스로 조정합니다. + if (indexBiz >= cycleLength && cycleLength > 0) { + setIndexBiz(cycleLength - 1); } - }, [indexMng, form]); + }, [fcBizs, indexBiz, setIndexBiz]); // 2. Define a submit handler. function addRuseFcltObj() { const formRuse = form.getValues(`items.${indexMng}`); - const formBizs = form.getValues(`items.${indexMng}.fcBizs`); const pbnstBizCycle = formBizs.length; @@ -154,25 +129,13 @@ export function PbnstBuseForm({ pplInstls: undefined, fcDemands: undefined, }); - const index = pbnst.pbnsUpdateIndex.mng; appendBiz(newItem); - const cycleLength = form.getValues(`items.${indexMng}.fcBizs`).length; - setSelectBizCycle( - Array.from({ length: cycleLength }, (_, index) => ({ - text: `${index + 1}차`, // ✅ index + 1 - val: index, // 이건 그대로 유지 (value로는 0부터 시작) - })) - ); + setIndexBiz(pbnstBizCycle); // 새로 추가된 차수로 포커스 이동 } useEffect(() => { - console.log("form ", form.watch()); + //console.log("form ", form.watch()); }, [form.formState]); - const { fields: fcBizs, append: appendBiz } = useFieldArray({ - control: form.control, - name: `items.${indexMng}.fcBizs`, - }); - const { fields: fcDemands, append: appendDemand, @@ -186,7 +149,6 @@ export function PbnstBuseForm({ control: form.control, name: `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`, }); - console.log(" fcOrgwtFiled ", fcOrgwtFiled); const { fields: pplInstls, append: appendPpl, @@ -202,10 +164,6 @@ export function PbnstBuseForm({ } }, [ppiYn, indexMng, indexBiz]); - useEffect(() => { - console.log("pbnst. bug pbnstMngRegData ", pbnst.pbnstMngRegData); - }, [pbnst.pbnstMngRegData]); - const plusHist = () => { if ( form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.pbnstRuseFcltBizPk`) @@ -245,7 +203,7 @@ export function PbnstBuseForm({ form.getValues( `items.${indexMng}.fcBizs.${indexBiz}.pbnstRuseFcltFk` ) ?? "", - dmdInfoFk: "", + dmdInfoPk: "", //telno: "", }); }; @@ -278,9 +236,6 @@ export function PbnstBuseForm({ } }, [code]); - useEffect(() => { - console.log(" demandCompList ", demandCompList); - }, [demandCompList]); useEffect(() => { console.log("form errors:", form.formState.errors); }, [form.formState.errors]); @@ -295,441 +250,488 @@ export function PbnstBuseForm({ setSumCpct(sum); }, [form.formState, indexMng, indexBiz]); + // // 차수별 정보(fcBizs)가 하나도 없을 경우 플레이스홀더 UI를 보여줍니다. + // if (fcBizs.length === 0) { + // return ( + //
+ //

등록된 차수별 정보가 없습니다.

+ //

아래 버튼을 눌러 신규 차수 정보를 등록해주세요.

+ // + //
+ // ); + // } + + const pbnstBiz = form.watch(`items.${indexMng}.fcBizs`); return ( <> -
- {/* 차수별 등록 현황 폼 */} -
- - -
-

-
-

등록차수

+ {pbnstBiz && pbnstBiz?.length > 0 ? ( +
+ {/* 차수별 등록 현황 폼 */} +
+ + +
+

+
+

등록차수

- { - setIndexBiz(Number(val)); - }} - > + { + setIndexBiz(Number(val)); + }} + > - -
-
- - - - - - - -

재이용 원수취수 현황

-
-
- -
- -
-

재이용 공급관로 설치 현황

-
- - setPpiYn(String(val))} - /> - - - {ppiYn === "Y" ? ( - <> +
+
+ + + + + + + +

재이용 원수취수 현황

+
+
+ - - - ) : ( - <> - )} -
-
- + +
+

재이용 공급관로 설치 현황

+
+ + setPpiYn(String(val))} + /> + + + {ppiYn === "Y" ? ( + <> + + + + ) : ( + <> + )} +
+
+ { + const pplSum = form.getValues( + `items.${indexMng}.fcBizs.${indexBiz}.pplInstls` + ); + if (!pplSum) return; + let sum = 0; + pplSum.forEach((item) => { + sum += Number(item.cpct) || 0; + }); + setSumCpct(sum); + }} + /> +
+ + { - const pplSum = form.getValues( - `items.${indexMng}.fcBizs.${indexBiz}.pplInstls` - ); - if (!pplSum) return; - let sum = 0; - pplSum.forEach((item) => { - sum += Number(item.cpct) || 0; - }); - setSumCpct(sum); - }} /> -
- - -
-

{"하수처리수 재이용수 수요처"}

-
- - -
- {( - form.getValues( - `items.${indexMng}.fcBizs.${indexBiz}.fcDemands` - ) || [] - ).map((field, index) => ( -
-
- ( - - { - f.onChange(val); - if (val && val.length > 2) { - getDemandCompList(val, 3); - } - }} - setRtnData={(valList: any) => { - if (valList) { - form.setValue( - `items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.dmdInfoFk`, - valList.dmdInfoPk - ); - form.setValue( - `items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.daddr`, - valList.daddr - ); - form.setValue( - `items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.useUsgCd`, - valList.useUsgCd - ); - form.setValue( - `items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.splyCpct`, - valList.splyCpct - ); - form.setValue( - `items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.dmdInfoFk`, - valList.dmdInfoPk?.toString() - ); - } - }} - searchList={demandCompList?.map((item) => { - return { - ...item, - searchNm: item.dmdCoNm, - searchPk: item.dmdInfoPk, - }; - })} - > - - )} - /> -
-
- ( - - f.onChange(e.target.value)} - value={f.value} - className={selectClass} - /> - - )} - /> -
-
- ( - - - - )} - /> -
-
- ( - - - f.onChange(date) - } - className={"rounded-lg !w-full"} - /> - - )} - /> -
-
- ( - - - f.onChange(date) - } - className={"rounded-lg !w-full"} - /> - - )} - /> -
-
- ( - - { - f.onChange(Number(e.target.value)); - }} - /> - - )} - /> -
-
- ( - - - f.onChange(val) - } - value={f.value} - /> - - )} - /> -
+
+

+ {"하수처리수 재이용수 수요처"} +

+
+ +
- ))} -
- - + {( + form.getValues( + `items.${indexMng}.fcBizs.${indexBiz}.fcDemands` + ) || [] + ).map((field, index) => ( +
+
+ ( + + { + f.onChange(val); + if (val && val.length > 2) { + getDemandCompList(val, 3); + } + }} + setRtnData={(valList: any) => { + if (valList) { + form.setValue( + `items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.daddr`, + valList.daddr + ); + form.setValue( + `items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.useUsgCd`, + valList.useUsgCd + ); + form.setValue( + `items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.splyCpct`, + valList.splyCpct + ); + form.setValue( + `items.${indexMng}.fcBizs.${indexBiz}.fcDemands.${index}.dmdInfoPk`, + valList.dmdInfoPk?.toString() + ); + } + }} + searchList={demandCompList?.map((item) => { + return { + ...item, + searchNm: item.dmdCoNm, + searchPk: item.dmdInfoPk, + }; + })} + > + + )} + /> +
+
+ ( + + f.onChange(e.target.value)} + value={f.value} + className={selectClass} + /> + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ ( + + + f.onChange(date), + }} + selectClass={"rounded-lg !w-full"} + /> + + )} + /> +
+
+ ( + + + f.onChange(date) + } + field={{ + value: safeDate(f.value) || new Date(), + onChange: (date: Date | undefined) => + f.onChange(date), + }} + selectClass={"rounded-lg !w-full"} + /> + + )} + /> +
+
+ ( + + { + f.onChange(Number(e.target.value)); + }} + /> + + )} + /> +
+
+ ( + + + f.onChange(val) + } + value={f.value ?? code.yn[0]?.val} + /> + + )} + /> +
+
+ ))} +
+ + +
+ + setIsFcOrgwts(open)} + bodyClass={"w-[50vw] max-w-none h-[90vh]"} + body={ + { + setIsFcOrgwts(false); + }} + onRightSet={(val) => { + form.setValue( + `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`, + val + ); + }} + > + } + > + + { + setIsDmdModal({ isMoal: false, data: {} as DemandCompType }); + }} + body={ + { + getDemandCompList(searchText, pageCnt); + }} + rtnInputData={(data) => { + regDemandCompany(data as DemandCompType); + setIsDmdModal({ + isMoal: false, + data: data as DemandCompType, + }); + }} + bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"} + > + } + >
- - setIsFcOrgwts(open)} - bodyClass={"w-[50vw] max-w-none h-[90vh]"} - body={ - { - setIsFcOrgwts(false); - }} - onRightSet={(val) => { - form.setValue( - `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`, - val - ); - }} - > - } - > - - { - setIsDmdModal({ isMoal: false, data: {} as DemandCompType }); - }} - body={ - { - getDemandCompList(searchText, pageCnt); - }} - rtnInputData={(data) => { - regDemandCompany(data as DemandCompType); - setIsDmdModal({ isMoal: false, data: data as DemandCompType }); - }} - bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"} - > - } - > -
+ ) : ( +
+

등록된 차수별 정보가 없습니다.

+

+ 아래 버튼을 눌러 신규 차수 정보를 등록해주세요. +

+ +
+ )} ); } 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 21dc3cf83..d07d24a23 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx @@ -37,7 +37,6 @@ export type FilesType = { export function PbnstMngForm({ form, formType, - firstFcltData, indexMng, setIndexMng, }: { @@ -51,12 +50,8 @@ export function PbnstMngForm({ code, pbnst, pbnstInsert, - pbnstMngData, fileDelete, fileDownLoad, - getBizCycle, - getpbnstInsertIndex, - appendRuseFclt, } = useWrStore((state) => state); const { pbnstRes } = pbnst; @@ -67,8 +62,6 @@ export function PbnstMngForm({ const [mngMtdCode, setMngMtdCode] = useState<{ name: string; val: SelectDataType[] }[]>(); - const [progress, setProgress] = useState(0); - const { fields: fcOpersField, append, @@ -221,12 +214,19 @@ export function PbnstMngForm({ }, [pbnst.pbnstMngRegData]); useEffect(() => { - if (pbnst.pbnstRes && pbnst.pbnstRes?.length <= 0) return; - const fcltNmList = pbnst.pbnstRes?.map((item, index) => ({ - text: item.ruseUtztnFcltNm, - val: String(index), - })); - if (fcltNmList) setFcltNm(fcltNmList); + if (pbnst.pbnstRes && pbnst.pbnstRes?.length >= 0) { + + const fcltNmList = pbnst.pbnstRes?.map((item, index) => ({ + text: item.ruseUtztnFcltNm, + val: String(index), + })); + + + console.log(' fcltNmList ', fcltNmList) + if (fcltNmList) setFcltNm(fcltNmList); + }else{ + setFcltNm(null); + } }, [pbnst.pbnstRes]); // 2. Define a submit handler. @@ -253,6 +253,16 @@ export function PbnstMngForm({ } }, [code]); + + useEffect(() =>{ + // console.log(' fcltNm ', watchedItem?.ruseUtztnFcltNm) + },[watchedItem]) + + + useEffect(() => { + console.log(" form indexMng ", indexMng); + }, [indexMng]); + return (
@@ -266,33 +276,29 @@ export function PbnstMngForm({ {formType === "update" ? ( - ( - - { - setIndexMng(Number(val)); - field.onChange(val); - }} - value={field.value ?? ""} - className={""} - selectClass={undefined} - /> - - )} - /> + + { + setIndexMng(Number(val)); + }} + value={String(indexMng)} + className={""} + selectClass={undefined} + /> + ) : ( ( subscription.unsubscribe(); }, [form]); diff --git a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx index d7ecee90a..b930a36bb 100644 --- a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx @@ -26,7 +26,7 @@ export function PbnstRegModal({ data: pubHasuType; form: UseFormReturn<{ items: PbnstRegArrrayType }>; }) { - const { pbnst, pbnstInsert, pbnstMngData } = useWrStore((state) => { + const { pbnst, pbnstInsert } = useWrStore((state) => { return state; }); const [pbnstBdstForm, setPbnstBdstForm] = useState( @@ -57,48 +57,18 @@ export function PbnstRegModal({ useEffect(() => { if (data) { + const firstForm = form.getValues("items"); - - console.log('mngIndex ', firstForm.length) - setIndexMng(firstForm.length - 1) - // console.log(' firstForm ', firstForm) - // let regData; - // if (pbnstRes && pbnstRes?.length > 0) { - // regData = { - // swtrmtFcltFk: String(data.bscFctCd), - // pbnstRuseFcltPk: String(data.bscFctCd) + String(pbnstRes.length + 1), - // fcBizs: [ - // { - // pbnstRuseFcltFk: - // String(data.bscFctCd) + String(pbnstRes.length + 1), - // cycl: 1, - // } as unknown as fcBizType, - // ], - // }; - // //regData= pbnstRegZod.parse(regData) - // //setPbnstBdstForm(regData as unknown as customPbnst); - // // pbnstMngData([regData] as unknown as customPbnst[]) - // } else { - // regData = { - // swtrmtFcltFk: String(data.bscFctCd), - // pbnstRuseFcltPk: String(data.bscFctCd + "1"), - // fcBizs: [ - // { - // pbnstRuseFcltFk: String(data.bscFctCd + "1"), - // cycl: 1, - // } as unknown as fcBizType, - // ], - // }; - // //regData= pbnstRegZod.parse(regData) - // // setPbnstBdstForm(regData as unknown as customPbnst); - - // // pbnstMngData([regData] as unknown as customPbnst[]) - // } - // regData = pbnstRegZod.parse(regData); - // setPbnstBdstForm(regData as unknown as customPbnst); - } + setIndexMng(firstForm.length - 1) } }, [data, form]); + + + useEffect(() => { + console.log(' form.getValues() ' ,form.getValues()) + + }, [form.getValues()]); + return ( <>

diff --git a/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx b/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx index 11c183f1b..acb923687 100644 --- a/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx +++ b/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx @@ -21,8 +21,7 @@ import { TableHeader, TableRow, } from "@common/components/ui"; -import { read } from "fs"; -import React, { useEffect, useState } from "react"; +import React from "react"; type RuseMngTableProps = { tableData: any[]; @@ -39,8 +38,6 @@ type RuseMngTableProps = { const RuseMngTableForm = React.forwardRef( ({ tableData, headList, upHeadList, code, onTableSet, indexMng, form,formNm,indexBiz }, ref) => { - - console.log('tableData ', tableData) return ( <>

@@ -119,6 +116,7 @@ const RuseMngTableForm = React.forwardRef( field.onChange(val); } }} + readOnly ={head.readonly ? true : false} // Disabled prop removed as SelectBox does not support it > ) : head.type === "date" ? ( @@ -133,6 +131,7 @@ const RuseMngTableForm = React.forwardRef( }, }} selectClass={"w-full"} + readOnly ={head.readonly ? true : false} /> ) : head.type === "checkbox" ? (