diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx index e8362edbe..00af0e72d 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx @@ -6,12 +6,14 @@ import type { chgBuilding, customRainBdst, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel"; import { excelDownload, getCityOrSgg, tableData, } from "@/components/lib/func/commom"; import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal"; +import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal"; import { ContentsDiv, SearchBaseForm, @@ -21,12 +23,9 @@ import { type ReturnType, } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; -import { makeFcltRegHead } from "@common/business_components/ui/table/makeFcltRegHead"; -import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal"; -import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal"; +import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; import { Button } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; -import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel"; export default function HtdflSttn() { const { code, htdflSttn, htdflSttnSearch, initHtdfl } = useWrStore( @@ -139,7 +138,7 @@ export default function HtdflSttn() { } else { con = returnType.sidoValue; } - // rainSttnSearch(1, "20", con); + htdflSttnSearch(pageNation, "20", con); }} excelClick={excelClick} initClick={function (): void {}} @@ -155,7 +154,7 @@ export default function HtdflSttn() { headName={[]} tableData={bdstTable || []} children={ - + } headlist={htdflSttn.htdflSttHeadList} pageSize={20} diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx index ebdd64a4e..52edb193e 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx @@ -34,7 +34,7 @@ export default function RainSttn() { const [pageNation, setPageNation] = useState(1); const [isChHead, setIsChHead] = useState(false); const [bdstTable, setBdstTable] = useState(); - const [detailModal, setDetailModal] = useState<{isOpen:boolean,data:customRainBdst|undefined}>({data:undefined,isOpen:false }) + const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRainBdst | undefined }>({ data: undefined, isOpen: false }) const [bdstChgProps, setBdstChgProps] = useState<{ isOpen: boolean; chBuilding: chgBuilding[]; @@ -42,23 +42,22 @@ export default function RainSttn() { const codeData = getCityOrSgg(ref); - const cellClick=(index:number|undefined, headId: string)=>{ + const cellClick = (index: number | undefined, headId: string) => { - if(headId!=='chBuildingYn' && index!==undefined && bdstTable!==undefined){ - setDetailModal({isOpen:true ,data:bdstTable[index] }) - }else if( headId==='chBuildingYn' && index!==undefined && bdstTable!==undefined){ + if (headId !== 'chBuildingYn' && index !== undefined && bdstTable !== undefined) { + setDetailModal({ isOpen: true, data: bdstTable[index] }) + } else if (headId === 'chBuildingYn' && index !== undefined && bdstTable !== undefined) { if ( bdstTable[index] && - bdstTable[index]?.chgBuilding[0]?.bdstChgNm!==null - + bdstTable[index]?.chgBuilding[0]?.bdstChgNm !== null + ) { - setBdstChgProps({ isOpen:true , chBuilding: bdstTable[index].chgBuilding}); + setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding }); } } } - useEffect(() => { if (!rainSttn.isInit) { rainSttnInit(codeData ?? "0"); @@ -73,7 +72,7 @@ export default function RainSttn() { ...item, ...item.reuseBuilding[0], ...item.reuseBuilding[0].rainyObj, - chBuildingYn:item.chgBuilding[0]?.bdstChgNm!==null?'Y':'N' + chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? 'Y' : 'N' })) .filter((item: any) => item.rainyObj !== undefined); @@ -92,14 +91,15 @@ export default function RainSttn() { excelDownload( rainSttn.excelList, "빗물재이용시설 현황", - "sample_rainSttn.xlsx" + "sample_rainSttn.xlsx", + "A1:W3" ); } }, [rainSttn.excelList]); const excelClick = useCallback(() => { if (codeData) rainSttnSearch(1, "10000", codeData); - }, [rainSttnSearch,codeData]); + }, [rainSttnSearch, codeData]); return ( <> @@ -136,7 +136,7 @@ export default function RainSttn() { rainSttnSearch(1, "20", con); }} excelClick={excelClick} - initClick={function (): void {}} + initClick={function (): void { }} btnClass={btnClass} ref={ref} /> @@ -154,7 +154,7 @@ export default function RainSttn() { headlist={rainSttn.rainSttHeadList} pageSize={20} total={100000} - cellClick={(index: number | undefined,headId:string)=>{cellClick(index ?? undefined,headId)} } + cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }} onPageChange={setPageNation} > @@ -177,12 +177,12 @@ export default function RainSttn() { } /> { - setDetailModal({...detailModal, isOpen:!detailModal.isOpen}) - }} - bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"} - body={}/> + open={detailModal.isOpen} + onOpenChange={() => { + setDetailModal({ ...detailModal, isOpen: !detailModal.isOpen }) + }} + bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"} + body={} /> ; htdflSttNodeList: CommonTableProps[]; - htdflSttnRes:customHtdflBdst[] + htdflSttnRes: customHtdflBdst[] excelList: []; }; }; type htdflSttnActions = { - initHtdfl:(con:string) => void; + initHtdfl: (con: string) => void; htdflSttnSearch: (page: number, total: string, con: string) => void; htdflChSttnHead: ( headList: z.infer, @@ -33,16 +33,16 @@ export const htdflSttnStateExport: htdflSttnState = { htdflSttn: { htdflSttHeadList: htdflSttHeadList, htdflSttNodeList: htdflSttNodeList, - htdflSttnRes:[], - excelList:[], + htdflSttnRes: [], + excelList: [], isInit: false, }, }; -const initFetch = async (code:string|number) => { +const initFetch = async (code: string | number) => { const htdflRes = await getFetch( "wr", `/drain/facilityList/1/20/${code}`) - + return htdflRes; }; @@ -50,74 +50,72 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = ( set: any ) => { return { - initHtdfl: async (code: string | number) => { - try { - const htdflSttnRes = await initFetch(code); - set((state: htdflSttnState) => { - return { - ...state, - htdflSttn: { - ...state.htdflSttn, - htdflSttnRes: htdflSttnRes, - isInit: false, - }, - }; - }); - } catch (error) { - console.log(error); - } + initHtdfl: async (code: string | number) => { + try { + const htdflSttnRes = await initFetch(code); + set((state: htdflSttnState) => { + return { + ...state, + htdflSttn: { + ...state.htdflSttn, + htdflSttnRes: htdflSttnRes, + isInit: false, + }, + }; + }); + } catch (error) { + console.log(error); + } + }, + htdflSttnSearch: async (page: number, total: string, con: string) => { + try { + const htdflSttnRes = await getFetch( + fetchType.WR, + `/drain/facilityList/${page}/${total}/${con}` + ); + if (Number(total) > 9000) { + + + set((state: htdflSttnState) => { + + return { + ...state, + htdflSttn: { + ...state.htdflSttn, + excelList: htdflSttnRes, + }, + }; + }); + } else + set((state: htdflSttnState) => { + return { + ...state, + htdflSttn: { + ...state.htdflSttn, + htdflSttnRes: htdflSttnRes, + isInit: false, + }, + }; + }); + } catch (erTxt) { + console.log("error", erTxt); + } + }, + htdflChSttnHead: async ( + headList: z.infer + ): Promise => { + + const changeNodeList = controlHeadView(headList, htdflSttNodeList) + + return set((state: htdflSttnState) => ({ + htdflSttn: { + ...state.htdflSttn, + htdflSttHeadList: headList, + htdflSttNodeList: changeNodeList, }, - htdflSttnSearch: async (page: number, total: string, con: string) => { - try { - console.log(page) - const htdflSttnRes = await getFetch( - fetchType.WR, - `/drain/facilityList/${page}/${total}/${con}` - ); - if (Number(total) > 9000) { - - - set((state: htdflSttnState) => { + })); + }, - return { - ...state, - htdflSttn: { - ...state.htdflSttn, - excelList: htdflSttnRes, - }, - }; - }); - } else - set((state: htdflSttnState) => { - return { - ...state, - htdflSttn: { - ...state.htdflSttn, - htdflSttnRes: htdflSttnRes, - isInit: false, - }, - }; - }); - } catch (erTxt) { - console.log("error", erTxt); - } - }, - htdflChSttnHead: async ( - headList: z.infer - ): Promise => { - - console.log('head ', headList) - const changeNodeList= controlHeadView(headList,htdflSttNodeList) - - return set((state: htdflSttnState) => ({ - htdflSttn: { - ...state.htdflSttn, - htdflSttHeadList: headList, - htdflSttNodeList: changeNodeList, - }, - })); - }, - } } \ No newline at end of file diff --git a/apps/wr/public/sample_rainSttn.xlsx b/apps/wr/public/sample_rainSttn.xlsx index 006e06aba..f00a520cf 100644 Binary files a/apps/wr/public/sample_rainSttn.xlsx and b/apps/wr/public/sample_rainSttn.xlsx differ