diff --git a/apps/wr/app/matMng/coMng/coSttn/page.tsx b/apps/wr/app/matMng/coMng/coSttn/page.tsx index 163ed1b40..20a0fa945 100644 --- a/apps/wr/app/matMng/coMng/coSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/coSttn/page.tsx @@ -71,6 +71,7 @@ export default function CoSttn() { const getSgg = useCallback((val: string | number) => { setObjSearch((prev) => ({ ...prev, sgg: String(val) })); + setPageNation(1) }, []); useEffect(() => { @@ -110,48 +111,41 @@ export default function CoSttn() { }, [coSttnRes, code]); useEffect(() => { + if (coSttn.excelList.length > 0) { if (coSttn.excelList.length === 0) return; + + const coExcel = excelCoSttnParsing(coSttn.excelList, code.cityCd, code.sggCd); excelDownload( - coSttn.excelList, + coExcel as [], "수요처 관리", "sample_coSttn.xlsx", - "A1:G1", + "A1:H1", 2 ); } - }, [coSttn.excelList]); + }, [coSttn.excelList, code]); - - const excelClick = useCallback(() => { - // const con = objSearch.sgg ? objSearch.sgg : objSearch.city; - // if (con) coSttnSearch("1", "10000", String(con)); - if(bdstTable){ - const excelData = excelCoSttnParsing(bdstTable); - excelDownload( - excelData as [], - "수요처 관리", - "sample_coSttn.xlsx", - "A1:F1", - 2 - ); - } - - // }, [coSttnSearch, objSearch.city, objSearch.sgg]); -}, [excelDownload, bdstTable]); - const searchClick = () => { const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city; + if (con) coSttnSearch("1", "10000", String(con)); + + + }, [coSttnSearch, objSearch.city, objSearch.sgg]); +// }, [excelDownload, bdstTable]); + const searchClick = () => { + const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city; if (con) { if (seartchTxt && seartchTxt?.length > 0) { - coSttnTxtSearch("1", "13", String(con), seartchTxt ?? ""); + coSttnTxtSearch(String(pageNation), "13", String(con), seartchTxt ?? ""); } else { - coSttnSearch("1", "13", String(con)); + coSttnSearch(String(pageNation), "13", String(con)); } } }; + return ( <> @@ -166,7 +160,10 @@ export default function CoSttn() { label="시도" selectClass={""} selectArray={code.cityCd || []} - onSelectValue={getSelCity} + onSelectValue={(val)=>{ + getSelCity(val) + setPageNation(1) + } } value={objSearch.city} /> { - setUpdateData(undefined); setIsDmdModal({ ...isDmdModal, isMoal: true }); }} @@ -239,17 +235,26 @@ export default function CoSttn() { tableData={bdstTable || []} headlist={coSttn.coSttHeadList} pageSize={20} - total={ coSttnResCount || 0 } + total={ coSttnResCount+10 || 0 } cellClick={(index: number | undefined, headId: string) => { setUpdateData(coSttnRes[index as number]); }} - onPageChange={setPageNation} + onPageChange={(page) =>{ + const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city; + setPageNation(page) + coSttnSearch( String(page), "13", String(con)); + + + } } > { setIsDmdModal({ isMoal: false, data: {} as DemandCompType }); @@ -264,9 +269,9 @@ export default function CoSttn() { }} rtnInputData={ async(data) => { const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city; - + console.log('data ', data) if(upadateData?.dmdInfoPk){ - + console.log('data ', data) await updateDemandCompany(data as DemandCompType) coSttnInit("1", "13", String(con)); setIsDmdModal({ isMoal: false, data: data as DemandCompType }); diff --git a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx index eb43b29bf..5ce69d508 100644 --- a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx @@ -3,11 +3,10 @@ import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; import { type customLdrmnt } from "@/app/store/matDmd/ldrmntCoSttn"; -import { ldrmntHeadListExport, ldrmntNodeListExport } from "@/app/store/matDmd/ldrmntCoSttn/headList"; +import { ldrmntHeadListExport } from "@/app/store/matDmd/ldrmntCoSttn/headList"; import { excelDownload, getCity, - getCityOrSgg, tableData } from "@/components/lib/func/commom"; import CoRegExcel from "@/components/ui/modal/coReg/coRegExcel/coRegExcelModal"; @@ -24,54 +23,74 @@ import { Title, UiModal, UiTable, - type ReturnType, type SelectDataType } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components/ui"; -import { useCallback, useEffect, useRef, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; +import { Toaster } from "react-hot-toast"; export default function LdrmntCoSttn() { const { code, ldrmnt, ldrmntInit, ldrmntSearch, } = useWrStore( (state) => state ); - const { ldrmntRes, excelList } = ldrmnt; + const { ldrmntRes, excelList, ldrmntResCount } = ldrmnt; const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customLdrmnt | undefined }>({ data: undefined, isOpen: false }) const [pageNation, setPageNation] = useState(1); const [selectSgg, setSelectSgg] = useState() const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); const [bdstTable, setBdstTable] = useState(); const [searchTxt, setSearchTxt] = useState(); - const ref = useRef({} as ReturnType); const [excelData, setExcelData] = useState(); - const [isExcelDownload, setIsExcelDownload] = useState(false); + // const [isExcelDownload, setIsExcelDownload] = useState(false); const excelClick = useCallback(() => { excelDownload( [[]], - "잠재수요처 관리", + "잠재수요처 등록양식", "sample_ldrmntCoSttn.xlsx", "A1:AL1", 2 ); }, []); - const excelDownloadClick = () => { - ldrmntSearch(1, "10000", "0", ""); - setIsExcelDownload(true); - } + const computeCityNm = () => { + let cityTxt = ""; + let sggTxt = ""; + + if (objSearch.city) { + cityTxt = + code.cityCd.find((c) => c.val === objSearch.city)?.text || ""; + } + if (objSearch.sgg) { + sggTxt = + code.sggCd.find((s) => s.val === objSearch.sgg)?.text || ""; + } + + if (cityTxt === "" || cityTxt === "전체") cityTxt = "0"; + + return sggTxt && sggTxt !== "0" + ? `${cityTxt} ${sggTxt}` + : cityTxt; + }; + + const excelDownloadClick = useCallback(() => { + const cityNm = computeCityNm(); + ldrmntSearch(true, pageNation, String(ldrmntResCount), cityNm, searchTxt || ""); + // setIsExcelDownload(true); + }, [objSearch, pageNation, searchTxt, code, ldrmntSearch, computeCityNm, ldrmntResCount]); useEffect(() => { - if (isExcelDownload && excelData && excelData.length > 0) { + if (/*isExcelDownload &&*/ excelData && excelData.length > 0) { downloadExcel({ data: excelData, fileName: "잠재수요처 관리", sheetNameArray: ["Sheet1"], headerRange: "A1:F1" }); - setIsExcelDownload(false); + // setIsExcelDownload(false); } - }, [excelData, isExcelDownload]); + }, [excelData, /*isExcelDownload*/]); const [isExcelOpen, setIsExcelOpen] = useState<{ isModal: boolean; @@ -141,33 +160,8 @@ export default function LdrmntCoSttn() { }, [excelList]) useEffect(() => { - let cityTxt = '' - let sggTxt = '' - - if (objSearch?.city.toString().length > 0) { - cityTxt = code.cityCd.find((item) => item.val === objSearch?.city)?.text ?? ''; - } - - if (objSearch?.sgg.toString().length > 1) { - sggTxt = code.sggCd.find((item) => item.val === objSearch?.sgg)?.text ?? ''; - } - - if (cityTxt === '전체' || cityTxt === '') { - cityTxt = '0' - } - - let cityNm = "" - - if (sggTxt !== "0") { - cityNm = cityTxt + " " + sggTxt - } else { - cityNm = cityTxt - } - if (cityNm) { - ldrmntSearch(pageNation, '20', cityNm, searchTxt || ""); - } else { - ldrmntSearch(pageNation, '20', '0', searchTxt || ""); - } + const cityNm = computeCityNm(); + ldrmntSearch(false, pageNation, '20', cityNm, searchTxt || ""); }, [pageNation]); return ( @@ -210,32 +204,8 @@ export default function LdrmntCoSttn() { - + {formWatch && formWatch[0]?.pbnstRuseFcltPk ? ( + + + + 시설정보 + + + 차수별정보 + + + + - - ) : ( - <> + + + + ) : ( + <>
- 등록된 재이용시설 정보가 없습니다. + 등록된 재이용시설 정보가 없습니다.
-
-

- 신규등록 버튼을 클릭하여 재이용시설을 등록해주세요. -

- -
- + + - )} - + )} } bodyClass="w-[68vw] max-w-none h-[90vh]" diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index 6c97f6c8c..426ca7f61 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -29,7 +29,7 @@ export default function Home() { return state; } ); - const { rainRes,rainResCount } = rain; + const { rainRes, rainResCount } = rain; const [rainForm, setRainForm] = useState(); const [issNewReg, setIsNewReg] = useState(false); const [pageNation, setPageNation] = useState(1); @@ -48,26 +48,27 @@ export default function Home() { }, [rain.isInit, initRain]); useEffect(() => { - if (code.sggCd.length > 0) { + if (code.sggCd.length > 0) { + if (rainRes && rainRes.length > 0) { + const rainData = tableData(rainRes, { code }).map( + (item: customRainBdst) => { + let archArea = + item?.archArea.split(".")[0] !== "-1" + ? item?.archArea.split(".")[0] + : "확인불가"; + return { + ...item, + archArea: archArea, - if(rainRes&& rainRes.length>0){ + bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N", + }; + } + ); - const rainData = tableData(rainRes, { code }).map( - (item: customRainBdst) => { - let archArea = item?.archArea.split('.')[0]!=='-1'?item?.archArea.split('.')[0]:'확인불가' - return { - ...item, - archArea:archArea, - - bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N", - }; - } - ); - - setbdstTable(rainData); - }else{ - setbdstTable([]); - } + setbdstTable(rainData); + } else { + setbdstTable([]); + } } }, [code, rainRes]); const cellClick: (val: number | undefined, headId: string) => void = ( @@ -117,7 +118,8 @@ export default function Home() { className="" size={"sm"} onClick={(e) => { - rainSearch(searchTxt || "", pageNation, "41"); + rainSearch(searchTxt || "", 1, "41"); + //rainSearch(searchTxt || "", pageNation, "41"); }} > 조회 diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx index b943e8b4f..e7685ebbd 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx @@ -39,12 +39,13 @@ export default function HtdflSttn() { const { code, htdflSttn, htdflSttnSearch, initHtdfl } = useWrStore( (state) => state ); - const { htdflSttnRes } = htdflSttn; + const { htdflSttnRes, htdflSttnResCount } = htdflSttn; const ref = useRef({} as ReturnType); const [pageNation, setPageNation] = useState(1); const [isChHead, setIsChHead] = useState(false); + const [resetPage, isResetPage] = useState(false); const [bdstTable, setBdstTable] = useState(); const [selectSgg, setSelectSgg] = useState() const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); @@ -61,11 +62,12 @@ export default function HtdflSttn() { const excelClick = useCallback(() => { // 최신 검색 조건 반영 const con = getConValue(); - htdflSttnSearch(true, 1, "20", String(con), fcltNm, code.cityCd, code.sggCd); - }, [htdflSttnSearch, objSearch, code.cityCd, code.sggCd]); + htdflSttnSearch(true, 1, String(htdflSttnResCount), String(con), fcltNm, code.cityCd, code.sggCd); + }, [htdflSttnSearch, objSearch, code.cityCd, code.sggCd, fcltNm, htdflSttnResCount]); useEffect(() => { htdflSttnSearch(false, pageNation, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd); + isResetPage(false) }, [pageNation]); const getSelCity = (val: string | number) => { @@ -120,7 +122,7 @@ export default function HtdflSttn() { useEffect(() => { if (!htdflSttn.isInit) { - initHtdfl(1, "20", "0", fcltNm, code.cityCd, code.sggCd); + initHtdfl(false, 1, "20", "0", fcltNm, code.cityCd, code.sggCd); } }, [htdflSttn.isInit, initHtdfl]); @@ -181,8 +183,8 @@ export default function HtdflSttn() { +

@@ -314,7 +316,6 @@ export default function Page() { - + + setSearchTxt(e.target.value)} + /> +

건축물 목록 - (유의 사항: 신규등록하려는 건축물이 목록에 없을 경우 하단 건축물 정보에 추가하여 주시기 바랍니다.) + (유의 사항: 신규등록하려는 건축물이 목록에 없을 경우 하단 건축물 + 정보에 추가하여 주시기 바랍니다.)

@@ -134,24 +192,40 @@ export function BdstReg({ moType,setIsModal,isModal }: BdstReg pageSize={-10} total={-1} headName={undefined} - cellClick={(idx, headId) => (tableClick(idx, headId || ""))} + cellClick={(idx, headId) => tableClick(idx, headId || "")} onPageChange={function (page: number): void { throw new Error("Function not implemented."); - }}> - + }} + >
{/* */} -
- { moType === 'RNB'? - - :moType==='RST' - ? {setIsModal && setIsModal(open)}}> - :{setIsModal && setIsModal(open)}}> - } - -
+
+ {moType === "RNB" ? ( + + ) : moType === "RST" ? ( + { + setIsModal && setIsModal(open); + }} + > + ) : ( + { + setIsModal && setIsModal(open); + }} + > + )} +
{/*
*/}