침입수 분석결과 실측하수량 관로 우선 줌인 및 지역 선이동 제거
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"use client";
|
||||
"use client";
|
||||
import { SelectBox, type SelectDataType } from "../../../ui";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
@@ -29,7 +29,7 @@ interface SearchBarProps {
|
||||
}
|
||||
|
||||
interface CenterSelectDataType extends SelectDataType {
|
||||
center?: [number, number]; // 좌표 중심 위치
|
||||
center?: [number, number]; // 醫뚰몴 以묒떖 ?꾩튂
|
||||
}
|
||||
|
||||
export const ProcSearchBar = ({
|
||||
@@ -74,7 +74,7 @@ export const ProcSearchBar = ({
|
||||
center: sidoCenter[String(f.properties.mctpv_cd ?? "").trim()] //getGeometryCenter(f.geometry) ?? undefined,
|
||||
}))
|
||||
.sort((a: any, b: any) => {
|
||||
// 커스텀 순서 정의
|
||||
// 而ㅼ뒪? ?쒖꽌 ?뺤쓽
|
||||
const customOrder = [
|
||||
"서울특별시",
|
||||
"부산광역시",
|
||||
@@ -98,19 +98,19 @@ export const ProcSearchBar = ({
|
||||
const indexA = customOrder.indexOf(a.text);
|
||||
const indexB = customOrder.indexOf(b.text);
|
||||
|
||||
// 둘 다 커스텀 순서에 있으면 해당 순서로
|
||||
// ????而ㅼ뒪? ?쒖꽌???덉쑝硫??대떦 ?쒖꽌濡?
|
||||
if (indexA !== -1 && indexB !== -1) {
|
||||
return indexA - indexB;
|
||||
}
|
||||
|
||||
// 하나만 커스텀 순서에 있으면 그것을 앞으로
|
||||
// ?섎굹留?而ㅼ뒪? ?쒖꽌???덉쑝硫?洹멸쾬???욎쑝濡?
|
||||
if (indexA !== -1) return -1;
|
||||
if (indexB !== -1) return 1;
|
||||
|
||||
// 둘 다 커스텀 순서에 없으면 기본 알파벳 순서
|
||||
// ????而ㅼ뒪? ?쒖꽌???놁쑝硫?湲곕낯 ?뚰뙆踰??쒖꽌
|
||||
return a.text.localeCompare(b.text, 'ko');
|
||||
});
|
||||
setSidoData([{ text: "시도", val: "0" }, ...list]);
|
||||
setSidoData([{ text: "?쒕룄", val: "0" }, ...list]);
|
||||
};
|
||||
|
||||
const fetchSigungu = async () => {
|
||||
@@ -174,7 +174,7 @@ export const ProcSearchBar = ({
|
||||
const json = await res.json();
|
||||
list = (json.features || [])
|
||||
.map((f: any) => ({
|
||||
text: f.properties.swtrmt_fclt_nm ?? "(이름없음)",
|
||||
text: f.properties.swtrmt_fclt_nm ?? "(?대쫫?놁쓬)",
|
||||
val: f.id,
|
||||
}))
|
||||
.sort((a: any, b: any) => a.text.localeCompare(b.text, "ko"));
|
||||
@@ -193,28 +193,28 @@ export const ProcSearchBar = ({
|
||||
});
|
||||
const json = await res.json();
|
||||
list = (json.data || []).map((item: any) => ({
|
||||
text: item.ruseUtztnFcltNm ?? "(이름없음)",
|
||||
text: item.ruseUtztnFcltNm ?? "(?대쫫?놁쓬)",
|
||||
val: item.pbnstRuseFcltId,
|
||||
}));
|
||||
} else if (type === "tb_wr_ruse_fclt_dmd_co") {
|
||||
const res = await fetch(url);
|
||||
const json = await res.json();
|
||||
list = (json.data || []).map((item: any) => ({
|
||||
text: item.dmdCoNm ?? "(이름없음)",
|
||||
text: item.dmdCoNm ?? "(?대쫫?놁쓬)",
|
||||
val: item.dmdInfoId,
|
||||
}));
|
||||
} else if (type === "tb_wr_tmpr_dmd_co") {
|
||||
const res = await fetch(url);
|
||||
const json = await res.json();
|
||||
list = (json.data || []).map((item: any) => ({
|
||||
text: item.dmdCoNm ?? "(이름없음)",
|
||||
text: item.dmdCoNm ?? "(?대쫫?놁쓬)",
|
||||
val: item.fctryMngSn,
|
||||
}));
|
||||
} else {
|
||||
const res = await fetch(url);
|
||||
const json = await res.json();
|
||||
list = (json.data || []).map((item: any) => ({
|
||||
text: item.bdstNm ?? "(이름없음)",
|
||||
text: item.bdstNm ?? "(?대쫫?놁쓬)",
|
||||
val: item.bdstInfoSn,
|
||||
}));
|
||||
}
|
||||
@@ -264,7 +264,7 @@ export const ProcSearchBar = ({
|
||||
|
||||
const prefix = nextSidoCd.substring(0, 2);
|
||||
const filtered = sigunData.filter((item) => item.val.startsWith(prefix));
|
||||
setFilteredSigunData([{ text: "시군구", val: "0" }, ...filtered]);
|
||||
setFilteredSigunData([{ text: "시군구", val: "0" }, ...filtered]);
|
||||
setSigunValue("0");
|
||||
},
|
||||
[sigunData],
|
||||
@@ -315,7 +315,7 @@ export const ProcSearchBar = ({
|
||||
|
||||
const handleSearch = useCallback(() => {
|
||||
if (sidoValue === "0") {
|
||||
alert("시도를 선택해 주세요");
|
||||
alert("시도를 선택해 주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -344,10 +344,12 @@ export const ProcSearchBar = ({
|
||||
ctpvCd?: string;
|
||||
sggCd?: string;
|
||||
swtrmtFcltNm?: string;
|
||||
suppressMapMove?: boolean;
|
||||
}>;
|
||||
const nextCtpvCd = String(event.detail?.ctpvCd ?? "0").trim() || "0";
|
||||
const nextSggCd = String(event.detail?.sggCd ?? "0").trim() || "0";
|
||||
const nextSwtrmtFcltNm = String(event.detail?.swtrmtFcltNm ?? "").trim();
|
||||
const suppressMapMove = Boolean(event.detail?.suppressMapMove);
|
||||
const nextSidoCenter = sidoCenter[nextCtpvCd.slice(0, 2)];
|
||||
const nextSigunguCenter = getSigunguCenter(nextSggCd);
|
||||
|
||||
@@ -364,6 +366,10 @@ export const ProcSearchBar = ({
|
||||
setFacilityValue("0");
|
||||
setPendingExternalFacilityName(nextSwtrmtFcltNm);
|
||||
|
||||
if (suppressMapMove) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nextSggCd !== "0" && nextSigunguCenter) {
|
||||
moveMapToCenter(gisMaps, nextSigunguCenter, 12);
|
||||
return;
|
||||
@@ -430,7 +436,7 @@ export const ProcSearchBar = ({
|
||||
/>
|
||||
<div className="flex flex-row space-x-2">
|
||||
<Button color="primary" className="mx-2 mt-1" size="sm" onClick={handleSearch}>
|
||||
조회
|
||||
議고쉶
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user