From 57904427cf138f450bd9c7b21e503acd0a86dc85 Mon Sep 17 00:00:00 2001 From: ljpark Date: Fri, 27 Mar 2026 17:07:50 +0900 Subject: [PATCH] =?UTF-8?q?wr:=20=EC=88=98=EC=9A=94=EC=B2=98=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EC=A0=84=ED=99=94=EB=B2=88=ED=98=B8=EC=97=90=20-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/.env.local | 6 +- .../matMng/coMat/coMatRvw/page.tsx | 32 +++++---- .../matMng/coMat/ruseRvwHstry/page.tsx | 3 + apps/wr/app/store/matDmd/coSttn/excel.tsx | 8 ++- apps/wr/components/lib/func/noUtil.ts | 68 +++++++++++++++++++ 5 files changed, 98 insertions(+), 19 deletions(-) create mode 100644 apps/wr/components/lib/func/noUtil.ts diff --git a/apps/wr/.env.local b/apps/wr/.env.local index 19f7f5a24..13d32a5a3 100644 --- a/apps/wr/.env.local +++ b/apps/wr/.env.local @@ -12,10 +12,10 @@ NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver -# NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1 -NEXT_PUBLIC_WR_SERVER_API_URL = http://192.168.1.222:8883/reuse-service/api/v1 +NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1 +# NEXT_PUBLIC_WR_SERVER_API_URL = http://localhost:8883/reuse-service/api/v1 NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API -# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service +# NEXT_PUBLIC_SEWERAGE_API_URL=http://localhost:8883/sewerage-service NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login diff --git a/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx index 330847f86..0840bba76 100644 --- a/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx @@ -80,9 +80,19 @@ export default function CoMatRvw() { const [selectionVersion, setSelectionVersion] = useState(0); const bottomRef = useRef(null); + const getCurrentRegionCode = () => { + if (String(objSearch.sgg).length > 0 && String(objSearch.sgg) !== "0") { + return String(objSearch.sgg); + } + if (String(objSearch.city).length > 0) { + return String(objSearch.city); + } + return ""; + }; //수요 매칭 검색 const getSearch = ( + pageNo: number, startYear: number, endYear: number, sggCd: string, @@ -90,7 +100,7 @@ export default function CoMatRvw() { ) => { if (dmdCoNm.length > 0) { coMatRvwSearch( - pageNation, + pageNo, 13, String(startYear), String(endYear), @@ -98,7 +108,7 @@ export default function CoMatRvw() { dmdCoNm ); } else { - coMatRvwInqua(pageNation, 13, String(startYear), String(endYear), sggCd); + coMatRvwInqua(pageNo, 13, String(startYear), String(endYear), sggCd); } }; @@ -268,17 +278,9 @@ export default function CoMatRvw() { "시작년도가 종료년도 이후로 설정할 수 없습니다." ); } else { - let con: string | number = ""; - if (String(objSearch.city).length > 0) { - con = String(objSearch.city); - } - if ( - String(objSearch.sgg).length > 0 && - String(objSearch.sgg) !== "0" - ) { - con = String(objSearch.sgg); - } - getSearch(fromNum, toNum, con, dmdCoNm); + const con = getCurrentRegionCode(); + setPageNatiion(1); + getSearch(1, fromNum, toNum, con, dmdCoNm); } } }} @@ -299,7 +301,7 @@ export default function CoMatRvw() { headName={"수요매칭검토현황"} tableData={dmdMatData || []} headlist={coRvwHeadList} - pageSize={20} + pageSize={13} total={coMatRvwCount} cellClick={(index: number | undefined) => { if (index !== undefined && index >= 0) { @@ -307,7 +309,9 @@ export default function CoMatRvw() { } }} onPageChange={(val) => { + const con = getCurrentRegionCode(); setPageNatiion(val); + getSearch(val, Number(fromDate), Number(toDate), con, dmdCoNm); }} >
diff --git a/apps/wr/app/(with-layout)/matMng/coMat/ruseRvwHstry/page.tsx b/apps/wr/app/(with-layout)/matMng/coMat/ruseRvwHstry/page.tsx index 46f4e9ded..392cc2fd3 100644 --- a/apps/wr/app/(with-layout)/matMng/coMat/ruseRvwHstry/page.tsx +++ b/apps/wr/app/(with-layout)/matMng/coMat/ruseRvwHstry/page.tsx @@ -1,3 +1,6 @@ +/** + * 수요처매칭 > 재이용검토이력 + */ "use client"; import { useWrStore } from "@/app/store"; diff --git a/apps/wr/app/store/matDmd/coSttn/excel.tsx b/apps/wr/app/store/matDmd/coSttn/excel.tsx index 84c982292..0bdf7ef6e 100644 --- a/apps/wr/app/store/matDmd/coSttn/excel.tsx +++ b/apps/wr/app/store/matDmd/coSttn/excel.tsx @@ -1,5 +1,9 @@ import type { SelectDataType } from "@common/business_components/ui"; import moment from "moment"; +import { + formatKoreanPhoneNumber, + formatValueByPattern, +} from "@/components/lib/func/noUtil"; export const excelCoSttnParsing = (data: any[],sidoCode:SelectDataType[] , sggCode:SelectDataType[]): string[][] => { const excelExportData: string[][] = []; @@ -9,8 +13,8 @@ export const excelCoSttnParsing = (data: any[],sidoCode:SelectDataType[] , sggCo sggCode.find((sgg) => sgg.val === item.sggCd.toString().trim() )?.text ?? "", item.dmdCoNm ?? "", item.daddr ?? "", - String(item.dmdInfoId ?? ""), - item.telno ?? "", + formatValueByPattern("000-00-00000-0000", String(item.dmdInfoId ?? "")), + formatKoreanPhoneNumber(String(item.telno ?? "")), moment(item.regDt).format("YYYY-MM-DD") ?? "" ]); }); diff --git a/apps/wr/components/lib/func/noUtil.ts b/apps/wr/components/lib/func/noUtil.ts new file mode 100644 index 000000000..c4ae02784 --- /dev/null +++ b/apps/wr/components/lib/func/noUtil.ts @@ -0,0 +1,68 @@ + +/** + * 전화번호에 - 처리 + * @param value '-'없는 전화번호 + * @returns + */ +export const formatKoreanPhoneNumber = (value: string) => { + const digits = value.replace(/\D/g, "").slice(0, 11); // 숫자만 추출하고 최대 11자리까지만 사용 + if (!digits) return ""; // 입력이 비어 있으면 빈 문자열 반환 + + if (/^1\d{0,7}$/.test(digits)) { // 15xx/16xx/18xx 같은 대표번호 패턴 + if (digits.length <= 4) return digits; // 아직 뒷자리가 부족하면 원문 유지 + return `${digits.slice(0, 4)}-${digits.slice(4, 8)}`; // xxxx-xxxx + } + + if (digits.startsWith("02")) { // 서울 지역번호(02) + const rest = digits.slice(2); // 국번/가입자번호 구간 + if (!rest) return "02"; // 02만 입력된 상태 + if (rest.length <= 3) return `02-${rest}`; // 02-xxx + if (rest.length <= 7) return `02-${rest.slice(0, 3)}-${rest.slice(3)}`; // 02-xxx-xxxx + return `02-${rest.slice(0, 4)}-${rest.slice(4, 8)}`; // 02-xxxx-xxxx + } + + if (digits.startsWith("0")) { // 02 제외 일반 지역번호/휴대폰(010 포함) + const area = digits.slice(0, 3); // 앞 3자리 식별자 + const rest = digits.slice(3); // 나머지 번호 + if (!rest) return area; // 식별자만 입력된 상태 + if (rest.length <= 3) return `${area}-${rest}`; // 0xx-xxx + if (rest.length <= 7) return `${area}-${rest.slice(0, 3)}-${rest.slice(3)}`; // 0xx-xxx-xxxx + return `${area}-${rest.slice(0, 4)}-${rest.slice(4, 8)}`; // 0xx-xxxx-xxxx + } + + if (digits.length <= 4) return digits; // 예외 입력: 앞 4자리까지 + if (digits.length <= 8) return `${digits.slice(0, 4)}-${digits.slice(4)}`; // xxxx-xxxx + return `${digits.slice(0, 4)}-${digits.slice(4, 8)}-${digits.slice(8, 11)}`; // xxxx-xxxx-xxx +}; + +/** + * 숫자 문자열에 형식 문자열을 적용합니다. + * @param format 하이픈 위치를 포함한 형식 문자열. 예: 000-00-00000-0000 + * @param value 형식을 적용할 원본 값 + * @returns 형식이 적용된 문자열 + */ +export const formatValueByPattern = (format: string, value: string) => { + const digits = value.replace(/\D/g, ""); + if (!digits) return ""; + + let digitIndex = 0; + let result = ""; + + for (const char of format) { + if (char === "0") { + if (digitIndex >= digits.length) break; + result += digits[digitIndex]; + digitIndex += 1; + continue; + } + + if (digitIndex >= digits.length) break; + result += char; + } + + if (digitIndex < digits.length) { + result += digits.slice(digitIndex); + } + + return result; +};