diff --git a/apps/wr/app/(with-layout)/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/(with-layout)/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 688fb836c..5f1d0d19c 100644 --- a/apps/wr/app/(with-layout)/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/(with-layout)/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -236,6 +236,7 @@ export default function PublicReuseFaciltyInsert() { }, [indexMng]); useEffect(() => { + if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) { form.reset({ items: pbnst.pbnstRes }); } else { diff --git a/apps/wr/app/store/map/ruseMap/index.tsx b/apps/wr/app/store/map/ruseMap/index.tsx index cd11bcbd1..5e07a9b72 100644 --- a/apps/wr/app/store/map/ruseMap/index.tsx +++ b/apps/wr/app/store/map/ruseMap/index.tsx @@ -17,7 +17,7 @@ export type ruseMapState = { ruseMapCount: number; isInit: boolean; fclts: string[]; - ruseExcelList:[]; + ruseExcelList: []; ruseDetailList: customPbnst[]; ruseMapHeadList: CommonTableProps[]; ruseMapNodeList: CommonTableProps[]; @@ -31,22 +31,21 @@ type ruseMapActions = { total: number, reurnValue: ReturnType, year: string, - fclts: string[], - isExcel:boolean + fclts: string[] ) => void; ruseMapSearch: ( + isExcel: boolean, page: number, total: number, reurnValue: ReturnType, year: string, fclts: string[], - fcltNm:string + fcltNm: string ) => void; ruseMapDetail: (ruseFcltId: string) => Promise; getRuseMaplList: (bscFctCd: string) => void; }; - export type ruseMapType = ruseMapState & ruseMapActions; export const ruseMapStateExport: ruseMapState = { @@ -56,7 +55,7 @@ export const ruseMapStateExport: ruseMapState = { ruseDetailList: [], fclts: [], ruseMapCount: 1, - ruseExcelList:[], + ruseExcelList: [], ruseMapHeadList: pbnSttHeadListExport, ruseMapNodeList: pbnstSttNodeListExport, }, @@ -81,8 +80,7 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = ( total: number, reurnValue: ReturnType, year: string, - fclts: string[], - isExcel:boolean + fclts: string[] ) => { try { const ruseMapRes = await hasuListFetch( @@ -93,7 +91,6 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = ( year, fclts ); - if(!isExcel){ set((state: ruseMapState) => { return { ...state, @@ -105,19 +102,6 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = ( }, }; }); - }else{ - const ruseMapExcel = excelPbnstSttnParsing(ruseMapRes.data); - - set((state: ruseMapState) => { - return { - ...state, - ruseMap: { - ...state.ruseMap, - ruseExcelList: ruseMapExcel, - }, - }; - }); - } } catch (e) { console.log(e); } @@ -175,12 +159,13 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = ( } }, ruseMapSearch: async ( + isExcel: boolean, page: number, total: number, reurnValue: ReturnType, year: string, fclts: string[], - fcltNm:string + fcltNm: string ) => { try { const ruseMapRes = await hasuListFetch( @@ -189,20 +174,32 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = ( reurnValue, fcltNm, year, - fclts, + fclts ); - - set((state: ruseMapState) => { - return { - ...state, - ruseMap: { - ...state.ruseMap, - ruseMapRes: ruseMapRes.data, - ruseMapCount: ruseMapRes.count, - isInit: false, - }, - }; - }); + if (isExcel) { + const ruseMapExcel = excelPbnstSttnParsing(ruseMapRes.data); + set((state: ruseMapState) => { + return { + ...state, + ruseMap: { + ...state.ruseMap, + ruseExcelList: ruseMapExcel, + }, + }; + }); + } else { + set((state: ruseMapState) => { + return { + ...state, + ruseMap: { + ...state.ruseMap, + ruseMapRes: ruseMapRes.data, + ruseMapCount: ruseMapRes.count, + isInit: false, + }, + }; + }); + } } catch (e) { console.log(e); } diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx index 3712b4dd1..3272c0509 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx @@ -232,7 +232,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { if( response.status === 200) { toast.success(`${pbnstRes.ruseUtztnFcltNm} 하수재이용 시설이 등록되었습니다.`); } - const pbnstHasuRes = await hasuListFetch('1', '0'); + const pbnstHasuRes = await hasuListFetch('1', '41'); return set((state: pubFacState) => ({ ...state, pbnst: { 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 68d7634a0..c55c3567e 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx @@ -172,15 +172,17 @@ export function PbnstMngForm({ return [...exFileDatas, ...currentdata]; }; + useEffect(() =>{ + console.log('로그') + + },[]) useEffect(() => { + setRelationFiles([]) + setPlanFiles([]) + setRegFileList([]) + const currentItem = form.getValues(`items.${indexMng}`); const currentKey = JSON.stringify(currentItem); - const isNewItem = - !fileInitRef.current || - fileInitRef.current.index !== indexMng || - fileInitRef.current.key !== currentKey; - - if (!isNewItem) return; // const defaultFiles = currentItem?.fcFiles || []; @@ -190,24 +192,24 @@ export function PbnstMngForm({ const planFileList = defaultFiles.filter( (item) => item.fileKnd === "평면도" ); - - setRelationFiles( - relationFileList.length > 0 - ? relationFileList.map((item) => ({ - atflCd: item.fileTkn, - file: new File([], item.filePath), - })) - : null - ); - - setPlanFiles( - planFileList.length > 0 - ? planFileList.map((item) => ({ - atflCd: item.fileTkn, - file: new File([], item.filePath), - })) - : null - ); + setRelationFiles( + relationFileList.length > 0 + ? relationFileList.map((item) => ({ + atflCd: item.fileTkn, + file: new File([], item.filePath), + })) + : null + ); + + setPlanFiles( + planFileList.length > 0 + ? planFileList.map((item) => ({ + atflCd: item.fileTkn, + file: new File([], item.filePath), + })) + : null + ); + // ✅ 다음 루프에선 다시 안 하도록 저장 fileInitRef.current = { index: indexMng, @@ -217,6 +219,7 @@ export function PbnstMngForm({ useEffect( () => { + //폼이 들어오면 폼에 대한 이름 셀렉트박스를만들기 위해 if (mngRegForm && mngRegForm.length >= 0) { const fcltNmList = mngRegForm?.map((item, index) => ({ @@ -232,28 +235,36 @@ export function PbnstMngForm({ ); useEffect(() => { + console.log('regFileList ', regFileList) if (regFileList && regFileList?.length > 0) { form.setValue(`items.${indexMng}.fcFiles`, regFileList); } }, [regFileList, indexMng]); useEffect(() => { + console.log('relationfiles ' ,relationfiles) if (relationfiles) { setRegFileList(regFileFilter(relationfiles, "계통도", regFileList || [])); } }, [relationfiles]); useEffect(() => { + console.log('planFiles ' ,planFiles) + if (planFiles) { setRegFileList(regFileFilter(planFiles, "평면도", regFileList || [])); } }, [planFiles]); + + useEffect(() => { if (code.ruseMngMtd) { setMngMtdCode([{ name: "ruseMngMtd", val: code.ruseMngMtd }]); } }, [code]); + + return (
diff --git a/apps/wr/components/ui/map/LayerPopUp/HasuFacilty/HasuFacility.tsx b/apps/wr/components/ui/map/LayerPopUp/HasuFacilty/HasuFacility.tsx index 2a8210aa0..dfeeed2ea 100644 --- a/apps/wr/components/ui/map/LayerPopUp/HasuFacilty/HasuFacility.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/HasuFacilty/HasuFacility.tsx @@ -104,7 +104,7 @@ export function HasuFacility({rtnFeature}:{rtnFeature:(feature:any)=>void } ) { console.log("pbnstSttnSearch ", returnType); - pbnMapSearch(true,1, 100000, returnType,'' ) + pbnMapSearch(true,1, 100000, returnType,pbnRuseNm??'' ) }} /> diff --git a/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx b/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx index dd280a53f..0e30572f8 100644 --- a/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx @@ -174,7 +174,7 @@ export function HtdflFacility({ 1, "1000000", String(con), - "", + seartchTxt||'', code.cityCd, code.sggCd ); diff --git a/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx b/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx index a19744320..80bb8d7ec 100644 --- a/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx @@ -190,7 +190,7 @@ export function RainFacility({ 1, "1000000", String(con), - "", + seartchTxt ?? "", code.cityCd, code.sggCd ); diff --git a/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx b/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx index c6bb80468..becd76872 100644 --- a/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx @@ -186,7 +186,7 @@ export function RswtFacility({ 1, "1000000", String(con), - "", + seartchTxt ?? "", code.cityCd, code.sggCd ); diff --git a/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx b/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx index f171cdf6b..2c7a5295c 100644 --- a/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx @@ -51,7 +51,7 @@ export function RuseFacility({ } }, [ruseMap.isInit]); useEffect(() => { - ruseMapInit(1,ruseMapSize, ref.current, searchYear, fclts,false); + ruseMapInit(1,ruseMapSize, ref.current, searchYear, fclts); }, [fclts]); @@ -133,7 +133,7 @@ export function RuseFacility({ ref={ref} isAdmin={false} excelClick={function (returnType: ReturnType): void { - ruseMapInit(1,100000 , returnType, searchYear, fclts,true); + ruseMapSearch(true,1,1000000 , returnType, searchYear, fclts,pbnRuseNm??'') }} />
@@ -148,9 +148,9 @@ export function RuseFacility({ cellClick={ruseCellClick} onPageChange={(page) => { if(pbnRuseNm&&pbnRuseNm.length>0){ - ruseMapSearch(page,ruseMapSize , ref.current, searchYear, fclts,pbnRuseNm) + ruseMapSearch(false,page,ruseMapSize , ref.current, searchYear, fclts,pbnRuseNm) }else{ - ruseMapInit(page,ruseMapSize , ref.current, searchYear, fclts,false); + ruseMapInit(page,ruseMapSize , ref.current, searchYear, fclts); } setIsReset(false); diff --git a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx index c0cbdda30..e890af27e 100644 --- a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx @@ -61,6 +61,7 @@ export function PbnstRegModal({ useEffect(() => { const firstForm = form.getValues("items"); + if (firstForm) { setIndexMng(firstForm.length - 1); }