Merge commit '4c8ecb05e094965df93dcf474bffa79c5135e61e' into iipbs/dm/dev
This commit is contained in:
@@ -30,6 +30,9 @@ export default function Home() {
|
|||||||
<Button className='ml-5 place-self-auto'>
|
<Button className='ml-5 place-self-auto'>
|
||||||
<Link href="/pages/sdmMng/sdmApplyList">수요처 신청 현황(개발중)</Link>
|
<Link href="/pages/sdmMng/sdmApplyList">수요처 신청 현황(개발중)</Link>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button className='ml-5 place-self-auto'>
|
||||||
|
<Link href="/pages/map/mainMap">수요처 신청 현황(개발중)</Link>
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { SearchBar } from "@/components/ui/map/searchBar/searchBar";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
const Map = () => {
|
||||||
|
|
||||||
|
const [selectDataPk, setSelectDataPk] = useState <string>('')
|
||||||
|
|
||||||
|
// 삭제요망 데이터 선ㅌ
|
||||||
|
useEffect(() =>{
|
||||||
|
console.log("Selected Data Pk: ", selectDataPk);
|
||||||
|
},[selectDataPk])
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<SearchBar
|
||||||
|
setHasuPk={(hasuPk: string) => {
|
||||||
|
console.log("Selected HasuPk: ", hasuPk);
|
||||||
|
if(hasuPk !==""){
|
||||||
|
setSelectDataPk(hasuPk);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Map;
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
import { getFetch } from "@/components/ui/api";
|
||||||
|
import { DEV_URL_FO } from "@/components/ui/config";
|
||||||
|
import type { FacilityInfo } from "./type";
|
||||||
|
|
||||||
|
const checkWrRegList = async () => {
|
||||||
|
const wrRegList = await getFetch("wr", `/reuseFc/pubFc`);
|
||||||
|
return wrRegList;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getRuseFclt = async (
|
||||||
|
page: string,
|
||||||
|
sggOrCity: string,
|
||||||
|
searchTxt?: string
|
||||||
|
) => {
|
||||||
|
const checkWrRegListRes = await checkWrRegList();
|
||||||
|
|
||||||
|
let url = `/prcsFclt/ruseInfo/${page ? page : 1}/11/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`;
|
||||||
|
|
||||||
|
console.log(' checkWrRegListRes ', checkWrRegListRes)
|
||||||
|
const ruseList = checkWrRegListRes.data.filter((item: string) => item !== "");
|
||||||
|
|
||||||
|
if (searchTxt) {
|
||||||
|
url = url + `/${searchTxt}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await fetch(DEV_URL_FO + url, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(ruseList),
|
||||||
|
});
|
||||||
|
|
||||||
|
const hasuList = await response.json().then((res: any) => {
|
||||||
|
|
||||||
|
const data =res.data
|
||||||
|
.map((item: any) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
fctCpc: Number(item.fctCpc) || 0,
|
||||||
|
searchNm: item.fctNm,
|
||||||
|
searchPk: item.bscFctNm,
|
||||||
|
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter((hasu) =>
|
||||||
|
ruseList.find((ruse) => hasu.bscFctCd === ruse)
|
||||||
|
);
|
||||||
|
return{ data: data, count: res.count };
|
||||||
|
|
||||||
|
});
|
||||||
|
return hasuList
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DmMapActions = {
|
||||||
|
findRuseFclt(sggOrCity:string, searchTxt: string): void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DmMapType = {
|
||||||
|
map: {
|
||||||
|
ruseFcltList: FacilityInfo[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const dmMapState: DmMapType = {
|
||||||
|
map: {
|
||||||
|
ruseFcltList: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
export type DmMapStore = DmMapType & DmMapActions;
|
||||||
|
|
||||||
|
export const DmMapReducer = (set: any): DmMapActions => {
|
||||||
|
return {
|
||||||
|
findRuseFclt: async (sggOrCity:string, searchTxt: string) => {
|
||||||
|
const ruseFcltList = await getRuseFclt('1', sggOrCity,searchTxt);
|
||||||
|
|
||||||
|
set((state: DmMapType) => ({
|
||||||
|
map: {
|
||||||
|
...state.map,
|
||||||
|
ruseFcltList :ruseFcltList.data
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
export type FacilityInfo= {
|
||||||
|
bscFctCd: string; // 기본시설 코드
|
||||||
|
bscFctNm: string; // 기본시설명
|
||||||
|
rvbsnCd: string; // 유역 코드
|
||||||
|
rvbsn: string; // 유역명
|
||||||
|
lgbsn: string; // 대권역명
|
||||||
|
mdmbsn: string; // 중권역명
|
||||||
|
rgnCd: string; // 관할청 코드
|
||||||
|
rgnNm: string; // 관할청 명칭
|
||||||
|
adstDstrCd: string; // 행정구역 코드
|
||||||
|
sido: string; // 시도
|
||||||
|
gugun: string; // 구군
|
||||||
|
addr: string; // 주소
|
||||||
|
fctCpc: string; // 시설용량
|
||||||
|
efflWqltStndrdCd: string; // 방류수 수질기준 코드
|
||||||
|
efflWqltStndrdNm: string; // 방류수 수질기준명
|
||||||
|
trtFrfNm: string; // 처리공법명
|
||||||
|
trtDstr: string; // 처리구역
|
||||||
|
rnDt: string; // 사용개시일 (예: YYYYMMDD)
|
||||||
|
cmplDt: string; // 준공일자 (예: YYYYMMDD)
|
||||||
|
trstOprEtpNm: string; // 위탁운영기관명
|
||||||
|
bscFctClsNm: string; // 기본시설 구분명
|
||||||
|
sitArea: string; // 부지면적
|
||||||
|
trtDstrArea: string; // 처리구역 면적
|
||||||
|
swrTrtPopl: string; // 하수처리 인구
|
||||||
|
mnstr: string; // 총괄 유역
|
||||||
|
efflWtrrgn: string; // 방류수역
|
||||||
|
rvNm: string; // 하천명
|
||||||
|
bscFctClsCd: string; // 기본시설 구분 코드
|
||||||
|
rvbsnNm: string; // 유역명
|
||||||
|
tel: string; // 전화번호
|
||||||
|
rswtrYn: string; // 재이용수 여부 ("Y" 또는 "N")
|
||||||
|
ruse: boolean; // 재이용 여부 (boolean)
|
||||||
|
}
|
||||||
@@ -387,11 +387,9 @@ export const SdmState: SdmType = {
|
|||||||
similarCaseList: similarCaseList,
|
similarCaseList: similarCaseList,
|
||||||
upHeadMoneyDetailList : moneyDetailModalHeader,
|
upHeadMoneyDetailList : moneyDetailModalHeader,
|
||||||
moneyDetailList: moneyDetailList,
|
moneyDetailList: moneyDetailList,
|
||||||
|
|
||||||
// 수요정보 신청현황
|
// 수요정보 신청현황
|
||||||
sdmInfoStatusList: [],
|
sdmInfoStatusList: [],
|
||||||
upHeadSdmInfoStatus: upHeadSdmInfoStatus,
|
upHeadSdmInfoStatus: upHeadSdmInfoStatus,
|
||||||
|
|
||||||
// 로그인관련
|
// 로그인관련
|
||||||
successNextPage : false,
|
successNextPage : false,
|
||||||
successLogin: false,
|
successLogin: false,
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
import { createStore } from 'zustand/vanilla';
|
import { createStore } from 'zustand/vanilla';
|
||||||
import { CommonReducer, CommonState, type CommonStore, type CommonType } from './common';
|
import { CommonReducer, CommonState, type CommonStore, type CommonType } from './common';
|
||||||
import { SdmReducer, SdmState, type SdmStore, type SdmType } from './sdmMng';
|
import { SdmReducer, SdmState, type SdmStore, type SdmType } from './sdmMng';
|
||||||
|
import { dmMapState, type DmMapType, type DmMapStore, DmMapReducer } from './map';
|
||||||
|
|
||||||
export type DmStore = CommonStore & SdmStore;
|
export type DmStore = CommonStore & SdmStore &DmMapStore ;
|
||||||
export type DmState = CommonType & SdmType;
|
export type DmState = CommonType & SdmType &DmMapType;
|
||||||
|
|
||||||
export const StoreZus = (initState: DmState= {
|
export const StoreZus = (initState: DmState= {
|
||||||
...CommonState,
|
...CommonState,
|
||||||
...SdmState,
|
...SdmState,
|
||||||
|
...dmMapState,
|
||||||
}) => {
|
}) => {
|
||||||
return createStore<DmStore>()((set) => {
|
return createStore<DmStore>()((set) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...initState,
|
...initState,
|
||||||
...CommonReducer(set),
|
...CommonReducer(set),
|
||||||
...SdmReducer(set)
|
...SdmReducer(set),
|
||||||
|
...DmMapReducer(set)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
|
type SearchType = {
|
||||||
|
searchNm: string;
|
||||||
|
searchPk: string;
|
||||||
|
};
|
||||||
|
type thisProps = {
|
||||||
|
label: string | undefined;
|
||||||
|
initValue: string | undefined;
|
||||||
|
setValue: (searchNm?: string) => void;
|
||||||
|
setRtnData: (rtnData: any) => void;
|
||||||
|
searchList?: any[];
|
||||||
|
};
|
||||||
|
export default function SearchInputText({
|
||||||
|
label = undefined,
|
||||||
|
initValue = undefined,
|
||||||
|
setValue = () => {},
|
||||||
|
setRtnData = () => {},
|
||||||
|
searchList = undefined,
|
||||||
|
}: thisProps) {
|
||||||
|
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const [textValue, setTextValue] = useState(initValue || "");
|
||||||
|
|
||||||
|
const wrapperRef = useRef<HTMLDivElement>(null);
|
||||||
|
const handleInputChange = useCallback(
|
||||||
|
(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
|
||||||
|
setTextValue(value);
|
||||||
|
setValue(value);
|
||||||
|
if (value && value!=='') {
|
||||||
|
setIsOpen(true);
|
||||||
|
} else {
|
||||||
|
setIsOpen(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[setValue]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleSuggestionClick = useCallback(
|
||||||
|
(searchNm: string) => {
|
||||||
|
// Do not update textValue to keep input unchanged on suggestion click
|
||||||
|
setValue(searchNm);
|
||||||
|
setIsOpen(false);
|
||||||
|
setRtnData(searchList?.find((item) => item.searchNm === searchNm) || {});
|
||||||
|
},
|
||||||
|
[searchList, setRtnData, setValue]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleClickOutside = (event: MouseEvent) => {
|
||||||
|
if (
|
||||||
|
wrapperRef.current &&
|
||||||
|
!wrapperRef.current.contains(event.target as Node)
|
||||||
|
) {
|
||||||
|
setIsOpen(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener("mousedown", handleClickOutside);
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener("mousedown", handleClickOutside);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={wrapperRef} className="relative">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={textValue ||''}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
/* onFocus={() => setIsOpen(true)} */
|
||||||
|
className="w-full h-[3.2rem] !text-xl pl-3 text-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
|
placeholder={`${label}을(를) 입력하세요`}
|
||||||
|
/>
|
||||||
|
{isOpen && (
|
||||||
|
<div className="absolute top-full left-0 z-50 mb-2 max-h-72 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
|
||||||
|
<div className="max-h-72">
|
||||||
|
{searchList && searchList.length > 0 ? (
|
||||||
|
searchList.map((item: SearchType, index: number) => (
|
||||||
|
<div
|
||||||
|
key={index}
|
||||||
|
className="w-full cursor-pointer overflow-auto px-5 py-3 text-left !text-xl hover:bg-gray-100"
|
||||||
|
onClick={() => handleSuggestionClick(item.searchNm)}
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === "Enter" || e.key === " ") {
|
||||||
|
handleSuggestionClick(item.searchNm);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{item.searchPk?.substring(0, 10)}
|
||||||
|
<span className="float-right">{item.searchNm}</span>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<div className="!text-xl w-full px-5 py-3 hover:bg-gray-100 cursor-pointer overflow-auto">
|
||||||
|
검색 결과가 없습니다.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
"use client";
|
||||||
|
import { useDmStore } from "@/app/store";
|
||||||
|
import {
|
||||||
|
SearchDiv,
|
||||||
|
SearchFormLeft,
|
||||||
|
SearchFormRight,
|
||||||
|
SelectBox,
|
||||||
|
type SelectDataType,
|
||||||
|
} from "@common/business_components/ui";
|
||||||
|
import { Label } from "@common/components/ui";
|
||||||
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
import SearchInputText from "../SearchInputText/SearchInputText";
|
||||||
|
|
||||||
|
export function SearchBar({
|
||||||
|
|
||||||
|
setHasuPk
|
||||||
|
}:{
|
||||||
|
setHasuPk: (hasuPk: string) => void,
|
||||||
|
}
|
||||||
|
|
||||||
|
) {
|
||||||
|
const {map, Common, initializeCommonData ,findRuseFclt} = useDmStore((state) => state);
|
||||||
|
const [sidoValue, setSidoValue] = useState<string>("");
|
||||||
|
const [sigunValue, setSigunValue] = useState<string>("");
|
||||||
|
const [filteredSigunData, setFilteredSigunData] = useState<SelectDataType[]>([
|
||||||
|
{ text: "전체", val: "0" },
|
||||||
|
]);
|
||||||
|
useEffect(() => {
|
||||||
|
initializeCommonData();
|
||||||
|
}, [initializeCommonData]);
|
||||||
|
|
||||||
|
const initializeSigunData = useCallback(
|
||||||
|
(sidoCd: string) => {
|
||||||
|
if (sidoCd === "0") {
|
||||||
|
setSigunValue("0");
|
||||||
|
setFilteredSigunData([{ text: "전체", val: "0" }]);
|
||||||
|
} else {
|
||||||
|
const newFilteredData = [
|
||||||
|
{ text: "전체", val: "0" },
|
||||||
|
...Common.selectSigunData.filter(
|
||||||
|
(item: SelectDataType) => item.val.substring(0, 2) === sidoCd
|
||||||
|
),
|
||||||
|
];
|
||||||
|
setSigunValue("0");
|
||||||
|
setFilteredSigunData(newFilteredData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[Common.selectSigunData]
|
||||||
|
);
|
||||||
|
const onSelectValue = useCallback(
|
||||||
|
(val: string, type: string) => {
|
||||||
|
switch (type) {
|
||||||
|
case "ctpvCd":
|
||||||
|
initializeSigunData(val);
|
||||||
|
setSidoValue(val);
|
||||||
|
break;
|
||||||
|
case "sggCd":
|
||||||
|
setSigunValue(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[initializeSigunData]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
console.log('map.ruseFcltList ', map.ruseFcltList)
|
||||||
|
},[map.ruseFcltList])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="grid grid-cols-4 gap-4 ">
|
||||||
|
<div className="col-span-4">
|
||||||
|
<SearchDiv>
|
||||||
|
<SearchFormLeft>
|
||||||
|
<div className="col-span-10 flex flex-row">
|
||||||
|
<SelectBox
|
||||||
|
className="col-span-2 w-1/6 h-full text-2xl"
|
||||||
|
label="시도"
|
||||||
|
selectClass={""}
|
||||||
|
selectArray={Common.selectSidoData || []}
|
||||||
|
onSelectValue={(val) =>
|
||||||
|
onSelectValue(val.toString(), "ctpvCd")
|
||||||
|
}
|
||||||
|
value={sidoValue|| Common.selectSidoData[0]?.val || ""}
|
||||||
|
/>
|
||||||
|
<SelectBox
|
||||||
|
className="col-span-2 w-1/6 h-full text-2xl ml-2"
|
||||||
|
label="시군구"
|
||||||
|
selectClass={""}
|
||||||
|
selectArray={filteredSigunData || []}
|
||||||
|
onSelectValue={(val) =>
|
||||||
|
onSelectValue(val.toString(), "sggCd")
|
||||||
|
}
|
||||||
|
value={sigunValue}
|
||||||
|
/>
|
||||||
|
<div className="col-span-6 flex flex-row items-center min-w-[40rem]">
|
||||||
|
<Label className="text-xl justify-self-center mt-2 mx-3">
|
||||||
|
하수재이용시설 :
|
||||||
|
</Label>
|
||||||
|
<SearchInputText
|
||||||
|
label={'시설명'}
|
||||||
|
initValue={undefined}
|
||||||
|
setValue={ (searchNm?: string)=> {
|
||||||
|
let sggOrCity=''
|
||||||
|
if(searchNm){
|
||||||
|
if(sigunValue === "0" || sigunValue === "") {
|
||||||
|
sggOrCity = sidoValue;
|
||||||
|
}else{
|
||||||
|
sggOrCity = sigunValue;
|
||||||
|
}
|
||||||
|
findRuseFclt(sggOrCity, searchNm);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
setRtnData={(rtnData: any)=> {
|
||||||
|
setHasuPk(rtnData.bscFctCd || "");
|
||||||
|
}}
|
||||||
|
searchList={map.ruseFcltList || []}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</SearchFormLeft>
|
||||||
|
<SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
|
||||||
|
<div className="flex flex-row space-x-2">
|
||||||
|
{/* <Button className="mt-2" size={"sm"} onClick={() => {}}>
|
||||||
|
조회
|
||||||
|
</Button> */}
|
||||||
|
</div>
|
||||||
|
</SearchFormRight>
|
||||||
|
</SearchDiv>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user