wr: 수요처관리 전화번호에 -
This commit is contained in:
+3
-3
@@ -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
|
||||
|
||||
@@ -80,9 +80,19 @@ export default function CoMatRvw() {
|
||||
const [selectionVersion, setSelectionVersion] = useState(0);
|
||||
const bottomRef = useRef<HTMLDivElement | null>(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);
|
||||
}}
|
||||
></UiTable>
|
||||
<div ref={bottomRef} />
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* 수요처매칭 > 재이용검토이력
|
||||
*/
|
||||
"use client";
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
|
||||
@@ -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") ?? ""
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user