diff --git a/apps/dm/app/store/sdmMng/index.tsx b/apps/dm/app/store/sdmMng/index.tsx index 0041f5a93..c51209515 100644 --- a/apps/dm/app/store/sdmMng/index.tsx +++ b/apps/dm/app/store/sdmMng/index.tsx @@ -43,6 +43,34 @@ export const sdmInfoFormSchema = z.object({ export type SdmInfoFormData = z.infer; +const formatTelno = (telno?: string | null) => { + const digits = (telno ?? '').replace(/\D/g, ''); + + if (!digits) { + return ''; + } + + if (digits.startsWith('02')) { + if (digits.length === 9) { + return digits.replace(/(02)(\d{3})(\d{4})/, '$1-$2-$3'); + } + + if (digits.length === 10) { + return digits.replace(/(02)(\d{4})(\d{4})/, '$1-$2-$3'); + } + } + + if (digits.length === 10) { + return digits.replace(/(\d{3})(\d{3})(\d{4})/, '$1-$2-$3'); + } + + if (digits.length === 11) { + return digits.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'); + } + + return telno ?? ''; +}; + // 수요처 정보 export type DemandCompBizType = { @@ -530,7 +558,7 @@ const getDemandCompList = async (searchText: string, pageCnt: number) => { const getSdmInfoStatusList = async (dmdInfoId: string) => { try { - const url = '/reuseFc/request/' + dmdInfoId; + const url = '/reuseFc/request/' + dmdInfoId + '?infoListYn=Y'; const res = await getFetch(fetchType.WR, url); return res?.data || []; } catch (error) { @@ -694,7 +722,7 @@ export const SdmReducer = (set: any): SdmActions => { dmdInfoId: res.dmdInfoId, zip: res.zip || '', daddr: res.daddr, - telno: res.telno.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'), + telno: formatTelno(res.telno), rgtr: res.rgtr, ctpvCd: res.ctpvCd, sggCd: res.sggCd, diff --git a/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx b/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx index b56e7a230..580edc7a3 100644 --- a/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx +++ b/apps/wr/app/(with-layout)/matMng/coMng/coSttn/page.tsx @@ -70,6 +70,16 @@ export default function CoSttn() { const [updateData, setUpdateData] = useState(); const [isResetSelection, setIsResetSelection] = useState(false); + const sanitizeDemandForPopup = useCallback((data?: DemandCompType) => { + if (!data) { + return undefined; + } + + const nextData = { ...data }; + nextData.dmdAplyPswd = ""; + return nextData; + }, []); + const getSelCity = useCallback( (val: string | number) => { const cityValue = String(val); @@ -330,11 +340,13 @@ export default function CoSttn() { total={coSttnResCount || 0} cellClick={async(index: number | undefined) => { const uuid = await getMyUUID(); - const updateData = coSttnRes[index as number]; - if (updateData && typeof uuid === "string") { - updateData.mdfr = uuid; + const selectedData = sanitizeDemandForPopup( + coSttnRes[index as number] + ); + if (selectedData && typeof uuid === "string") { + selectedData.mdfr = uuid; } - setUpdateData(coSttnRes[index as number]); + setUpdateData(selectedData); }} onPageChange={(page) => { const con = diff --git a/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx b/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx index fca1b511a..0bc0554f3 100644 --- a/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx +++ b/apps/wr/app/(with-layout)/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx @@ -35,7 +35,7 @@ import { } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button, Label, Table, TableBody, TableHeader } from "@common/components/ui"; -import { useCallback, useEffect, useMemo, useState } from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { useAlertStore } from "@/src/shared/lib"; import { useTranslation } from "react-i18next"; import { headMakeprfmnc } from "../chkgdnReg/TableHead"; @@ -150,6 +150,7 @@ export default function PrfmncPrfmncReg() { const [searchTxt, setSearchTxt] = useState(""); const [selectedFacilityId, setSelectedFacilityId] = useState(""); const [selectedIndex, setSelectedIndex] = useState(0); + const [shouldLoadFirstRow, setShouldLoadFirstRow] = useState(true); const [inputData, setInputData] = useState([]); const [isExcelOpen, setIsExcelOPen] = useState<{ isModal: boolean; @@ -159,6 +160,7 @@ export default function PrfmncPrfmncReg() { const { confirm } = useConfirm(); const alert = useAlertStore((state) => state.setMessage); const { t } = useTranslation("base"); + const prevSearchYearRef = useRef(searchYear); const bdstTable = useMemo( () => @@ -190,7 +192,6 @@ export default function PrfmncPrfmncReg() { const detail = await getPbnstPrfRegDtl(searchYear, facilityId); if (detail) { - setSelectedFacilityId(facilityId); setIsExcelOPen((prev) => ({ ...prev, data: detail, @@ -203,6 +204,7 @@ export default function PrfmncPrfmncReg() { const handleSearch = useCallback(() => { if (!laeSeCd) return; + setShouldLoadFirstRow(true); setIsReset(true); }, [laeSeCd]); @@ -233,6 +235,7 @@ export default function PrfmncPrfmncReg() { useEffect(() => { if (!laeSeCd) return; + setShouldLoadFirstRow(true); void prfmncHasuInit(1, laeSeCd); }, [laeSeCd, prfmncHasuInit]); @@ -245,20 +248,21 @@ export default function PrfmncPrfmncReg() { return; } - const nextIndex = Math.max( - prfmncRes.findIndex((item) => item.pbnstRuseFcltId === selectedFacilityId), - 0 - ); - const nextFacility = prfmncRes[nextIndex]; - if (!nextFacility) { - return; - } + if (!shouldLoadFirstRow) return; - setSelectedIndex(nextIndex); - void loadDetail(nextFacility.pbnstRuseFcltId); - }, [loadDetail, prfmncRes]); + const firstFacility = prfmncRes[0]; + if (!firstFacility) return; + + setSelectedIndex(0); + setSelectedFacilityId(firstFacility.pbnstRuseFcltId); + void loadDetail(firstFacility.pbnstRuseFcltId); + setShouldLoadFirstRow(false); + }, [loadDetail, prfmncRes, shouldLoadFirstRow]); useEffect(() => { + if (prevSearchYearRef.current === searchYear) return; + + prevSearchYearRef.current = searchYear; if (!selectedFacilityId) return; void loadDetail(selectedFacilityId); }, [loadDetail, searchYear, selectedFacilityId]); @@ -342,7 +346,7 @@ export default function PrfmncPrfmncReg() {
- + { + setShouldLoadFirstRow(true); if (searchTxt.trim().length > 0) { void prfmncHasuNmSearch(page, laeSeCd, searchTxt); } else { @@ -373,7 +380,7 @@ export default function PrfmncPrfmncReg() {
- +

{"하수처리수재이용 실적(m³) 등록결과"} diff --git a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/headList.tsx b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/headList.tsx index 0e19fe52b..4333c6f8a 100644 --- a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/headList.tsx +++ b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/headList.tsx @@ -10,11 +10,11 @@ export const pbnPrfRegExcelZod = z.object({ }); export const pbnstPrfmncHeadListExport: TableUpperProps[] = [ - { id: "sido", title: "시도" }, - { id: "gugun", title: "시군구" }, - { id: "bscFctNm", title: "시설명" }, - { id: "ruseUtztnFcltNm", title: "재이용시설명" }, - { id: "pbnstRuseFcltId", title: "재이용시설코드" }, + { id: "sido", title: "시도", widthPercent: 13 }, + { id: "gugun", title: "시군구", widthPercent: 16 }, + { id: "bscFctNm", title: "시설명", widthPercent: 24 }, + { id: "ruseUtztnFcltNm", title: "재이용시설명", widthPercent: 27 }, + { id: "pbnstRuseFcltId", title: "재이용시설코드", widthPercent: 20 }, ]; export const monthHeadListExport: TableUpperProps[] = [ diff --git a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx index cadba69d4..7b66a5b44 100644 --- a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx +++ b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx @@ -20,7 +20,7 @@ export type pbnstPrfmncState = { isInit: boolean; pbnstPrfmncHeadList: TableUpperProps[]; monthHeadList: TableUpperProps[]; - prfmncRes: PbnstPrfRegListType[]; + prfmncRes: PbnstPrfRegListType[]; // 하수재이용시설 목록 prfmncResCount: number; excelList: number[]; pageKey: number; diff --git a/apps/wr/components/ui/map/detailPopup/coSttnDetailPopup/coSttnDetailPopup.tsx b/apps/wr/components/ui/map/detailPopup/coSttnDetailPopup/coSttnDetailPopup.tsx index bb655f923..56f8efdae 100644 --- a/apps/wr/components/ui/map/detailPopup/coSttnDetailPopup/coSttnDetailPopup.tsx +++ b/apps/wr/components/ui/map/detailPopup/coSttnDetailPopup/coSttnDetailPopup.tsx @@ -7,6 +7,8 @@ export default function CoSttnDetailPopup({isDetail} :{isDetail:DemandCompType}) code } = useWrStore((state) => state); + const detailData = { ...isDetail }; + detailData.dmdAplyPswd = ""; return(
@@ -21,7 +23,7 @@ export default function CoSttnDetailPopup({isDetail} :{isDetail:DemandCompType}) console.log(data) }} bodyClassNm={"w-full mx-auto bg-background rounded-lg shadow-md p-6"} - updateList={isDetail} + updateList={detailData} readOnly={true} openNetwork={false} > diff --git a/apps/wr/src/app/providers/app-provider.tsx b/apps/wr/src/app/providers/app-provider.tsx index 81b8a5a69..110b718ec 100644 --- a/apps/wr/src/app/providers/app-provider.tsx +++ b/apps/wr/src/app/providers/app-provider.tsx @@ -49,10 +49,13 @@ function CommonCodeInitializer() { useEffect(() => { if (isLoginPage) return; if (isInit) return; - setTimeout(() => { - initCommonCodes(); - }, 3000); // 3초 후에 하는 것으로 왜냐하면 로그인 처리가 먼저 되어야 하기 때문에 - + + // 첫 페인트 이후 바로 공통 코드를 불러와 초기 화면 지연을 줄입니다. + const timer = window.setTimeout(() => { + void initCommonCodes(); + }, 2000); + + return () => window.clearTimeout(timer); }, [isInit, initCommonCodes, isLoginPage]); return null;