diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx index c5dce841b..f640c8d2d 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx @@ -1,5 +1,6 @@ "use client"; import { useWrStore } from "@/app/store"; +import type { FcPrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type"; import type { pubHasuType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; import { excelDownload, yearOptions } from "@/components/lib/func/commom"; import PbnPrfExcelModal from "@/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal"; @@ -22,38 +23,42 @@ import { set } from "react-hook-form"; import { Toaster } from "react-hot-toast"; export default function prfmncPrfmncReg() { - const { code, prfmnc, prfmncHasuInit, } = useWrStore( - (state) => state - ); + const { code, prfmnc, prfmncHasuInit } = useWrStore((state) => state); const { pbnstPrfmncHeadList, monthHeadList, prfmncRes } = prfmnc; - const [bdstTable, setbdstTable] = useState(); + const [bdstTable, setbdstTable] = useState(); const [searchTxt, setSearchTxt] = useState(); - const [isExcelOpen, setIsExcelOPen] = useState(false); + const [isExcelOpen, setIsExcelOPen] = useState<{isModal:boolean, data:FcPrfType}>({isModal:false, data:{} as FcPrfType }); const [searchYear, setSearchYear] = useState( String(new Date().getFullYear()) ); + const excelClick = useCallback(() => { + excelDownload( + [[]], + "하수재이용실적", + "sample_pbnstPrfmncReg.xlsx", + "A1:O1" + ); + }, [prfmnc.excelList]); - const excelClick = useCallback(() => { - console.log("dd") - excelDownload( - [[]], - "하수재이용실적", - "sample_pbnstPrfmncReg.xlsx", - "A1:O1" - ); - }, [prfmnc.excelList]) - useEffect(() => { - if (!prfmnc.isInit) { - prfmncHasuInit("1", "11"); - } - }, [prfmnc.isInit, prfmncHasuInit]); - useEffect(() => { - setbdstTable(prfmncRes) - console.log("prfmnc.prfmncRes", prfmncRes) - }, [prfmncRes]); + + const cellClick = useCallback((index:number|undefined, headId:string) => { + + if(index !== undefined) + setIsExcelOPen({isModal:false, data:prfmncRes[index] || {} as FcPrfType}) + + }, [prfmncRes]); + + useEffect(() => { + if (!prfmnc.isInit) { + prfmncHasuInit("1", "11"); + } + }, [prfmnc.isInit, prfmncHasuInit]); + useEffect(() => { + setbdstTable(prfmncRes); + }, [prfmncRes]); return ( <> @@ -101,7 +106,12 @@ export default function prfmncPrfmncReg() { -