From d9673adb94a2e5c78f486700401affc89a9cff32 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Thu, 26 Jun 2025 10:07:59 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 73 +++++++++++++------ apps/wr/components/lib/func/commom.tsx | 13 ++-- 2 files changed, 58 insertions(+), 28 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 5e807d2e1..5aedd9079 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -2,7 +2,10 @@ import { useWrStore } from "@/app/store"; import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; -import type { rswtChkZodType, rswtrChkDetailsZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; +import type { + rswtChkZodType, + rswtrChkDetailsZodType, +} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { excelArrayDownload, excelDownload, @@ -26,6 +29,7 @@ import ListDiv from "@common/business_components/ui/list_div"; import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; import { Toaster } from "react-hot-toast"; +import { shallow } from "zustand/shallow"; //----------------------- export default function Page() { @@ -52,9 +56,9 @@ export default function Page() { const [updateRainDetail, setUpdateRainDetail] = useState( [] ); - const [updateRswtDetail, setUpdateRSwtDetail] = useState( - [] - ); + const [updateRswtDetail, setUpdateRSwtDetail] = useState< + rswtrChkDetailsZodType[] + >([]); const [deleteIdx, setDeleteIdx] = useState([]); const [selFcltDiv, setSelFcltDiv] = useState("RNB"); @@ -66,12 +70,14 @@ export default function Page() { if (searchYear) rainChkInit(searchYear, "0"); }; - const [searchYear, setSearchYear] = useState(String(new Date().getFullYear())); + const [searchYear, setSearchYear] = useState( + String(new Date().getFullYear()) + ); useEffect(() => { if (!rainChkgdn.isInit) { rainChkInit(new Date().getFullYear().toString(), "0"); - isRainSttn(false) + isRainSttn(false); setIsModal({ data: {}, open: false }); setIsRegExcel(false); } @@ -84,13 +90,35 @@ export default function Page() { }, [rainChkgdn.isInit, rainChkInit]); useEffect(() => { + // data: any[][]; + // headerNum: number; + // headerRange: string; + // sheetName: string; + // startCol?: string; + if (rswtChkgdn.excelList[0]?.data.length > 1) { + const SheetParameter = [ + { + data: rswtChkgdn.excelList, + headerRange: "A1:AJ1", + headerNum: 1, + sheetName: "중수도_점검결과_이용량현황", + startCol: "A", + }, + { + data: rswtChkgdn.excelList, + headerRange: "A1:BB", + headerNum: 1, + sheetName: "중수도_점검결과_수질", + startCol: "A", + }, + ]; - if (rswtChkgdn.excelList[0]?.data.length > 1) excelArrayDownload( "중수도시설 지도점검", "sample_rs_chk.xlsx", - rswtChkgdn.excelList + SheetParameter ); + } }, [rswtChkgdn.excelList]); useEffect(() => { @@ -118,15 +146,14 @@ export default function Page() { const handleClick = useCallback( (data: any) => { - if (data) setIsModal({ open: !isModal.open, data: data }); }, [isModal] ); useEffect(() => { - rainChkgdn.isSttn = false - rswtChkgdn.isSttn = false + rainChkgdn.isSttn = false; + rswtChkgdn.isSttn = false; if (!rainChkgdn.isSttn && !rswtChkgdn.isSttn) { rainChkHeadChange({ rainChkgdn }, true); rswtChkHeadChange({ rswtChkgdn }, true); @@ -138,20 +165,17 @@ export default function Page() { if (selFcltDiv === "RNB") { rainChkDelete(data); } else { - rswtChkDelete(data) + rswtChkDelete(data); } } }; const chkUpdateTable = (selFcltDiv: string) => { if (selFcltDiv === "RNB") { - - rainChkDetilUpdate(updateRainDetail) + rainChkDetilUpdate(updateRainDetail); } else { - - rswtChkDetilsUpdate(updateRswtDetail) + rswtChkDetilsUpdate(updateRswtDetail); } - - } + }; return ( @@ -161,7 +185,9 @@ export default function Page() {
- +
- +
- +