로그인 사용자 건축물 등록 시도코드 적용/ 하수처리장 지도PopUp data 오류 슈ㅜ정/지도점검 오류 수정
This commit is contained in:
@@ -37,7 +37,11 @@ export const tableData = (data: any, code: comCodeState) => {
|
||||
(item: {
|
||||
sggCd: string;
|
||||
ctpvCd: string;
|
||||
reuseBuilding: { lawTrgtYn: string; bdstUsgCd: string ,grntchBdstCertGrd:string}[];
|
||||
reuseBuilding: {
|
||||
lawTrgtYn: string;
|
||||
bdstUsgCd: string;
|
||||
grntchBdstCertGrd: string;
|
||||
}[];
|
||||
}) => {
|
||||
let returnData = {};
|
||||
const sggText = chCode.sggCd.find(
|
||||
@@ -47,15 +51,13 @@ export const tableData = (data: any, code: comCodeState) => {
|
||||
(cd) => cd.val === String(item.ctpvCd).trim()
|
||||
)?.text;
|
||||
if (item?.reuseBuilding?.length > 0) {
|
||||
|
||||
const bdsgUsgText = chCode?.bdstTotalUsgType?.find(
|
||||
(cd) => cd.val === item?.reuseBuilding[0]?.bdstUsgCd
|
||||
)?.text;
|
||||
|
||||
const lawTrgtYn = item?.reuseBuilding[0]?.lawTrgtYn;
|
||||
|
||||
|
||||
const grntchBdstCertGrdText =chCode?.bdstGrntchClass?.find(
|
||||
const grntchBdstCertGrdText = chCode?.bdstGrntchClass?.find(
|
||||
(cd) => cd.val === item?.reuseBuilding[0]?.grntchBdstCertGrd
|
||||
)?.text;
|
||||
|
||||
@@ -65,7 +67,7 @@ export const tableData = (data: any, code: comCodeState) => {
|
||||
cityText: cityText ?? "없음",
|
||||
bdsgUsgText: bdsgUsgText,
|
||||
lawTrgtYn: lawTrgtYn,
|
||||
grntchBdstCertGrdText:grntchBdstCertGrdText
|
||||
grntchBdstCertGrdText: grntchBdstCertGrdText,
|
||||
};
|
||||
} else {
|
||||
returnData = {
|
||||
@@ -160,13 +162,13 @@ export const formatCommaNumber = (
|
||||
};
|
||||
|
||||
//내가 쓰는 값이 숫자이냐 아니냐
|
||||
export const isNumeric =(value: string) => {
|
||||
if(value&&value.length>0){
|
||||
export const isNumeric = (value: string) => {
|
||||
if (value && value.length > 0) {
|
||||
return value?.trim() !== "" && !isNaN(Number(value));
|
||||
}else{
|
||||
return false
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const getCityOrSgg = (ref: RefObject<ReturnType>) => {
|
||||
let con;
|
||||
@@ -219,11 +221,15 @@ export const formatPhoneNumber = (tel: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const confirmToast = (content: string, saveFunc: () => void, contentClass?:string) => {
|
||||
export const confirmToast = (
|
||||
content: string,
|
||||
saveFunc: () => void,
|
||||
contentClass?: string
|
||||
) => {
|
||||
toast(
|
||||
(t) => (
|
||||
<span className="flex flex-col items-center">
|
||||
<div className={`mb-6 ${contentClass}`} >{content}</div>
|
||||
<div className={`mb-6 ${contentClass}`}>{content}</div>
|
||||
<div className="flex flex-row space-x-2">
|
||||
<Button
|
||||
size={"sm"}
|
||||
@@ -289,8 +295,7 @@ export const formatYyyymmdd = (val: string | undefined) => {
|
||||
* @param value 입력 문자열
|
||||
* @param digits 소수점 자릿수 (기본 0 = 정수 반올림)
|
||||
*/
|
||||
export const formatArchArea =(value: string, digits: number=0 ) => {
|
||||
|
||||
export const formatArchArea = (value: string, digits: number = 0) => {
|
||||
// "확인불가" 등 숫자 아님 → 그대로 반환
|
||||
const cleaned = value.replace(/,/g, "");
|
||||
const num = parseFloat(cleaned);
|
||||
@@ -304,23 +309,83 @@ export const formatArchArea =(value: string, digits: number=0 ) => {
|
||||
|
||||
// 다시 천 단위 콤마 찍어서 반환
|
||||
return Number(rounded).toLocaleString();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const codeToText = ( val:string, codeName:string ) =>{
|
||||
|
||||
if(val===''|| val===undefined){
|
||||
return ''
|
||||
export const codeToText = (val: string, codeName: string) => {
|
||||
if (val === "" || val === undefined) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return lwCds[codeName]?.find((cd) => cd.val ===val)?.text
|
||||
}
|
||||
return lwCds[codeName]?.find((cd) => cd.val === val)?.text;
|
||||
};
|
||||
|
||||
export const textToCode = (text:string, codeName:string) =>{
|
||||
if(text===''|| text===undefined){
|
||||
return ''
|
||||
export const textToCode = (text: string, codeName: string) => {
|
||||
if (text === "" || text === undefined) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return lwCds[codeName]?.find((cd) => cd.text ===text)?.val
|
||||
return lwCds[codeName]?.find((cd) => cd.text === text)?.val;
|
||||
};
|
||||
|
||||
// export const handleLaeSeCdChange = (
|
||||
// laeSeCd: string,
|
||||
// cityCd: SelectDataType[],
|
||||
// sggCd: SelectDataType[]
|
||||
// ): { isCityCd: SelectDataType[]; isSggCd: SelectDataType[] } => {
|
||||
// if (laeSeCd.length !== 5 && cityCd.length > 0) {
|
||||
// const city =
|
||||
// laeSeCd === "0" ? cityCd : cityCd.filter((item) => item.val === laeSeCd);
|
||||
|
||||
// const sgg = sggCd.filter((item) => item.val.slice(0, 2) === laeSeCd);
|
||||
// sgg.unshift({ text: "전체", val: "0" });
|
||||
|
||||
// return { isCityCd: city, isSggCd: sgg };
|
||||
// } else if (laeSeCd.length === 5 && cityCd.length > 0 && sggCd.length > 0) {
|
||||
// const city = cityCd.filter((item) => item.val === laeSeCd.slice(0, 2));
|
||||
|
||||
// const sgg = sggCd.filter((item) => item.val === laeSeCd);
|
||||
// sgg.unshift({ text: "전체", val: "0" });
|
||||
|
||||
// return { isCityCd: city, isSggCd: sgg };
|
||||
// }
|
||||
|
||||
// // 기본 반환값 (조건에 안 맞을 때)
|
||||
// return { isCityCd: [], isSggCd: [] };
|
||||
// };
|
||||
|
||||
|
||||
|
||||
|
||||
export function handleLaeSeCdChange(
|
||||
laeSeCd: string,
|
||||
cityCd: SelectDataType[] = [],
|
||||
sggCd: SelectDataType[] = []
|
||||
): { isCityCd: SelectDataType[]; isSggCd: SelectDataType[] } {
|
||||
const isAll = laeSeCd === "0"; // 전체
|
||||
const isSgg = laeSeCd.length === 5; // 시군구 코드
|
||||
const prefix = isAll ? "" : laeSeCd.slice(0, 2); // 시 코드(앞 2자리)
|
||||
|
||||
// 시 리스트: 전체면 전부, SGG 선택이면 해당 시만, 시 선택이면 그 시만
|
||||
const isCityCd = isAll
|
||||
? cityCd
|
||||
: isSgg
|
||||
? cityCd.filter(city => city.val === prefix)
|
||||
: cityCd.filter(city => city.val === laeSeCd);
|
||||
|
||||
// 시군구 리스트: 전체면 비움(+ 전체만), 아니면 prefix로 필터
|
||||
const sggInCity = isAll
|
||||
? []
|
||||
: sggCd.filter(s => s.val.slice(0, 2) === prefix);
|
||||
|
||||
// 선택된 SGG가 있으면 맨 위로(옵션)
|
||||
const sggOrdered = isSgg
|
||||
? [...sggInCity].sort((a, b) =>
|
||||
a.val === laeSeCd ? -1 : b.val === laeSeCd ? 1 : 0
|
||||
)
|
||||
: sggInCity;
|
||||
|
||||
return {
|
||||
isCityCd,
|
||||
isSggCd: [{ text: "전체", val: "0" }, ...sggOrdered],
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user