Compare commits
56
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c16b9d14d | ||
|
|
3ba11b5508 | ||
|
|
65f74987f8 | ||
|
|
aaed8fe971 | ||
|
|
cba305ab9b | ||
|
|
913256cac4 | ||
|
|
75d14782f4 | ||
|
|
c30de7f40d | ||
|
|
ca96e55c07 | ||
|
|
64698fb97e | ||
|
|
662a461cfa | ||
|
|
2a15138014 | ||
|
|
97727908fa | ||
|
|
16b204f83b | ||
|
|
16ebb8eb3a | ||
|
|
f8c902a138 | ||
|
|
01c01dedbb | ||
|
|
007a39ebfa | ||
|
|
bec3132417 | ||
|
|
8c2bdc65eb | ||
|
|
e7a46ac3a2 | ||
|
|
0f9d7a115f | ||
|
|
05802896a8 | ||
|
|
a44e8722c6 | ||
|
|
690e671a25 | ||
|
|
46b98b99e2 | ||
|
|
9e339cd451 | ||
|
|
95085cbdeb | ||
|
|
c1b0f32609 | ||
|
|
f9b328278a | ||
|
|
8a5b9ba2c3 | ||
|
|
763e0ff5d8 | ||
|
|
93e8ec1df3 | ||
|
|
f087e55c3c | ||
|
|
53b3cc9817 | ||
|
|
b2bbdb8ad4 | ||
|
|
417a24bb16 | ||
|
|
72c1c01e47 | ||
|
|
aea6924015 | ||
|
|
6fb39d6384 | ||
|
|
4be7354b36 | ||
|
|
ab23e4ba2c | ||
|
|
e688a703ca | ||
|
|
49961db9a9 | ||
|
|
56f8d3700a | ||
|
|
c68e1d017e | ||
|
|
a09e7fc709 | ||
|
|
024f25f003 | ||
|
|
9d101666ab | ||
|
|
f5ae14de9e | ||
|
|
4917084bbf | ||
|
|
5c7a8df55f | ||
|
|
8656f6fb10 | ||
|
|
fe6293eb28 | ||
|
|
0ad7d6a2c4 | ||
|
|
662fb390bc |
@@ -1,7 +1,8 @@
|
||||
NEXT_PUBLIC_SITE_ID = DM
|
||||
NEXT_PUBLIC_PORT = 3000
|
||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3000
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
@@ -9,9 +10,7 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
|
||||
|
||||
NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
||||
|
||||
+5
-3
@@ -6,14 +6,16 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
NEXT_PUBLIC_PORT = 11035
|
||||
#NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035
|
||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3000/
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||
NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export type FormData = z.infer<typeof sdmInfoFormSchema>;
|
||||
|
||||
function SdmInfoInsertContent() {
|
||||
const searchParams = useSearchParams();
|
||||
const {map, insertSdmInfoData, Sdm } = useDmStore((state) => state);
|
||||
const {insertSdmInfoData, Sdm ,setSubsInfo} = useDmStore((state) => state);
|
||||
const { successLogin } = Sdm;
|
||||
const [ismoneyDisabled, setIsmoneyDisabled] = useState(false);
|
||||
const formSchema = sdmInfoFormSchema;
|
||||
@@ -127,7 +127,9 @@ function SdmInfoInsertContent() {
|
||||
if (local) {
|
||||
setIsLogin(true);
|
||||
}
|
||||
}, []);
|
||||
setSubsInfo([]); // subsInfo 초기화 후보지 처음 화면 들어올때 초기화(스토어내 객체만)
|
||||
|
||||
}, [setSubsInfo]);
|
||||
|
||||
const form = useForm<FormData>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -135,12 +137,27 @@ function SdmInfoInsertContent() {
|
||||
mode: "onChange",
|
||||
});
|
||||
|
||||
const subsInfo = useDmStore((state) => state.map.subsInfo);
|
||||
|
||||
useEffect(()=>{
|
||||
if(map.subsInfo.length>0){
|
||||
form.setValue('candidateTitle', map.subsInfo)
|
||||
//map.subsInfo 스토어 객체 값이 변경되면 해당 값이 폼에 자동으로 들어가도록 수정 대신 값이 있어야함
|
||||
if(subsInfo.length>0){
|
||||
form.setValue('candidateTitle', subsInfo)
|
||||
}
|
||||
|
||||
},[map.subsInfo, form])
|
||||
},[subsInfo, form])
|
||||
|
||||
//후보지 팝업 값 셋팅
|
||||
useEffect(() => {
|
||||
const handleMessage = (event: MessageEvent) => {
|
||||
if (event.data?.type === 'SET_SUBS_INFO') {
|
||||
setSubsInfo(event.data.payload); // zustand로 값 설정
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('message', handleMessage);
|
||||
return () => window.removeEventListener('message', handleMessage);
|
||||
}, [setSubsInfo]);
|
||||
|
||||
// 로그인 성공 시 모달 닫기 및 폼 업데이트
|
||||
useEffect(() => {
|
||||
@@ -154,6 +171,7 @@ function SdmInfoInsertContent() {
|
||||
setFacilityName(userData.dmdCoNm);
|
||||
form.setValue('sdmNm', userData.dmdCoNm);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error parsing user data:', error);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ export default function MyForm() {
|
||||
dmdInfoSn: '',
|
||||
dmdInfoFk: '',
|
||||
status: '',
|
||||
splyCndtList: []
|
||||
};
|
||||
formDataRef.current = convertedData;
|
||||
insertSdmData(convertedData).catch(error => {
|
||||
|
||||
@@ -53,14 +53,16 @@ export default function WrAboutPage() {
|
||||
}, observerOptions);
|
||||
|
||||
// 각 카드 요소를 관찰
|
||||
cardRefs.current.forEach((card) => {
|
||||
const cardsSnapshot = [...cardRefs.current];
|
||||
|
||||
cardsSnapshot.forEach((card) => {
|
||||
if (card) {
|
||||
observer.observe(card);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return () => {
|
||||
cardRefs.current.forEach((card) => {
|
||||
cardsSnapshot.forEach((card) => {
|
||||
if (card) {
|
||||
observer.unobserve(card);
|
||||
}
|
||||
|
||||
@@ -193,16 +193,16 @@ const WrStatusPage: React.FC = () => {
|
||||
};
|
||||
|
||||
const tableData: TableData[] = [
|
||||
{ region: '전국', sewage: '717(1,137,538)', rainwater: '3544(13,945)', reclaimed: '1018(222,476)', thermal: '123' },
|
||||
{ region: '전국', sewage: '717(1,137,538)', rainwater: '3544(13,945)', reclaimed: '1018(222,476)', thermal: '123(492)' },
|
||||
{ region: '서울특별시', sewage: '4(114,908)', rainwater: '816(430)', reclaimed: '371(341)', thermal: '0' },
|
||||
{ region: '부산광역시', sewage: '13(146,197)', rainwater: '68(335)', reclaimed: '20(512)', thermal: '1' },
|
||||
{ region: '대구광역시', sewage: '9(102,380)', rainwater: '294(133)', reclaimed: '14(44)', thermal: '2' },
|
||||
{ region: '인천광역시', sewage: '17(57,691)', rainwater: '165(642)', reclaimed: '35(7,859)', thermal: '15' },
|
||||
{ region: '광주광역시', sewage: '3(28,738)', rainwater: '74(23)', reclaimed: '15(450)', thermal: '15' },
|
||||
{ region: '대전광역시', sewage: '2(11,966)', rainwater: '52(2)', reclaimed: '11(492)', thermal: '20' },
|
||||
{ region: '울산광역시', sewage: '8(36,076)', rainwater: '111(39)', reclaimed: '19(28,904)', thermal: '30' },
|
||||
{ region: '부산광역시', sewage: '13(146,197)', rainwater: '68(335)', reclaimed: '20(512)', thermal: '1(18)' },
|
||||
{ region: '대구광역시', sewage: '9(102,380)', rainwater: '294(133)', reclaimed: '14(44)', thermal: '2(12)' },
|
||||
{ region: '인천광역시', sewage: '17(57,691)', rainwater: '165(642)', reclaimed: '35(7,859)', thermal: '15(32)' },
|
||||
{ region: '광주광역시', sewage: '3(28,738)', rainwater: '74(23)', reclaimed: '15(450)', thermal: '15(6)' },
|
||||
{ region: '대전광역시', sewage: '2(11,966)', rainwater: '52(2)', reclaimed: '11(492)', thermal: '20(100)' },
|
||||
{ region: '울산광역시', sewage: '8(36,076)', rainwater: '111(39)', reclaimed: '19(28,904)', thermal: '30(130)' },
|
||||
{ region: '세종특별자치시', sewage: '9(2,555)', rainwater: '65(16)', reclaimed: '0(0)', thermal: '0' },
|
||||
{ region: '경기도', sewage: '176(313,298)', rainwater: '1009(4,735)', reclaimed: '252(77,096)', thermal: '40' },
|
||||
{ region: '경기도', sewage: '176(313,298)', rainwater: '1009(4,735)', reclaimed: '252(77,096)', thermal: '40(143)' },
|
||||
{ region: '강원특별자치도', sewage: '69(19,677)', rainwater: '69(4)', reclaimed: '22(447)', thermal: '0' },
|
||||
{ region: '충청북도', sewage: '38(15,607)', rainwater: '17(91)', reclaimed: '91(2,211)', thermal: '0' },
|
||||
{ region: '충청남도', sewage: '67(41,368)', rainwater: '54(77)', reclaimed: '188(50,434)', thermal: '0' },
|
||||
@@ -493,10 +493,10 @@ const WrStatusPage: React.FC = () => {
|
||||
<tr>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">번호</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">시도</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">하수(이용량,천m³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">빗물(이용량,천m³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">중수도(이용량,천m³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">온배수(이용량,천m³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">하수(이용량,천𝓂³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">빗물(이용량,천𝓂³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">중수도(이용량,천𝓂³/년)</th>
|
||||
<th className="text-[12px] font-semibold px-4 py-2">온배수(이용량,천𝓂³/년)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y">
|
||||
|
||||
@@ -1,42 +1,46 @@
|
||||
"use client";
|
||||
|
||||
import Gis from "@common/business_components/ui/map/Gis";
|
||||
import { useEffect, useRef, useState, useCallback } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { mapService } from "../service";
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import { SearchBar } from "@/components/ui/map/searchBar/searchBar";
|
||||
import { useDmStore } from "@/app/store";
|
||||
import SelectedFcltList from "./selectedFcltList";
|
||||
import type { SubsInfo } from "@/app/store/map/type";
|
||||
|
||||
// export type SubsInfo={
|
||||
// ruseUtztnFcltNm: string; // 재이용시설명
|
||||
// ruseUtztnFcltCd: string; // 재이용시설 코드
|
||||
// }
|
||||
const Map = () => {
|
||||
|
||||
//수요처 저장하는 함수 setSubsInfo
|
||||
//setSubsInfo(subsInfo:SubsInfo[]):void
|
||||
const { map,setSubsInfo } = useDmStore(
|
||||
(state) => state
|
||||
);
|
||||
//저장된 수요처 리스트
|
||||
const { subsInfo } = map;
|
||||
|
||||
const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정
|
||||
const gisMaps = useRef<any | null>(null);
|
||||
const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태
|
||||
const [isSearchModalOpen, setIsSearchModalOpen] = useState(true); // SearchModal 열림 상태
|
||||
const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터
|
||||
const [checkedLayers, setCheckedLayers] = useState<string[]>([]);
|
||||
const [checkedLayersData, setCheckedLayersData] = useState<any[]>([]);
|
||||
const [selectDataPk, setSelectDataPk] = useState<string>("");
|
||||
const [subs, setSubs] = useState<object[]>([]);
|
||||
|
||||
//적용 버튼 클릭 이벤트
|
||||
const [selectDataPk, setSelectDataPk] = useState<Record<string, any>>({});
|
||||
const [selectedFclts, setSelectedFclts] = useState<any[]>([]);
|
||||
|
||||
//적용 버튼 클릭 이벤트
|
||||
const onApply = () => {
|
||||
//setSubs([{'41110PB001R1':'수원제1,2 재이용1'},{'41110PB001R2':'수원제1,2 재이용2'}]);
|
||||
console.log(subs)
|
||||
if (selectedFclts.length > 3) {
|
||||
alert("재이용시설 후보지는 최대 3개까지만 선택할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const subsInfoList: SubsInfo[] = selectedFclts.map((fclt) => ({
|
||||
ruseUtztnFcltNm: fclt.ruseUtztnFcltNm,
|
||||
ruseUtztnFcltCd: fclt.pbnstRuseFcltId,
|
||||
}));
|
||||
|
||||
window.opener.postMessage(
|
||||
{
|
||||
type: "SET_SUBS_INFO",
|
||||
payload: subsInfoList, // 또는 필요한 데이터
|
||||
},
|
||||
"*"
|
||||
);
|
||||
|
||||
window.close();
|
||||
};
|
||||
|
||||
//트리 레이어 데이터 조회
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const response = await mapService.getLyrStngs();
|
||||
@@ -46,76 +50,167 @@ const Map = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 팝업 닫기 핸들러를 useCallback으로 메모이제이션
|
||||
const handlePopupClose = useCallback(() => {
|
||||
setIsOpen(false);
|
||||
setFeatureData(null);
|
||||
}, []);
|
||||
//하수처리시설코드로 재이용시설 목록 조회
|
||||
const reuseData = async (ruseFcltPk: any) => {
|
||||
try {
|
||||
const response = await mapService.getPbnstRuseFclts(ruseFcltPk);
|
||||
const data = response.data || [];
|
||||
setSelectedFclts((prev) => {
|
||||
const newItems = data.filter(
|
||||
(item: any) =>
|
||||
item &&
|
||||
Object.keys(item).length > 0 &&
|
||||
!prev.some((f) => f.pbnstRuseFcltId === item.pbnstRuseFcltId)
|
||||
);
|
||||
console.log(newItems)
|
||||
return [...prev, ...newItems];
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error("데이터 불러오기 실패:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 컴포넌트 마운트 시 1회 실행
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("Selected Data Pk: ", selectDataPk);
|
||||
}, [selectDataPk]);
|
||||
// 레이어 생성 후 초기화 처리
|
||||
const onCheckedLayersChange = () => {
|
||||
//수요처 ID
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const dmdInfoId = urlParams.get("dmdInfoId");
|
||||
|
||||
// 체크된 레이어 정보를 받는 핸들러
|
||||
const handleCheckedLayersChange = (
|
||||
checkedIds: string[],
|
||||
checkedNodesData: any[]
|
||||
) => {
|
||||
setCheckedLayers(checkedIds);
|
||||
setCheckedLayersData(checkedNodesData);
|
||||
};
|
||||
|
||||
// SearchModal, GisContent 등에서 호출
|
||||
const onFeatureSelect = (data: any) => {
|
||||
const map = gisMaps.current;
|
||||
if (!map) {
|
||||
console.warn("지도가 초기화되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 항상 같은 select 객체 사용
|
||||
const select = GisApp.Module.select as any;
|
||||
if (!select) return;
|
||||
|
||||
// 1. 기존 선택 초기화
|
||||
select.resetSelectedFeature();
|
||||
|
||||
// 2. data가 OpenLayers Feature 인스턴스인지 확인
|
||||
//수요처 위치로 화면 이동
|
||||
const maps = gisMaps.current;
|
||||
const layer = GisApp.Module.layer as any;
|
||||
const layerNm = "tb_wr_ruse_fclt_dmd_co";
|
||||
const featureId = `${layerNm}.${dmdInfoId}`;
|
||||
let foundFeature: any = null;
|
||||
if (
|
||||
data &&
|
||||
typeof data.getGeometry === "function" &&
|
||||
typeof data.setStyle === "function"
|
||||
) {
|
||||
// 이미 Feature 인스턴스라면 그대로 사용
|
||||
foundFeature = data;
|
||||
} else {
|
||||
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
|
||||
const featureId = data.fid || data.ftrIdn || data.id;
|
||||
map
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
|
||||
maps
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
if (layer.get("lyrTyNm") == layerNm) {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatureById) {
|
||||
const feature = source.getFeatureById(String(featureId).trim());
|
||||
if (feature) foundFeature = feature;
|
||||
if (feature) {
|
||||
foundFeature = feature;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (foundFeature) {
|
||||
const geometry = foundFeature.getGeometry();
|
||||
|
||||
if (geometry) {
|
||||
const extent = geometry.getExtent();
|
||||
|
||||
if (geometry.getType() === "Point") {
|
||||
maps.getView().setCenter(geometry.getCoordinates());
|
||||
maps.getView().setZoom(11);
|
||||
} else {
|
||||
maps.getView().fit(extent, {
|
||||
duration: 300,
|
||||
padding: [30, 30, 30, 30],
|
||||
maxZoom: 16,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
layer.highLightFeature(
|
||||
[foundFeature],
|
||||
{
|
||||
id: GisApp.hlLayerId,
|
||||
zIndex: 10,
|
||||
opacity: 1,
|
||||
selectable: true,
|
||||
},
|
||||
{ width: 30 }
|
||||
);
|
||||
}
|
||||
|
||||
// 3. 피처 선택
|
||||
const formatNumber = (val: any) => {
|
||||
const num = Number(val);
|
||||
return isNaN(num) ? "-" : num.toLocaleString();
|
||||
};
|
||||
|
||||
// 재이용시설 오버레이
|
||||
maps
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
if (layer.get("lyrTyNm") === "tb_wr_bdst_ruse_fclt") {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatures) {
|
||||
const features = source.getFeatures();
|
||||
|
||||
features.forEach((feature: any) => {
|
||||
// 필요한 고유 ID 또는 속성 가져오기 (예: ftrIdn 또는 feature.getId())
|
||||
const featureId =
|
||||
feature.getId() || feature.get("ftrIdn") || Math.random();
|
||||
|
||||
// HTML 또는 React 오버레이 컴포넌트 구성
|
||||
const overlayContent = `
|
||||
<div class="rounded-md border border-gray-300 bg-white shadow-md text-sm w-[120px]">
|
||||
<!-- 헤더 -->
|
||||
<div class="bg-cyan-700 text-white px-3 py-2 text-[11px] font-semibold text-center rounded-t-md">
|
||||
${feature.get("swtrmt_fclt_nm") || "-"}
|
||||
</div>
|
||||
|
||||
<!-- 테이블 -->
|
||||
<table class="w-full text-sm text-gray-800 border-t border-gray-200">
|
||||
<tbody>
|
||||
<tr class="border-b border-gray-200">
|
||||
<th class="bg-gray-100 text-gray-600 font-semibold text-[10px] text-left">용량(m³/일)</th>
|
||||
<td class="text-right text-[10px] font-bold">${formatNumber(feature.get("fclt_cpct"))}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
`;
|
||||
feature.set("html", overlayContent);
|
||||
feature.set("overLayId", `overLay.${featureId}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 검색해서 재이용시설 선택하면 해당 시설로 화면 이동 처리
|
||||
useEffect(() => {
|
||||
if (!selectDataPk || Object.keys(selectDataPk).length === 0) return;
|
||||
const maps = gisMaps.current;
|
||||
let foundFeature: any = null;
|
||||
const layerNm = "tb_wr_bdst_ruse_fclt";
|
||||
const featureId = `${layerNm}.${selectDataPk.bscFctCd}`;
|
||||
maps
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
if (layer.get("lyrTyNm") == layerNm) {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatureById) {
|
||||
const feature = source.getFeatureById(String(featureId).trim());
|
||||
if (feature) {
|
||||
foundFeature = feature;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (foundFeature) {
|
||||
const geometry = foundFeature.getGeometry();
|
||||
if (geometry) {
|
||||
const extent = geometry.getExtent();
|
||||
|
||||
map.getView().fit(extent, {
|
||||
maps.getView().fit(extent, {
|
||||
duration: 300,
|
||||
padding: [50, 50, 50, 50],
|
||||
maxZoom: 16,
|
||||
@@ -123,21 +218,23 @@ const Map = () => {
|
||||
nearest: true,
|
||||
});
|
||||
}
|
||||
select.selectFeature(foundFeature, true);
|
||||
} else {
|
||||
console.warn("OpenLayers Feature를 찾을 수 없습니다:", data);
|
||||
console.warn("OpenLayers Feature를 찾을 수 없습니다:", selectDataPk);
|
||||
}
|
||||
}, [selectDataPk]);
|
||||
|
||||
setFeatureData(data);
|
||||
setIsOpen(true);
|
||||
setIsSearchModalOpen(false);
|
||||
// 재이용시설 클릭 시 선택 시설목록에 추가
|
||||
const onFeatureSelect = (data: any) => {
|
||||
// 처리시설코드
|
||||
const swtrmtFcltCd = data.get("swtrmt_fclt_cd");
|
||||
reuseData(swtrmtFcltCd);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchBar
|
||||
setHasuPk={(hasuPk: string) => {
|
||||
if (hasuPk !== "") {
|
||||
setHasuPk={(hasuPk: any) => {
|
||||
if (hasuPk) {
|
||||
setSelectDataPk(hasuPk);
|
||||
}
|
||||
}}
|
||||
@@ -150,7 +247,7 @@ const Map = () => {
|
||||
gisMaps={gisMaps}
|
||||
isMiniMap={false}
|
||||
searchView={undefined}
|
||||
detailView={null}
|
||||
detailView={undefined}
|
||||
onFeatureSelect={onFeatureSelect}
|
||||
setIsOpen={setIsOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
@@ -158,11 +255,14 @@ const Map = () => {
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
isOpen={isOpen}
|
||||
isSearchModalOpen={isSearchModalOpen}
|
||||
onCheckedLayersChange={handleCheckedLayersChange}
|
||||
onCheckedLayersChange={onCheckedLayersChange}
|
||||
imgVisble={false}
|
||||
setData={setSubs}
|
||||
/>
|
||||
</div>
|
||||
<SelectedFcltList
|
||||
data={selectedFclts}
|
||||
onRemove={(updatedList) => setSelectedFclts(updatedList)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import Gis from "@common/business_components/ui/map/Gis";
|
||||
import { useEffect, useRef, useState, useCallback } from "react";
|
||||
import { mapService } from "../service";
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import { SearchBar } from "@/components/ui/map/searchBar/searchBar";
|
||||
|
||||
const Map = () => {
|
||||
const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정
|
||||
const gisMaps = useRef<any | null>(null);
|
||||
const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태
|
||||
const [isSearchModalOpen, setIsSearchModalOpen] = useState(true); // SearchModal 열림 상태
|
||||
const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터
|
||||
const [checkedLayers, setCheckedLayers] = useState<string[]>([]);
|
||||
const [checkedLayersData, setCheckedLayersData] = useState<any[]>([]);
|
||||
const [selectDataPk, setSelectDataPk] = useState<string>("");
|
||||
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const response = await mapService.getLyrStngs();
|
||||
setTreeData(response); // API 응답 저장
|
||||
} catch (error) {
|
||||
console.error("데이터 불러오기 실패:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 팝업 닫기 핸들러를 useCallback으로 메모이제이션
|
||||
const handlePopupClose = useCallback(() => {
|
||||
setIsOpen(false);
|
||||
setFeatureData(null);
|
||||
}, []);
|
||||
|
||||
// 컴포넌트 마운트 시 1회 실행
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("Selected Data Pk: ", selectDataPk);
|
||||
}, [selectDataPk]);
|
||||
|
||||
// 체크된 레이어 정보를 받는 핸들러
|
||||
const handleCheckedLayersChange = (
|
||||
checkedIds: string[],
|
||||
checkedNodesData: any[]
|
||||
) => {
|
||||
setCheckedLayers(checkedIds);
|
||||
setCheckedLayersData(checkedNodesData);
|
||||
};
|
||||
|
||||
// SearchModal, GisContent 등에서 호출
|
||||
const onFeatureSelect = (data: any) => {
|
||||
const map = gisMaps.current;
|
||||
if (!map) {
|
||||
console.warn("지도가 초기화되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 항상 같은 select 객체 사용
|
||||
const select = GisApp.Module.select as any;
|
||||
if (!select) return;
|
||||
|
||||
// 1. 기존 선택 초기화
|
||||
select.resetSelectedFeature();
|
||||
|
||||
// 2. data가 OpenLayers Feature 인스턴스인지 확인
|
||||
let foundFeature: any = null;
|
||||
if (
|
||||
data &&
|
||||
typeof data.getGeometry === "function" &&
|
||||
typeof data.setStyle === "function"
|
||||
) {
|
||||
// 이미 Feature 인스턴스라면 그대로 사용
|
||||
foundFeature = data;
|
||||
} else {
|
||||
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
|
||||
const featureId = data.fid || data.ftrIdn || data.id;
|
||||
map
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatureById) {
|
||||
const feature = source.getFeatureById(String(featureId).trim());
|
||||
if (feature) foundFeature = feature;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 3. 피처 선택
|
||||
if (foundFeature) {
|
||||
const geometry = foundFeature.getGeometry();
|
||||
if (geometry) {
|
||||
const extent = geometry.getExtent();
|
||||
|
||||
map.getView().fit(extent, {
|
||||
duration: 300,
|
||||
padding: [50, 50, 50, 50],
|
||||
maxZoom: 16,
|
||||
constrainResolution: true,
|
||||
nearest: true,
|
||||
});
|
||||
}
|
||||
select.selectFeature(foundFeature, true);
|
||||
} else {
|
||||
console.warn("OpenLayers Feature를 찾을 수 없습니다:", data);
|
||||
}
|
||||
|
||||
setFeatureData(data);
|
||||
setIsOpen(true);
|
||||
setIsSearchModalOpen(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchBar
|
||||
setHasuPk={(hasuPk: string) => {
|
||||
if (hasuPk !== "") {
|
||||
setSelectDataPk(hasuPk);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<div className="bg-container">
|
||||
<Gis
|
||||
treeData={treeData}
|
||||
isSearch={false}
|
||||
gisMaps={gisMaps}
|
||||
isMiniMap={false}
|
||||
searchView={undefined}
|
||||
detailView={null}
|
||||
onFeatureSelect={onFeatureSelect}
|
||||
setIsOpen={setIsOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
featureData={featureData}
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
isOpen={isOpen}
|
||||
isSearchModalOpen={isSearchModalOpen}
|
||||
onCheckedLayersChange={handleCheckedLayersChange}
|
||||
imgVisble={false}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Map;
|
||||
@@ -0,0 +1,81 @@
|
||||
import React from "react";
|
||||
|
||||
type FcltItem = {
|
||||
pbnstRuseFcltId: string;
|
||||
ruseUtztnFcltNm: string;
|
||||
splyExtraCpct?: number;
|
||||
ruseCpct?: number;
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
export default function SelectedFcltList({
|
||||
data = [],
|
||||
onRemove,
|
||||
}: {
|
||||
data: FcltItem[];
|
||||
onRemove: (updatedList: FcltItem[]) => void;
|
||||
}) {
|
||||
const handleDelete = (code: string) => {
|
||||
const updatedList = data.filter((item) => item.pbnstRuseFcltId !== code);
|
||||
onRemove(updatedList);
|
||||
};
|
||||
|
||||
const TableContent = (
|
||||
<>
|
||||
<thead className="bg-gray-100 text-gray-700 text-[13px]">
|
||||
<tr>
|
||||
<th className="px-3 py-2 text-left border-b">시설명</th>
|
||||
<th className="px-3 py-2 text-right border-b">
|
||||
하수처리량
|
||||
<br />
|
||||
(㎥/일)
|
||||
</th>
|
||||
<th className="px-3 py-2 text-right border-b">
|
||||
재이용량
|
||||
<br />
|
||||
(㎥/일)
|
||||
</th>
|
||||
<th className="px-3 py-2 border-b">삭제</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{data.map((item) => (
|
||||
<tr key={item.pbnstRuseFcltId} className="border-b last:border-none">
|
||||
<td className="px-3 py-2 text-[12px]">{item.ruseUtztnFcltNm}</td>
|
||||
<td className="px-3 py-2 text-right text-[12px]">
|
||||
{Number(item.splyExtraCpct || 0).toLocaleString()}
|
||||
</td>
|
||||
<td className="px-3 py-2 text-right text-[12px]">
|
||||
{Number(item.ruseCpct || 0).toLocaleString()}
|
||||
</td>
|
||||
<td className="px-3 py-2 text-center">
|
||||
<button
|
||||
onClick={() => handleDelete(item.pbnstRuseFcltId)}
|
||||
className="text-red-500 hover:text-red-700 text-sm font-bold"
|
||||
aria-label="삭제"
|
||||
title="삭제"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</>
|
||||
);
|
||||
|
||||
if (data.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className="fixed right-40 top-[8rem] w-[40rem] max-h-[130rem] overflow-auto bg-white shadow-lg rounded p-4 border border-gray-300 z-50">
|
||||
<h3 className="bg-cyan-700 text-white text-xl font-bold mb-2 p-2">
|
||||
선택된 시설
|
||||
</h3>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-sm text-gray-800 border border-gray-200">
|
||||
{TableContent}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
// 현재 문서의 스타일(CSS)을 새 창으로 복사하는 함수
|
||||
const copyStyles = (sourceDoc: Document, targetDoc: Document) => {
|
||||
Array.from(sourceDoc.styleSheets).forEach(styleSheet => {
|
||||
try {
|
||||
if (styleSheet.cssRules) { // <style> 태그로 주입된 CSS
|
||||
const newStyleEl = sourceDoc.createElement('style');
|
||||
Array.from(styleSheet.cssRules).forEach(cssRule => {
|
||||
newStyleEl.appendChild(sourceDoc.createTextNode(cssRule.cssText));
|
||||
});
|
||||
targetDoc.head.appendChild(newStyleEl);
|
||||
} else if (styleSheet.href) { // <link> 태그로 연결된 CSS 파일
|
||||
const newLinkEl = sourceDoc.createElement('link');
|
||||
newLinkEl.rel = 'stylesheet';
|
||||
newLinkEl.href = styleSheet.href;
|
||||
targetDoc.head.appendChild(newLinkEl);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('스타일시트를 복사할 수 없습니다:', e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
interface NewWindowPortalProps {
|
||||
children: React.ReactNode;
|
||||
onClose: () => void;
|
||||
title?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
resizable?: string;
|
||||
scrollbars?: string;
|
||||
}
|
||||
|
||||
const NewWindowPortal: React.FC<NewWindowPortalProps> = ({ children, onClose, title = "" , width = 900, height = 800, resizable = "yes", scrollbars= "yes" }) => {
|
||||
const [container, setContainer] = useState<HTMLElement | null>(null);
|
||||
const newWindowRef = useRef<Window | null>(null);
|
||||
const onCloseRef = useRef(onClose);
|
||||
|
||||
// onClose 함수를 ref로 저장하여 의존성 문제 해결
|
||||
useEffect(() => {
|
||||
onCloseRef.current = onClose;
|
||||
}, [onClose]);
|
||||
|
||||
const handleUnload = useCallback(() => {
|
||||
onCloseRef.current();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// 이미 창이 열려있으면 새로 열지 않음
|
||||
if (newWindowRef.current && !newWindowRef.current.closed) return;
|
||||
|
||||
// 1. 새 창을 열고 참조를 저장합니다.
|
||||
const popupOptions = `width=${width},height=${height},resizable=${resizable},scrollbars=${scrollbars}`;
|
||||
newWindowRef.current = window.open('', title, popupOptions);
|
||||
|
||||
if (newWindowRef.current) {
|
||||
newWindowRef.current.document.title = title;
|
||||
|
||||
// 2. React 컴포넌트를 마운트할 컨테이너 div를 생성하여 새 창의 body에 추가합니다.
|
||||
const div = newWindowRef.current.document.createElement('div');
|
||||
newWindowRef.current.document.body.appendChild(div);
|
||||
setContainer(div);
|
||||
|
||||
// 3. 메인 창의 스타일을 새 창으로 복사합니다. (매우 중요)
|
||||
copyStyles(document, newWindowRef.current.document);
|
||||
|
||||
// 4. 사용자가 창을 닫을 때 부모에게 알리기 위한 이벤트 리스너를 설정합니다.
|
||||
// const handleUnload = () => {
|
||||
// onClose();
|
||||
// };
|
||||
newWindowRef.current.addEventListener('unload', handleUnload);
|
||||
|
||||
// 5. 컴포넌트가 사라질 때 창을 닫는 클린업 함수를 반환합니다.
|
||||
return () => {
|
||||
if (newWindowRef.current) {
|
||||
newWindowRef.current.removeEventListener('unload', handleUnload);
|
||||
if (!newWindowRef.current.closed) {
|
||||
newWindowRef.current.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
alert('팝업이 차단되었습니다. 팝업 차단을 해제하고 다시 시도해주세요.');
|
||||
onCloseRef.current();
|
||||
}
|
||||
}, []);
|
||||
|
||||
// `createPortal`을 사용해 children을 새 창의 container div에 렌더링합니다.
|
||||
return container ? createPortal(children, container) : null;
|
||||
};
|
||||
|
||||
export default NewWindowPortal;
|
||||
@@ -3,6 +3,7 @@
|
||||
* 관망도 API
|
||||
*/
|
||||
const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map`
|
||||
const REUSE_API_URL = `${process.env.NEXT_PUBLIC_REUSE_API_URL}`
|
||||
|
||||
export type LyrStngProps = {
|
||||
lyr_sn: string
|
||||
@@ -41,6 +42,20 @@ export const mapService = {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
},
|
||||
getPbnstRuseFclts: async (ruseFcltPk:any) => {
|
||||
const response = await fetch(`${REUSE_API_URL}/reuseFc/pubFc/${ruseFcltPk}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
}
|
||||
|
||||
+10
-4
@@ -3,7 +3,7 @@
|
||||
import { BaseLayout } from "@common/components";
|
||||
import type { MenuItem } from "./store/common";
|
||||
import { useDmStore } from "./store";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
|
||||
export default function Base({
|
||||
children,
|
||||
@@ -13,10 +13,16 @@ export default function Base({
|
||||
const { getMenuAuth } = useDmStore((state) => state);
|
||||
|
||||
const router = useRouter();
|
||||
const handleClick = (id:MenuItem) =>{
|
||||
const pathname = usePathname();
|
||||
|
||||
const handleClick = (id: MenuItem) => {
|
||||
getMenuAuth(id.menuCd);
|
||||
router.push(id.urlPath);
|
||||
}
|
||||
};
|
||||
|
||||
return <BaseLayout handleMenuClick={handleClick}>{children}</BaseLayout>;
|
||||
return (
|
||||
<BaseLayout currentPath={pathname ?? ""} handleMenuClick={handleClick}>
|
||||
{children}
|
||||
</BaseLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import path from "path";
|
||||
|
||||
const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id";
|
||||
const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization";
|
||||
const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL || "";
|
||||
const SERVER_API_URL = process.env.NEXT_PUBLIC_DM_SERVER_API_URL || "";
|
||||
const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || "";
|
||||
const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || "";
|
||||
const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || "";
|
||||
|
||||
@@ -16,7 +16,6 @@ const getRuseFclt = async (
|
||||
|
||||
let url = `/prcsFclt/ruseInfo/${page ? page : 1}/5/A/${sggOrCity ? sggOrCity : "0"}/0/1/SW`;
|
||||
|
||||
console.log(" checkWrRegListRes ", checkWrRegListRes);
|
||||
const ruseList = checkWrRegListRes.data.filter((item: string) => item !== "");
|
||||
|
||||
if (searchTxt) {
|
||||
|
||||
@@ -1,53 +1,76 @@
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||
|
||||
type SearchType = {
|
||||
searchNm: string;
|
||||
searchPk: string;
|
||||
bscFctNm: string;
|
||||
bscFctCd: string;
|
||||
};
|
||||
|
||||
type thisProps = {
|
||||
label: string | undefined;
|
||||
initValue: string | undefined;
|
||||
setValue: (searchNm?: string) => void;
|
||||
setRtnData: (rtnData: any) => void;
|
||||
searchList?: any[];
|
||||
searchList?: SearchType[];
|
||||
};
|
||||
|
||||
export default function SearchInputText({
|
||||
label = undefined,
|
||||
initValue = undefined,
|
||||
setValue = () => {},
|
||||
setRtnData = () => {},
|
||||
searchList = undefined,
|
||||
searchList = [],
|
||||
}: thisProps) {
|
||||
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [textValue, setTextValue] = useState(initValue || "");
|
||||
const [highlightIndex, setHighlightIndex] = useState<number>(-1);
|
||||
|
||||
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);
|
||||
}
|
||||
setHighlightIndex(-1);
|
||||
setIsOpen(value !== "");
|
||||
},
|
||||
[setValue]
|
||||
);
|
||||
|
||||
const handleSuggestionClick = useCallback(
|
||||
(searchNm: string) => {
|
||||
// Do not update textValue to keep input unchanged on suggestion click
|
||||
setValue(searchNm);
|
||||
setTextValue(searchNm);
|
||||
setIsOpen(false);
|
||||
setRtnData(searchList?.find((item) => item.searchNm === searchNm) || {});
|
||||
setRtnData(searchList?.find((item) => item.bscFctNm === searchNm) || {});
|
||||
},
|
||||
[searchList, setRtnData, setValue]
|
||||
);
|
||||
|
||||
const handleKeyDown = useCallback(
|
||||
(e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (!isOpen || searchList.length === 0) return;
|
||||
|
||||
if (e.key === "ArrowDown") {
|
||||
e.preventDefault();
|
||||
setHighlightIndex((prev) => (prev + 1) % searchList.length);
|
||||
} else if (e.key === "ArrowUp") {
|
||||
e.preventDefault();
|
||||
setHighlightIndex((prev) =>
|
||||
prev <= 0 ? searchList.length - 1 : prev - 1
|
||||
);
|
||||
} else if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
if (searchList.length === 1 && searchList[0]) {
|
||||
handleSuggestionClick(searchList[0].bscFctNm);
|
||||
} else if (highlightIndex >= 0 && highlightIndex < searchList.length && searchList[highlightIndex]) {
|
||||
handleSuggestionClick(searchList[highlightIndex].bscFctNm);
|
||||
}
|
||||
}
|
||||
},
|
||||
[highlightIndex, isOpen, searchList, handleSuggestionClick]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (
|
||||
@@ -68,31 +91,39 @@ export default function SearchInputText({
|
||||
<div ref={wrapperRef} className="relative">
|
||||
<input
|
||||
type="text"
|
||||
value={textValue ||''}
|
||||
value={textValue || ""}
|
||||
onChange={handleInputChange}
|
||||
/* onFocus={() => setIsOpen(true)} */
|
||||
onKeyDown={handleKeyDown}
|
||||
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}을(를) 입력하세요`}
|
||||
onClick={() => {
|
||||
setTextValue("");
|
||||
setValue("");
|
||||
setIsOpen(false);
|
||||
}}
|
||||
/>
|
||||
{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) => (
|
||||
{searchList.length > 0 ? (
|
||||
searchList.map((item, index) => (
|
||||
<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)}
|
||||
className={`w-full cursor-pointer overflow-auto px-5 py-3 text-left !text-xl ${
|
||||
highlightIndex === index
|
||||
? "bg-blue-100"
|
||||
: "hover:bg-gray-100"
|
||||
}`}
|
||||
onClick={() => handleSuggestionClick(item.bscFctNm)}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
handleSuggestionClick(item.searchNm);
|
||||
handleSuggestionClick(item.bscFctNm);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{item.searchPk?.substring(0, 10)}
|
||||
<span className="float-right">{item.searchNm}</span>
|
||||
<span className="float-left">{item.bscFctNm}</span>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
|
||||
@@ -3,7 +3,6 @@ import { useDmStore } from "@/app/store";
|
||||
import {
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SelectBox,
|
||||
type SelectDataType,
|
||||
} from "@common/business_components/ui";
|
||||
@@ -13,9 +12,9 @@ import SearchInputText from "../SearchInputText/SearchInputText";
|
||||
|
||||
export function SearchBar({
|
||||
setHasuPk,
|
||||
onApply
|
||||
onApply,
|
||||
}: {
|
||||
setHasuPk: (hasuPk: string) => void;
|
||||
setHasuPk: (hasuPk: any) => void;
|
||||
onApply: () => void;
|
||||
}) {
|
||||
const { map, Common, initializeCommonData, findRuseFclt } = useDmStore(
|
||||
@@ -26,6 +25,7 @@ export function SearchBar({
|
||||
const [filteredSigunData, setFilteredSigunData] = useState<SelectDataType[]>([
|
||||
{ text: "전체", val: "0" },
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
initializeCommonData();
|
||||
}, [initializeCommonData]);
|
||||
@@ -62,9 +62,9 @@ export function SearchBar({
|
||||
[initializeSigunData]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("map.ruseFcltList ", map.ruseFcltList);
|
||||
}, [map.ruseFcltList]);
|
||||
// useEffect(() => {
|
||||
// console.log("map.ruseFcltList ", map.ruseFcltList);
|
||||
// }, [map.ruseFcltList]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -112,7 +112,7 @@ export function SearchBar({
|
||||
}
|
||||
}}
|
||||
setRtnData={(rtnData: any) => {
|
||||
setHasuPk(rtnData.bscFctCd || "");
|
||||
setHasuPk(rtnData);
|
||||
}}
|
||||
searchList={map.ruseFcltList || []}
|
||||
/>
|
||||
@@ -130,7 +130,9 @@ export function SearchBar({
|
||||
color="sky"
|
||||
className="mt-2"
|
||||
size={"sm"}
|
||||
onClick={() => {onApply();}}
|
||||
onClick={() => {
|
||||
onApply();
|
||||
}}
|
||||
>
|
||||
적용
|
||||
</Button>
|
||||
|
||||
@@ -23,11 +23,11 @@ export function AccessibleFormField<T extends FieldValues>({
|
||||
<FormUi label={labelText}>
|
||||
<div>
|
||||
{inputComponent}
|
||||
{error?.message && Array.from(new Set(error.message.split('\n'))).map((msg, idx) => (
|
||||
{/* {error?.message && Array.from(new Set(error.message.split('\n'))).map((msg, idx) => (
|
||||
<p key={idx} className="text-red-500 text-sm mt-1" role="alert">
|
||||
{msg}
|
||||
</p>
|
||||
))}
|
||||
))} */}
|
||||
</div>
|
||||
</FormUi>
|
||||
);
|
||||
|
||||
@@ -15,11 +15,9 @@ import { Button } from "@common/components/ui";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { AccessibleFormField } from "./AccessibleFormField";
|
||||
import type { ControllerRenderProps, UseFormReturn } from "react-hook-form";
|
||||
import type { ControllerRenderProps, UseFormReturn, FieldError } from "react-hook-form";
|
||||
import SearchInputText from "../common/searhDemandInput/component";
|
||||
import type { DemandCompType } from "@/app/store/sdmMng";
|
||||
import NewWindowPortal from "@/app/(popup-layout)/map/popup/windowPotal";
|
||||
import Map from "@/app/(popup-layout)/map/popup/sdmInfoMap";
|
||||
|
||||
export interface SdmInfoRegFormProps {
|
||||
form: UseFormReturn<FormData>;
|
||||
@@ -47,7 +45,6 @@ export function SdmInfoRegForm({
|
||||
const [isSimilarCase, setIsSimilarCase] = useState(false);
|
||||
const [key, setKey] = useState(0);
|
||||
// 후보지 팝업 오픈 상태
|
||||
const [isCandidatePopup, setIsCandidatePopup] = useState(false);
|
||||
|
||||
//모달 조회에 필요한 데이터
|
||||
const [sply, setSply] = useState<number>(0);
|
||||
@@ -58,11 +55,9 @@ export function SdmInfoRegForm({
|
||||
initializeCommonData();
|
||||
}, [initializeCommonData]);
|
||||
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
console.log('candidateTitle ', form.getValues("candidateTitle"))
|
||||
},[form.getValues("candidateTitle") ])
|
||||
useEffect(() => {
|
||||
console.log("candidateTitle ", form.getValues("candidateTitle"));
|
||||
}, [form.getValues("candidateTitle")]);
|
||||
useEffect(() => {
|
||||
if (useTypesData && useTypesData.length > 0) {
|
||||
setTimeout(() => {
|
||||
@@ -87,17 +82,20 @@ export function SdmInfoRegForm({
|
||||
}
|
||||
}, [searchParams, form]);
|
||||
|
||||
const handleCandidateClose = useCallback(
|
||||
() => setIsCandidatePopup(false),
|
||||
[]
|
||||
);
|
||||
|
||||
const searchCandidate = (e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
//setIsCandidatePopup(true);
|
||||
const popupOptions = `width=1920,height=1080,resizable='y',scrollbars='y'`;
|
||||
window.open("/map/popup", "candidatePopup", popupOptions);
|
||||
const dmdInfoId = JSON.parse(
|
||||
sessionStorage.getItem("user") || "{}"
|
||||
)?.dmdInfoId?.toString();
|
||||
|
||||
const url = `/map/popup?dmdInfoId=${encodeURIComponent(dmdInfoId)}`;
|
||||
const width = window.screen.availWidth;
|
||||
const height = window.screen.availHeight;
|
||||
const left = 0;
|
||||
const top = 0;
|
||||
const popupOptions = `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`;
|
||||
window.open(url, "candidatePopup", popupOptions);
|
||||
};
|
||||
|
||||
const searchSimilarCase = (e: React.MouseEvent) => {
|
||||
@@ -219,32 +217,24 @@ export function SdmInfoRegForm({
|
||||
formIndex: 0,
|
||||
required: true,
|
||||
component: (field) => (
|
||||
<AccessibleFormField
|
||||
field={field}
|
||||
label="희망단가(원/㎥)"
|
||||
required={true}
|
||||
error={form.formState.errors.money}
|
||||
inputComponent={
|
||||
<FormUi
|
||||
onCheckboxChange={handleCheckboxChange}
|
||||
isDisabled={isBznmTotNoDisabled}
|
||||
>
|
||||
<Input
|
||||
placeholder="희망단가(원/㎥)을 입력하세요"
|
||||
type="text"
|
||||
className="!text-xl text-gray-600"
|
||||
value={field.value as string}
|
||||
onChange={(e) => {
|
||||
field.onChange(e);
|
||||
setMoney(Number(e.target.value));
|
||||
}}
|
||||
onBlur={field.onBlur}
|
||||
name={field.name}
|
||||
ref={field.ref}
|
||||
/>
|
||||
</FormUi>
|
||||
}
|
||||
/>
|
||||
<FormUi
|
||||
onCheckboxChange={handleCheckboxChange}
|
||||
isDisabled={isBznmTotNoDisabled}
|
||||
>
|
||||
<Input
|
||||
placeholder="희망단가(원/㎥)을 입력하세요"
|
||||
type="text"
|
||||
className="!text-xl text-gray-600"
|
||||
value={field.value as string}
|
||||
onChange={(e) => {
|
||||
field.onChange(e);
|
||||
setMoney(Number(e.target.value));
|
||||
}}
|
||||
onBlur={field.onBlur}
|
||||
name={field.name}
|
||||
ref={field.ref}
|
||||
/>
|
||||
</FormUi>
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -484,16 +474,18 @@ export function SdmInfoRegForm({
|
||||
</Button>
|
||||
</div>
|
||||
<div className="flex justify-center gap-10 mt-5">
|
||||
{(form.getValues("candidateTitle") || []).map((candidate: any, index: number) => (
|
||||
<Input
|
||||
key={index}
|
||||
placeholder={`후보지${index + 1}`}
|
||||
type="text"
|
||||
className="!text-xl w-[130px] text-gray-600"
|
||||
value={candidate.ruseUtztnFcltNm}
|
||||
readOnly
|
||||
/>
|
||||
))}
|
||||
{(form.getValues("candidateTitle") || []).map(
|
||||
(candidate: any, index: number) => (
|
||||
<Input
|
||||
key={index}
|
||||
placeholder={`후보지${index + 1}`}
|
||||
type="text"
|
||||
className="!text-xl w-[130px] text-gray-600"
|
||||
value={candidate.ruseUtztnFcltNm}
|
||||
readOnly
|
||||
/>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
@@ -529,7 +521,11 @@ export function SdmInfoRegForm({
|
||||
field={field}
|
||||
label={label}
|
||||
required={required}
|
||||
error={form.formState.errors[name]}
|
||||
error={
|
||||
typeof form.formState.errors[name]?.message === 'string'
|
||||
? (form.formState.errors[name] as FieldError)
|
||||
: undefined
|
||||
}
|
||||
inputComponent={component(field)}
|
||||
/>
|
||||
)
|
||||
@@ -555,7 +551,11 @@ export function SdmInfoRegForm({
|
||||
field={field}
|
||||
label={label}
|
||||
required={required}
|
||||
error={form.formState.errors[name]}
|
||||
error={
|
||||
typeof form.formState.errors[name]?.message === 'string'
|
||||
? (form.formState.errors[name] as FieldError)
|
||||
: undefined
|
||||
}
|
||||
inputComponent={component?.(field)}
|
||||
/>
|
||||
)}
|
||||
@@ -580,7 +580,11 @@ export function SdmInfoRegForm({
|
||||
field={field}
|
||||
label={label}
|
||||
required={required}
|
||||
error={form.formState.errors[name]}
|
||||
error={
|
||||
typeof form.formState.errors[name]?.message === 'string'
|
||||
? (form.formState.errors[name] as FieldError)
|
||||
: undefined
|
||||
}
|
||||
inputComponent={component?.(field)}
|
||||
/>
|
||||
)}
|
||||
@@ -600,7 +604,6 @@ export function SdmInfoRegForm({
|
||||
noFooterYn="Y"
|
||||
/>
|
||||
)}
|
||||
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ export class LoginApiService implements LoginService {
|
||||
|
||||
public async login(payload: ILogin): Promise<void> {
|
||||
try {
|
||||
console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN)
|
||||
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "DM";
|
||||
export const PORT = process.env.NEXT_PUBLIC_PORT || "3000";
|
||||
export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
|
||||
export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL ||'http://con.mind-one.co.kr:11035/api/v1';
|
||||
export const SERVER_API_DM_URL = process.env.NEXT_PUBLIC_DM_SERVER_API_URL ||'http://con.mind-one.co.kr:11035/api/v1';
|
||||
export const SERVER_API_FO_URL = process.env.NEXT_PUBLIC_FO_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1';
|
||||
export const SERVER_API_WR_URL = process.env.NEXT_PUBLIC_WR_SERVER_API_URL||' http://con.mind-one.co.kr:11080/api/v1';
|
||||
export const SERVER_API_CS_URL = process.env.NEXT_PUBLIC_CS_SERVER_API_URL||'http://dev.onasys.co.kr:8000';
|
||||
|
||||
+10
-5
@@ -3,7 +3,7 @@
|
||||
import { BaseLayout } from "@common/components";
|
||||
import type { MenuItem } from "./store/common";
|
||||
import { useFoStore } from "./store";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
|
||||
export default function Base({
|
||||
children,
|
||||
@@ -11,12 +11,17 @@ export default function Base({
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const { getMenuAuth } = useFoStore((state) => state);
|
||||
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const handleClick = (id:MenuItem) =>{
|
||||
|
||||
const handleClick = (id: MenuItem) => {
|
||||
getMenuAuth(id.menuCd);
|
||||
router.push(id.urlPath);
|
||||
}
|
||||
};
|
||||
|
||||
return <BaseLayout handleMenuClick={handleClick}>{children}</BaseLayout>;
|
||||
return (
|
||||
<BaseLayout currentPath={pathname ?? ""} handleMenuClick={handleClick}>
|
||||
{children}
|
||||
</BaseLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ export class LoginApiService implements LoginService {
|
||||
|
||||
public async login(payload: ILogin): Promise<void> {
|
||||
try {
|
||||
console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN)
|
||||
console.log(payload.userId+' '+payload.password)
|
||||
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -107,7 +107,7 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic
|
||||
console.log('repairArr', repairArr);
|
||||
};
|
||||
fetchAll();
|
||||
}, []);
|
||||
}, [featureData]);
|
||||
|
||||
// 폼 데이터가 변경될 때 호출될 핸들러
|
||||
const handleFormDataChange = (newFormData: any) => {
|
||||
|
||||
@@ -162,7 +162,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => {
|
||||
<span className="text-2xl text-red-600 font-bold">● 침입수량 산정결과</span>
|
||||
<div className="flex items-center mt-2">
|
||||
<span className="ml-5 text-black text-xl">침입수량 : </span>
|
||||
<span className="w-[35px] inline-block text-right text-black text-xl font-bold">{inftwtQty}</span>
|
||||
<span className="w-[45px] inline-block text-right text-black text-xl font-bold">{inftwtQty}</span>
|
||||
<span className="ml-2 text-black text-xl">m³/d</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -170,7 +170,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => {
|
||||
{/* 차트 */}
|
||||
<div className="h-[90%] bg-white text-3xl">
|
||||
<MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'침입수량 그래프'}
|
||||
yFieldText2="시간" yFieldText="유량(m³/h)"/>
|
||||
yFieldText2="" yFieldText="유량(m³/h)"/>
|
||||
</div>
|
||||
</div>
|
||||
{popupOpen && (
|
||||
|
||||
@@ -161,17 +161,17 @@ const RdiiChart = ({ pplMngNo }: ModalOpenProp) => {
|
||||
<span className="text-2xl text-red-600 font-bold">● 강우유입수량 분석결과</span>
|
||||
<div className="flex items-center mt-2">
|
||||
<span className="w-[95px] inline-block text-right text-black text-xl">평균RDII : </span>
|
||||
<span className="w-[30px] inline-block text-right text-black text-xl font-bold"> {rdiiQty}</span>
|
||||
<span className="w-[45px] inline-block text-right text-black text-xl font-bold"> {rdiiQty}</span>
|
||||
<span className="ml-2 text-black"> m³/d</span>
|
||||
</div>
|
||||
<div className="flex items-center mt-2">
|
||||
<span className="w-[95px] inline-block text-right text-black text-xl">적용강우량 : </span>
|
||||
<span className="w-[30px] inline-block text-right text-black text-xl font-bold"> {rainTotal}</span>
|
||||
<span className="w-[45px] inline-block text-right text-black text-xl font-bold"> {rainTotal}</span>
|
||||
<span className="ml-2 text-black"> mm</span>
|
||||
</div>
|
||||
<div className="flex items-center mt-2">
|
||||
<span className="w-[95px] inline-block text-right text-black text-xl">강우량대비RDII : </span>
|
||||
<span className="w-[30px] inline-block text-right text-black text-xl font-bold"> {totalVolume}</span>
|
||||
<span className="w-[45px] inline-block text-right text-black text-xl font-bold"> {totalVolume}</span>
|
||||
<span className="ml-2 text-black"> m³/mm</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,8 +2,8 @@ import { VerticalTable } from '@/components/ui/verticalTable';
|
||||
import React, { useState, useEffect } from 'react'
|
||||
// 빗물펌프 자체 입력 정보
|
||||
const exclnInputColumn = [
|
||||
{ id: "swtrmtZoneCd", title: "처리구역", type: "input" },
|
||||
{ id: "mltvDtdvNm", title: "처리분구", type: "input" },
|
||||
{ id: "swtrmtZoneCd", title: "배수구역", type: "input" },
|
||||
{ id: "mltvDtdvNm", title: "배수분구", type: "input" },
|
||||
{ id: "dsgnFrqnc", title: "설계빈도(년)", type: "input" },
|
||||
]
|
||||
// 오수펌프 자체 입력 정보
|
||||
|
||||
@@ -41,7 +41,7 @@ const Map = () => {
|
||||
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const data = await getData('v1/map/lyrStngs/SN_NETWORK');
|
||||
const data = await getData("v1/map/lyrStngs/SN_NETWORK");
|
||||
setTreeData(data);
|
||||
} catch (error) {
|
||||
console.error("데이터 불러오기 실패:", error);
|
||||
@@ -115,22 +115,22 @@ const Map = () => {
|
||||
};
|
||||
return (
|
||||
<div className="bg-container">
|
||||
<Gis
|
||||
treeData={treeData}
|
||||
isSearch={true}
|
||||
gisMaps={gisMaps}
|
||||
isMiniMap={false}
|
||||
searchView={SearchModal}
|
||||
detailView={FeatureClickEventPopup}
|
||||
onFeatureSelect={onFeatureSelect}
|
||||
setIsOpen={setIsOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
featureData={featureData}
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
isOpen={isOpen}
|
||||
isSearchModalOpen={isSearchModalOpen}
|
||||
onCheckedLayersChange={undefined}
|
||||
/>
|
||||
<Gis
|
||||
treeData={treeData}
|
||||
isSearch={true}
|
||||
gisMaps={gisMaps}
|
||||
isMiniMap={false}
|
||||
searchView={SearchModal}
|
||||
detailView={FeatureClickEventPopup}
|
||||
onFeatureSelect={onFeatureSelect}
|
||||
setIsOpen={setIsOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
featureData={featureData}
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
isOpen={isOpen}
|
||||
isSearchModalOpen={isSearchModalOpen}
|
||||
onCheckedLayersChange={undefined}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ const BasicTab: React.FC<BasicTabProps> = ({
|
||||
setVar2,
|
||||
}) => {
|
||||
return (
|
||||
<div className="relative border rounded-lg p-6 mt-4 w-full h-[10vh]">
|
||||
<div className="relative border rounded-lg p-6 w-full h-[10vh]">
|
||||
{/* 구분 */}
|
||||
<div className="mb-3 flex items-center justify-between gap-4">
|
||||
<div className="flex items-center">
|
||||
|
||||
@@ -39,6 +39,7 @@ export const BIZ_TY_CD_SELECT_ARRAY = BIZ_TY_CD.map(item => ({
|
||||
}));
|
||||
// 운영정보 - 사업 현황
|
||||
export const operationTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "bizNm", title: "사업명" },
|
||||
{ id: "flfmtBgngYmd", title: "수행시작일자" },
|
||||
{ id: "flfmtEndYmd", title: "수행종료일자" },
|
||||
@@ -48,6 +49,7 @@ export const operationTableHeadlist = [
|
||||
];
|
||||
// 운영정보 - 보수 및 갱신 결과표
|
||||
export const operationMaintenanceTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
@@ -58,6 +60,7 @@ export const operationMaintenanceTableHeadlist = [
|
||||
];
|
||||
// 운영정보 - 청소 및 준설 결과표
|
||||
export const operationCleaningTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
@@ -67,6 +70,7 @@ export const operationCleaningTableHeadlist = [
|
||||
];
|
||||
// 운영정보 - 점검 및 진단 결과표
|
||||
export const operationInspectionTableHeadlist = [
|
||||
{ id: 'rowNumber', title: '일련번호' },
|
||||
{ id: "fcltMngNo", title: "관리번호" },
|
||||
{ id: "usgCd", title: "용도" },
|
||||
{ id: "mqltCd", title: "재질" },
|
||||
@@ -109,7 +113,7 @@ const OperationTab: React.FC<OperationTabProps> = ({
|
||||
setYearFilter,
|
||||
}) => {
|
||||
return (
|
||||
<div className="relative flex flex-col border rounded-lg p-6 mt-4 w-full h-[10vh]">
|
||||
<div className="relative flex flex-col border rounded-lg p-6 w-full h-[10vh]">
|
||||
<div className="flex items-center mb-3">
|
||||
<SelectBox
|
||||
className="w-80 mr-8"
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
'use client';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Button } from '@common/components';
|
||||
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
|
||||
import { SelectBox } from '@common/business_components/ui';
|
||||
import { Button, Input } from '@common/components';
|
||||
import React from 'react';
|
||||
//import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi';
|
||||
import { SelectBox, UiTable } from '@common/business_components/ui';
|
||||
import LoadingOverlay from '@/components/ui/LoadingBar';
|
||||
|
||||
import { addFileName, flattenFolders, getFileDownload, useCityCd, useDcTree, useSggCd, reportGubuns } from './searchModalReportApi';
|
||||
import { type SelectDataType } from '../commonStore';
|
||||
import { useCityCd, useSggCd } from '../components/searchModalReportApi';
|
||||
// import { useBizByFcltStore } from "../../../store/StoreProvider";
|
||||
|
||||
|
||||
// // 하수도정비 기본계획 보고서
|
||||
// 하수도정비 기본계획 보고서
|
||||
export const reportTableHeadlist = [
|
||||
{ id: "no", title: "NO" },
|
||||
{ id: "sido", title: "시도" },
|
||||
@@ -23,79 +24,180 @@ export const reportTableHeadlist = [
|
||||
|
||||
interface BasicTabProps {
|
||||
open?: boolean;
|
||||
gubun: string;
|
||||
sidos: SelectDataType[];
|
||||
ctpvCd: string | number;
|
||||
sigungu: string;
|
||||
filteredSiguns: SelectDataType[];
|
||||
yearFilter: { start: string; end: string; };
|
||||
handleSearch: () => void;
|
||||
handleCtpvCdChange: (val: string | number) => void;
|
||||
// onOpenChange?: (open: boolean) => void;
|
||||
// onFeatureSelect?: (row: any) => void;
|
||||
// setTableData?: (data: any[]) => void;
|
||||
// setTableCount?: (count: number) => void;
|
||||
setYearFilter: (filter: { start: string; end: string }) => void;
|
||||
setGubun: (gubun: string) => void;
|
||||
setSigungu: (sigungu: string) => void;
|
||||
}
|
||||
|
||||
const ReportTab: React.FC<BasicTabProps> = ({
|
||||
open,
|
||||
gubun,
|
||||
sidos,
|
||||
ctpvCd,
|
||||
sigungu,
|
||||
filteredSiguns = [{ val: '0', text: '전체', sido: '0' }],
|
||||
yearFilter,
|
||||
handleSearch,
|
||||
handleCtpvCdChange,
|
||||
// onOpenChange,
|
||||
// onFeatureSelect,
|
||||
// setTableData,
|
||||
// setTableCount,
|
||||
setYearFilter,
|
||||
setGubun,
|
||||
setSigungu,
|
||||
}) => {
|
||||
const ReportTab: React.FC<BasicTabProps> = ({ open }) => {
|
||||
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isResetPage, setIsResetPage] = useState<boolean>(false);
|
||||
const [isResetSelection, setIsResetSelection] = useState<boolean>(false);
|
||||
const [showTable, setShowTable] = useState(false);
|
||||
const [tableData, setTableData] = useState<any[]>([]);
|
||||
const [tableCount, setTableCount] = useState(0);
|
||||
const [curPage, setCurPage] = useState(1);
|
||||
const [yearFilter, setYearFilter] = useState({ start: "", end: "" });
|
||||
const [ctpvCd, setCtpvCd] = useState('0'); // 하수정비기본계획 report
|
||||
const [sigungu, setSigungu] = useState('0'); // 하수정비기본계획 report
|
||||
const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]);
|
||||
const [gubun, setGubun] = useState(""); // 하수정비기본계획 report
|
||||
const [reportGubun, setReportGubun] = useState("0"); // 하수정비기본계획 report
|
||||
|
||||
|
||||
// 하수정비기본계획 report
|
||||
const sidos = useCityCd();
|
||||
const siguns = useSggCd();
|
||||
const reportOriginData = useDcTree(""); //:Folder[]
|
||||
|
||||
const dynamicHeadlist: { id: string, title: string }[] = reportTableHeadlist;
|
||||
|
||||
useEffect(() => {
|
||||
// filterParams 초기화
|
||||
setCtpvCd('0');
|
||||
setSigungu('0');
|
||||
setReportGubun('0');
|
||||
setYearFilter({ start: "", end: "" });
|
||||
setShowTable(false);
|
||||
setTableData([]);
|
||||
setTableCount(0);
|
||||
setCurPage(1); // 페이지를 1로 초기화
|
||||
setIsResetPage(true); // 페이지를 초기화
|
||||
setIsResetSelection(true); // 선택 초기화
|
||||
}, [open]);
|
||||
|
||||
// 페이지 변경 시마다 데이터 fetch
|
||||
useEffect(() => {
|
||||
// showTable이 true일 때만 fetch (최초 렌더 방지)
|
||||
setIsResetPage(false);
|
||||
setIsResetSelection(true); // 선택 초기화
|
||||
if (showTable) fetchFilteredData();
|
||||
}, [curPage]);
|
||||
|
||||
const handleCtpvCdChange = (val: string | number) => { // 하수도정비기본계획.시도
|
||||
const sidoOption = sidos.find((n) => n.val === val);
|
||||
setCtpvCd(String(val));
|
||||
if (val !== '0') {
|
||||
const filterSiguns = siguns.filter(item => item.sido === sidoOption?.text);
|
||||
filterSiguns.unshift({ val: '0', text: '전체', sido: '0' });
|
||||
setFilteredSiguns(filterSiguns);
|
||||
}
|
||||
setSigungu("0");
|
||||
setGubun("");
|
||||
setYearFilter({ start: "", end: "", });
|
||||
}
|
||||
|
||||
|
||||
// 조회 버튼 클릭 시 1페이지로 이동 및 데이터 초기화
|
||||
const handleSearch = () => {
|
||||
setCurPage(1); // 페이지를 1로 초기화
|
||||
fetchFilteredData();
|
||||
setIsResetPage(true); // 페이지를 초기화
|
||||
setIsResetSelection(false); // 선택 초기화
|
||||
setShowTable(true);
|
||||
};
|
||||
|
||||
// 하수도정비기본계획 테이블 cellClick 핸들러
|
||||
const handleReportCellClick = (index: number | undefined ) => {
|
||||
console.log(index);
|
||||
if (typeof index === "number" && tableData[index]) {
|
||||
const reportData = tableData[index];
|
||||
const fileName = reportData.fileName;
|
||||
const filePath = reportData.filePath;
|
||||
if (reportData.fileSn !== "") {
|
||||
getFileDownload(reportData.fileSn, fileName, filePath);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 검색 API 호출 함수
|
||||
const fetchFilteredData = async () => {
|
||||
setIsLoading(true); // 로딩 시작
|
||||
setIsResetSelection(true); // 선택 초기화
|
||||
|
||||
try {
|
||||
//const reportOriginData = await getDcTree('경기도');
|
||||
const reportData = flattenFolders(reportOriginData);
|
||||
let filterReportData = reportData;
|
||||
if (ctpvCd !== "0") { // 시도검색
|
||||
const sidoOption = sidos.find((n) => n.val === ctpvCd);
|
||||
filterReportData = filterReportData.filter(item => item.sido === sidoOption?.text);
|
||||
}
|
||||
if (sigungu !== "0") { // 시군구검색
|
||||
const sigunguOption = filteredSiguns.find((n) => n.val === sigungu);
|
||||
filterReportData = filterReportData.filter(item => item.sigungu === sigunguOption?.text);
|
||||
}
|
||||
if (reportGubun !== "0") { // 보고서구분검색
|
||||
const reportGubunOption = reportGubuns.find((n) => n.val === reportGubun);
|
||||
filterReportData = filterReportData.filter(item => item.reportGubun === reportGubunOption?.text);
|
||||
}
|
||||
|
||||
if (yearFilter.start != "" && yearFilter.end == "") //승인년도검색
|
||||
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" : null);
|
||||
if (yearFilter.start == "" && yearFilter.end != "")
|
||||
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear <= yearFilter.end + "년" : null);
|
||||
if (yearFilter.start != "" && yearFilter.end != "") {
|
||||
filterReportData = filterReportData.filter(item => {
|
||||
return (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" && item.approvalYear <= yearFilter.end + "년" : null;
|
||||
});
|
||||
}
|
||||
if (gubun !== "") { // 구분검색
|
||||
filterReportData = filterReportData.filter(item => (item.plantZoneGugun) ? String(item.plantZoneGugun).includes(String(gubun)) : null);
|
||||
}
|
||||
console.log('report count:', filterReportData.length);
|
||||
setTableCount(filterReportData.length || 0);
|
||||
filterReportData = filterReportData.slice((curPage - 1) * 10, curPage * 10); // paging
|
||||
filterReportData = filterReportData?.map((item, index) => ({ ...item, no: (curPage - 1) * 10 + index + 1 }));
|
||||
//const fileList = await getDcFile("CLS20250530000041");
|
||||
addFileName(filterReportData).then(data => {
|
||||
filterReportData = data;
|
||||
setTableData(filterReportData || []);
|
||||
});
|
||||
setTableData(filterReportData || []);
|
||||
|
||||
setShowTable(true);
|
||||
} catch (err) {
|
||||
console.error('API ERROR:', err);
|
||||
setTableData([]);
|
||||
} finally {
|
||||
setIsLoading(false); // 로딩 종료
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div className="relative flex flex-col border rounded-lg p-6 mt-4 w-full h-[10vh]">
|
||||
<>
|
||||
<div className="relative flex flex-col border rounded-lg p-6 w-full h-[10vh]">
|
||||
<div className="flex items-center mb-3">
|
||||
<SelectBox
|
||||
className="w-[150px] mr-8"
|
||||
<SelectBox className="w-[150px] mr-8"
|
||||
selectClass="rounded-lg bg-white"
|
||||
label="시도"
|
||||
selectArray={sidos}
|
||||
value={ctpvCd}
|
||||
onSelectValue={handleCtpvCdChange}
|
||||
label="시도" selectArray={sidos}
|
||||
value={ctpvCd} onSelectValue={handleCtpvCdChange}
|
||||
selectContentClass="z-[101]"
|
||||
/>
|
||||
<SelectBox
|
||||
className="w-48"
|
||||
<SelectBox className="w-48"
|
||||
selectClass="w-48 rounded-lg bg-white truncate"
|
||||
label="시군구"
|
||||
selectArray={filteredSiguns}
|
||||
value={sigungu}
|
||||
onSelectValue={val => setSigungu(String(val))}
|
||||
label="시군구" selectArray={filteredSiguns}
|
||||
value={sigungu} onSelectValue={val => setSigungu(String(val))}
|
||||
selectContentClass="z-[101]"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center mb-6">
|
||||
<label className="inline-block w-auto whitespace-nowrap text-xl text-gray-600 mr-2">구분</label>
|
||||
{/* <label className="inline-block w-auto whitespace-nowrap text-xl text-gray-600 mr-2">구분</label>
|
||||
<Input
|
||||
className='!text-xl w-[100px] placeholder:text-center mr-8'
|
||||
placeholder="입력"
|
||||
value={gubun}
|
||||
onChange={(e) => { setGubun(e.target.value); }}
|
||||
/> */}
|
||||
<SelectBox className="w-[150px] mr-8"
|
||||
selectClass="rounded-lg bg-white"
|
||||
label="보고서구분" selectArray={[...reportGubuns]}
|
||||
value={reportGubun} onSelectValue={val => setReportGubun(String(val))}
|
||||
selectContentClass="z-[101]" labelClass='whitespace-nowrap text-xl text-gray-600 pr-2'
|
||||
/>
|
||||
<YearRangeSelectBox
|
||||
start={yearFilter.start}
|
||||
end={yearFilter.end}
|
||||
{/* 승인년도 필터 */}
|
||||
<YearRangeSelectBox start={yearFilter.start} end={yearFilter.end}
|
||||
onChange={range => setYearFilter({ ...yearFilter, start: range.start, end: range.end })}
|
||||
startLabel="승인년도"
|
||||
endLabel=""
|
||||
startLabel="승인년도" endLabel=""
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
@@ -103,6 +205,28 @@ const ReportTab: React.FC<BasicTabProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="h-[79vh] w-full overflow-hidden rounded-lg border">
|
||||
{/* 테이블2 영역 (가로/세로 스크롤 가능) */}
|
||||
<div className="flex-1 px-2 pb-2">
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<UiTable
|
||||
headName={(() => {
|
||||
return (<>조회 결과 ({tableCount.toLocaleString('ko-KR')})건</>);
|
||||
})()
|
||||
}
|
||||
tableData={tableData}
|
||||
headlist={dynamicHeadlist}
|
||||
pageSize={10}
|
||||
total={tableCount}
|
||||
cellClick={handleReportCellClick}
|
||||
onPageChange={setCurPage}
|
||||
resetPageNo={isResetPage}
|
||||
resetSelection={isResetSelection}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,11 +3,8 @@ import { UiModal, UITab, UiTable } from '@common/business_components/ui';
|
||||
import axios from 'axios';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { ExclnSewagePumpCol2, MsSwageMhlCol2, MsSwagePplCol2, stofcbrCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2 } from '../components/common/table';
|
||||
//import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi';
|
||||
import { type SelectDataType } from '../commonStore';
|
||||
import { MS_SWAGE_PPL_CODES, MS_SWAGE_PPL_USE_CODES, MS_SWAGE_MHL_CODES } from '../components/common/table';
|
||||
import { addFileName, flattenFolders, getFileDownload, useCityCd, useDcTree, useSggCd } from '../components/searchModalReportApi';
|
||||
// import { useBizByFcltStore } from "../../../store/StoreProvider";
|
||||
import { getData } from "@/components/lib/api";
|
||||
import BasicTab, { BASIC_TYPES } from './basicTab';
|
||||
import OperationTab, { BIZ_TY_CD, operationCleaningTableHeadlist, operationInspectionTableHeadlist, operationMaintenanceTableHeadlist, operationTableHeadlist, WORK_TYPES } from './operationTab';
|
||||
@@ -68,9 +65,10 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
const [detailBizId, setDetailBizId] = useState(0);
|
||||
const [city, setCity] = useState(0);
|
||||
const [sgg, setSgg] = useState(0);
|
||||
const [ctpvCd, setCtpvCd] = useState('0');
|
||||
const [sigungu, setSigungu] = useState('0');
|
||||
const [gubun, setGubun] = useState(""); // 하수정비기본계획 report
|
||||
const [ctpvCd, setCtpvCd] = useState('0'); // 하수정비기본계획 report
|
||||
const [sigungu, setSigungu] = useState('0'); // 하수정비기본계획 report
|
||||
const [gubun, setGubun] = useState(""); // 하수정비기본계획 report
|
||||
const [reportGubun, setReportGubun] = useState("0"); // 하수정비기본계획 report
|
||||
const [start1, setStart1] = useState("");
|
||||
const [start2, setStart2] = useState("");
|
||||
const [end1, setEnd1] = useState("");
|
||||
@@ -83,10 +81,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
const [yearFilter, setYearFilter] = useState({ start: "", end: "" });
|
||||
const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]);
|
||||
|
||||
const sidos = useCityCd();
|
||||
const siguns = useSggCd();
|
||||
const reportOriginData = useDcTree(""); //:Folder[]
|
||||
|
||||
|
||||
// 오늘 날짜 구하기
|
||||
const today = new Date();
|
||||
const todayYear = today.getFullYear().toString();
|
||||
@@ -105,7 +100,6 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
return [];
|
||||
}
|
||||
if (activeTab === 'operation') return operationTableHeadlist;
|
||||
if (activeTab === 'report') return reportTableHeadlist;
|
||||
|
||||
return [];
|
||||
}, [activeTab, basicType, workType]);
|
||||
@@ -134,8 +128,6 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
setVar4("");
|
||||
setCity(0);
|
||||
setSgg(0);
|
||||
setCtpvCd('0');
|
||||
setSigungu('0');
|
||||
setYearFilter({
|
||||
start: "",
|
||||
end: "",
|
||||
@@ -235,7 +227,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
} else if (activeTab === 'operation') {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${curPage - 1}`,
|
||||
size: '4',
|
||||
size: '5',
|
||||
};
|
||||
if (var1) RequestDTO.bizNm = var1;
|
||||
if (var2 != '0' && var2) RequestDTO.bizTyCd = var2;
|
||||
@@ -265,12 +257,13 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
console.log('필터링된 API 결과(개수):', res.totalElements);
|
||||
console.log('필터링된 API 결과(데이터):', res.content);
|
||||
|
||||
const mappedContent = (res.content || []).map((item: any) => {
|
||||
const mappedContent = (res.content || []).map((item: any, index: number) => {
|
||||
console.log("item:", item);
|
||||
const formattedItem = formatDisplayData(item);
|
||||
const matched = BIZ_TY_CD.find(code => code.lwpoCd === item.bizTyCd);
|
||||
return {
|
||||
...formattedItem,
|
||||
rowNumber: (curPage - 1) * 4 + index + 1, // 1부터 시작하는 일련번호 추가
|
||||
bizTyCd: matched ? matched.lwpoCdNm : item.bizTyCd,
|
||||
};
|
||||
});
|
||||
@@ -280,41 +273,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
setDetailTableData([]);
|
||||
setDetailTableCount(0);
|
||||
|
||||
} else if (activeTab === 'report') {
|
||||
//const reportOriginData = await getDcTree('경기도');
|
||||
const reportData = flattenFolders(reportOriginData);
|
||||
let filterReportData = reportData;
|
||||
if (ctpvCd !== "0") { // 시도검색
|
||||
const sidoOption = sidos.find((n) => n.val === ctpvCd);
|
||||
filterReportData = filterReportData.filter(item => item.sido === sidoOption?.text);
|
||||
}
|
||||
if (sigungu !== "0") { // 시군구검색
|
||||
const sigunguOption = filteredSiguns.find((n) => n.val === sigungu);
|
||||
filterReportData = filterReportData.filter(item => item.sigungu === sigunguOption?.text);
|
||||
}
|
||||
if (yearFilter.start != "" && yearFilter.end == "") //승인년도검색
|
||||
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" : null);
|
||||
if (yearFilter.start == "" && yearFilter.end != "")
|
||||
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear <= yearFilter.end + "년" : null);
|
||||
if (yearFilter.start != "" && yearFilter.end != "") {
|
||||
filterReportData = filterReportData.filter(item => {
|
||||
return (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" && item.approvalYear <= yearFilter.end + "년" : null;
|
||||
});
|
||||
}
|
||||
if (gubun !== "") { // 구분검색
|
||||
filterReportData = filterReportData.filter(item => (item.plantZoneGugun) ? String(item.plantZoneGugun).includes(String(gubun)) : null);
|
||||
}
|
||||
console.log('report count:', filterReportData.length);
|
||||
setTableCount(filterReportData.length || 0);
|
||||
filterReportData = filterReportData.slice((curPage - 1) * 10, curPage * 10); // paging
|
||||
filterReportData = filterReportData?.map((item, index) => ({ ...item, no: (curPage - 1) * 10 + index + 1 }));
|
||||
//const fileList = await getDcFile("CLS20250530000041");
|
||||
addFileName(filterReportData).then(data => {
|
||||
filterReportData = data;
|
||||
setTableData(filterReportData || []);
|
||||
});
|
||||
setTableData(filterReportData || []);
|
||||
}
|
||||
}
|
||||
|
||||
setShowTable(true);
|
||||
} catch (err) {
|
||||
@@ -521,19 +480,22 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${detailCurPage - 1}`,
|
||||
size: '4',
|
||||
bizId: tableData[index % 4].bizId,
|
||||
size: '5',
|
||||
bizId: tableData[index % 5].bizId,
|
||||
};
|
||||
|
||||
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
|
||||
console.log('운영정보 cellClick 데이터:', res);
|
||||
console.log('운영정보 length:', res.data.length);
|
||||
|
||||
const mappedData = (res.data || []).map((item: any) => {
|
||||
const mappedData = (res.data || []).map((item: any, detailIndex: number) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
const usgCdObj = MS_SWAGE_PPL_USE_CODES.find(code => code.val === item.usgCd.trim());
|
||||
const mqltCdObj = MS_SWAGE_PPL_CODES.find(code => code.val === item.mqltCd.trim());
|
||||
return {
|
||||
...item,
|
||||
...formattedItem,
|
||||
rowNumber: (detailCurPage - 1) * 4 + detailIndex + 1,
|
||||
usgCd: usgCdObj ? usgCdObj.text : item.usgCd,
|
||||
mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd,
|
||||
};
|
||||
@@ -557,18 +519,19 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
try {
|
||||
const RequestDTO: Record<string, string> = {
|
||||
page: `${detailCurPage - 1}`,
|
||||
size: '4',
|
||||
size: '5',
|
||||
bizId: String(detailBizId),
|
||||
};
|
||||
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
|
||||
console.log('운영정보 페이지네이션 데이터:', res);
|
||||
console.log('운영정보 페이지네이션 length:', res.data.length);
|
||||
|
||||
const mappedData = (res.data || []).map((item: any) => {
|
||||
const mappedData = (res.data || []).map((item: any, detailIndex: number) => {
|
||||
const formattedItem = formatDisplayData(item);
|
||||
|
||||
const usgCdObj = MS_SWAGE_PPL_USE_CODES.find(code => code.val === item.usgCd.trim());
|
||||
const mqltCdObj = MS_SWAGE_PPL_CODES.find(code => code.val === item.mqltCd.trim());
|
||||
return {
|
||||
...item,
|
||||
...formattedItem,
|
||||
rowNumber: (detailCurPage - 1) * 4 + detailIndex + 1,
|
||||
usgCd: usgCdObj ? usgCdObj.text : item.usgCd,
|
||||
mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd,
|
||||
};
|
||||
@@ -583,31 +546,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
}
|
||||
}
|
||||
};
|
||||
// 하수도정비기본계획 테이블 cellClick 핸들러
|
||||
const handleReportCellClick = (index: number | undefined, headId?: String) => {
|
||||
console.log(index);
|
||||
if (typeof index === "number" && tableData[index]) {
|
||||
const reportData = tableData[index];
|
||||
const fileName = reportData.fileName;
|
||||
const filePath = reportData.filePath;
|
||||
if (reportData.fileSn !== "") {
|
||||
getFileDownload(reportData.fileSn, fileName, filePath);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleCtpvCdChange = (val: string | number) => { // 하수도정비기본계획.시도
|
||||
const sidoOption = sidos.find((n) => n.val === val);
|
||||
setCtpvCd(String(val));
|
||||
if (val !== '0') {
|
||||
const filterSiguns = siguns.filter(item => item.sido === sidoOption?.text);
|
||||
filterSiguns.unshift({ val: '0', text: '전체', sido: '0' });
|
||||
setFilteredSiguns(filterSiguns);
|
||||
}
|
||||
setSigungu("0");
|
||||
setGubun("");
|
||||
setYearFilter({ start: "", end: "", });
|
||||
}
|
||||
|
||||
|
||||
const renderBody = () => (
|
||||
<>
|
||||
@@ -620,6 +559,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
}))}
|
||||
onValueChange={(value: string) => setActiveTab(value)}
|
||||
>
|
||||
</UITab>
|
||||
{/* 각각의 탭 영역 */}
|
||||
{/* 기본정보 탭 */}
|
||||
{activeTab === 'basic' && (
|
||||
@@ -667,26 +607,15 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
{activeTab === 'report' && (
|
||||
<ReportTab
|
||||
open={open}
|
||||
gubun={gubun}
|
||||
sidos={sidos}
|
||||
ctpvCd={ctpvCd}
|
||||
sigungu={sigungu}
|
||||
filteredSiguns={filteredSiguns}
|
||||
yearFilter={yearFilter}
|
||||
handleSearch={handleSearch}
|
||||
handleCtpvCdChange={handleCtpvCdChange}
|
||||
setYearFilter={setYearFilter}
|
||||
setGubun={setGubun}
|
||||
setSigungu={setSigungu}
|
||||
/>
|
||||
)}
|
||||
{/* </UITab2> */}
|
||||
</UITab>
|
||||
|
||||
|
||||
{/* 📋 결과 리스트 */}
|
||||
{/* 기본정보 탭, 하수도정비기본계획보고서 탭 */}
|
||||
{(activeTab === 'basic' || activeTab === 'report') && (
|
||||
<div className="h-[80vh] w-full overflow-hidden rounded-lg border">
|
||||
{(activeTab === 'basic' ) && (
|
||||
<div className="h-[79vh] w-full overflow-hidden rounded-lg border">
|
||||
{/* 테이블2 영역 (가로/세로 스크롤 가능) */}
|
||||
<div className="flex-1 px-2 pb-2">
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
@@ -700,7 +629,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
headlist={dynamicHeadlist}
|
||||
pageSize={10}
|
||||
total={tableCount}
|
||||
cellClick={activeTab === 'report' ? handleReportCellClick : handleBasicCellClick}
|
||||
cellClick={handleBasicCellClick}
|
||||
onPageChange={setCurPage}
|
||||
resetPageNo={isResetPage}
|
||||
resetSelection={isResetSelection}
|
||||
@@ -711,7 +640,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
{/* 운영정보 탭 */}
|
||||
{activeTab === 'operation' && (
|
||||
<>
|
||||
<div className="h-[35vh] w-full overflow-hidden rounded-lg border">
|
||||
<div className="h-[39vh] w-full overflow-hidden rounded-lg border">
|
||||
<div className="flex-1 px-2 pb-2">
|
||||
<LoadingOverlay isLoading={isLoading} />
|
||||
<UiTable
|
||||
@@ -723,7 +652,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
}
|
||||
tableData={tableData}
|
||||
headlist={dynamicHeadlist}
|
||||
pageSize={4}
|
||||
pageSize={5}
|
||||
total={tableCount}
|
||||
cellClick={handleOperationCellClick}
|
||||
onPageChange={setCurPage}
|
||||
@@ -733,7 +662,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="h-[35vh] w-full overflow-hidden rounded-lg border">
|
||||
<div className="h-[39vh] w-full overflow-hidden rounded-lg border">
|
||||
<div className="flex-1 px-2 pb-2">
|
||||
<LoadingOverlay isLoading={isDetailLoading} />
|
||||
<UiTable
|
||||
@@ -745,7 +674,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
|
||||
}
|
||||
tableData={detailTableData}
|
||||
headlist={dynamicHeadlist2}
|
||||
pageSize={4}
|
||||
pageSize={5}
|
||||
total={detailTableCount}
|
||||
cellClick={undefined}
|
||||
onPageChange={setDetailCurPage}
|
||||
|
||||
+16
-21
@@ -31,6 +31,14 @@ const isYear = (value: string): boolean => {
|
||||
return /^[0-9]{4}년$/.test(value);
|
||||
};
|
||||
|
||||
export const reportGubuns = [{val: '0', text: '전체'}, {val: '1', text: '보고서'}
|
||||
, {val: '2', text: '요약보고서'} , {val: '3', text: '부록'}, {val: '4', text: '기타'}];
|
||||
|
||||
/**
|
||||
* Flatten a hierarchical folder structure into a flat array.
|
||||
* @param data - The hierarchical folder data to flatten.
|
||||
* @returns An array of flattened folders with their paths and levels.
|
||||
*/
|
||||
export function flattenFolders(data: Folder[]): FlattenedFolder[] {
|
||||
const result: FlattenedFolder[] = [];
|
||||
const exceptNodeNm = ["부분","통합","전체"];
|
||||
@@ -72,15 +80,10 @@ export function flattenFolders(data: Folder[]): FlattenedFolder[] {
|
||||
}
|
||||
|
||||
data.forEach((root) => traverse(root, {}, 0));
|
||||
console.log(result.slice(0, 10));
|
||||
return result;
|
||||
}
|
||||
|
||||
export const getDcTree = async (clsfSystmNm:string) => {
|
||||
//const cityName = encodeURIComponent(clsfSystmNm);
|
||||
const queryString = 'clsfSystmNm='+clsfSystmNm;
|
||||
console.log("getDcTree queryString:", queryString);
|
||||
//const result = await getDcData(`/api/v1/dc/clsf${queryString ? `?${queryString}` : ''}`);
|
||||
const result = await getDcData("/api/v1/dc/clsf?clsfSystmNm=" + clsfSystmNm);
|
||||
return result;
|
||||
};
|
||||
@@ -110,13 +113,8 @@ export const addFileName = async (data:FlattenedFolder[]) => {
|
||||
data.map(async (item) => {
|
||||
const filenameArr:ReportDataFile[] = await getDcFile(String(item.clsfSystmSn));
|
||||
const f = filenameArr[0];
|
||||
//console.log("clsfSystmSn:", item.clsfSystmSn, "f:", f);
|
||||
const result = {...item, fileName:f?.fileTitle, regDate:f?.regDt, fileSn:f?.fileSn, filePath:f?.filePath};
|
||||
// if (f !== undefined && f.fileSn !== "") {
|
||||
// const fprcs = await getDcFileprcs(f?.fileSn);
|
||||
// if (fprcs.length>0)
|
||||
// result.filePath = fprcs[0].filePath;
|
||||
// }
|
||||
|
||||
return result;
|
||||
})
|
||||
);
|
||||
@@ -124,7 +122,6 @@ export const addFileName = async (data:FlattenedFolder[]) => {
|
||||
}
|
||||
export const getDcFileprcs = async (fileSn:string) => {
|
||||
const queryString = 'fileSn='+fileSn;
|
||||
console.log("getDcTree queryString:", queryString);
|
||||
const result = await getDcData(`/api/v1/dc/fileprcs${queryString ? `?${queryString}` : ''}`);
|
||||
return result;
|
||||
};
|
||||
@@ -151,9 +148,6 @@ export const fileDownload = (data:Blob, fileName:string) => { // Blob데이터
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
export const getFileDownload = async (fileSn:string, fileName:string, filePath:string) => {
|
||||
//const fileprcsData = await getDcFileprcs(fileSn); // filePath 조회
|
||||
//if (fileprcsData?.length === 0 ) { alert("filePath 조회 오류"); }
|
||||
//if (fileprcsData[0].filePath === "") alert("filePath 정보 없으므로 다운로드 불가");
|
||||
if (filePath === "") alert("filePath 정보 없으므로 다운로드 불가:filesn"+ fileSn);
|
||||
const blobData = await getDcFileDownload(filePath); // 실제 다운로드 API
|
||||
fileDownload(blobData, fileName);
|
||||
@@ -165,12 +159,13 @@ export const getCityCd = async (): Promise<SelectDataType[]> => {
|
||||
if (!response.ok) throw new Error(`시도 데이터 오류: ${response.status}`);
|
||||
const res = await response.json();
|
||||
const city = res.data;
|
||||
const cityCd = city.map((item: any) => ({
|
||||
let citys:SelectDataType[] = city.map((item: {adstDstrCd:string, sido:string}) => ({
|
||||
val: item.adstDstrCd,
|
||||
text: item.sido,
|
||||
}));
|
||||
cityCd.unshift({ val: '0', text: '전체' });
|
||||
return cityCd;
|
||||
citys = citys.sort((a:SelectDataType, b:SelectDataType) => a.text.localeCompare(b.text));
|
||||
citys.unshift({ val: '0', text: '전체' });
|
||||
return citys;
|
||||
} catch (error) {
|
||||
console.error('시도 데이터를 가져오는데 실패했습니다:', error);
|
||||
return [{ val: '0', text: '전체', sido: '0' }];
|
||||
@@ -186,9 +181,9 @@ export const useSggCd = () => {
|
||||
if (result) {
|
||||
setData(result);
|
||||
}
|
||||
console.log("useSggCd호출");
|
||||
};
|
||||
fetch();
|
||||
console.log("useSggCd호출");
|
||||
}, []);
|
||||
return data;
|
||||
};
|
||||
@@ -200,7 +195,7 @@ export const getSggCd = async (): Promise<SelectDataType[]> => {
|
||||
if (!response.ok) throw new Error(`시군구 데이터 오류: ${response.status}`);
|
||||
const res = await response.json();
|
||||
const sgg = res.data;
|
||||
const sggCd = sgg.map((item: any) => ({
|
||||
const sggCd = sgg.map((item: {adstDstrCd:string, sido:string, gugun:string}) => ({
|
||||
val: item.adstDstrCd,
|
||||
sido: item.sido,
|
||||
text: item.gugun,
|
||||
@@ -222,9 +217,9 @@ export const useCityCd = () => {
|
||||
if (result) {
|
||||
setData(result);
|
||||
}
|
||||
console.log("useCityCd호출");
|
||||
};
|
||||
fetch();
|
||||
console.log("useCityCd호출");
|
||||
}, []);
|
||||
return data;
|
||||
};
|
||||
@@ -30,6 +30,13 @@ const SwageMhl: React.FC<SwageMhlProps> = ({
|
||||
setYearFilter,
|
||||
handleSearch,
|
||||
}) => {
|
||||
|
||||
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
<div className="mb-2 flex items-center">
|
||||
@@ -70,6 +77,7 @@ const SwageMhl: React.FC<SwageMhlProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -81,6 +89,7 @@ const SwageMhl: React.FC<SwageMhlProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
|
||||
@@ -31,6 +31,13 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
|
||||
setYearFilter,
|
||||
handleSearch,
|
||||
}) => {
|
||||
|
||||
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
<div className="flex items-center mb-2">
|
||||
@@ -53,6 +60,7 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -64,6 +72,7 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 양수능력 - 우수맨홀 */}
|
||||
<Label className="mr-2 w-auto text-xl text-gray-600">
|
||||
@@ -78,6 +87,7 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart2(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -89,6 +99,7 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd2(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
|
||||
@@ -33,6 +33,13 @@ const SwagePpl: React.FC<SwagePplProps> = ({
|
||||
setYearFilter,
|
||||
handleSearch,
|
||||
}) => {
|
||||
|
||||
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-6">
|
||||
<div className="mb-2 flex items-center">
|
||||
@@ -85,6 +92,7 @@ const SwagePpl: React.FC<SwagePplProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setVar1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -96,6 +104,7 @@ const SwagePpl: React.FC<SwagePplProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 연장 */}
|
||||
<Label className="mr-2 w-auto text-xl text-gray-600">연장(m)</Label>
|
||||
@@ -108,6 +117,7 @@ const SwagePpl: React.FC<SwagePplProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -119,6 +129,7 @@ const SwagePpl: React.FC<SwagePplProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
|
||||
@@ -35,6 +35,13 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
setYearFilter,
|
||||
handleSearch,
|
||||
}) => {
|
||||
|
||||
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
{/* 가동개시일자 */}
|
||||
@@ -64,6 +71,7 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -75,6 +83,7 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd1(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 처리구역 면적 */}
|
||||
<Label className="mr-2 w-auto text-xl text-gray-600">처리구역 면적(m²)</Label>
|
||||
@@ -87,6 +96,7 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setStart2(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<span className="mx-2 text-xl font-semibold">~</span>
|
||||
<Input
|
||||
@@ -98,6 +108,7 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
const val = e.target.value.replace(/[^0-9]/g, "");
|
||||
setEnd2(val);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 하수처리시설명 */}
|
||||
<Label className="mr-2 w-auto text-xl text-gray-600">하수처리시설명</Label>
|
||||
@@ -108,6 +119,7 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
|
||||
onChange={(e) => {
|
||||
setVar1(e.target.value);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
|
||||
@@ -27,6 +27,13 @@ const swagePrcsZone: React.FC<swagePrcsZoneProps> = ({
|
||||
setSgg,
|
||||
handleSearch,
|
||||
}) => {
|
||||
|
||||
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-3">
|
||||
<div className="mb-2 flex items-center">
|
||||
@@ -47,6 +54,7 @@ const swagePrcsZone: React.FC<swagePrcsZoneProps> = ({
|
||||
onChange={(e) => {
|
||||
setVar1(e.target.value);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
<Label className="mr-2 w-auto text-xl text-gray-600">하수처리시설명</Label>
|
||||
<Input
|
||||
@@ -56,6 +64,7 @@ const swagePrcsZone: React.FC<swagePrcsZoneProps> = ({
|
||||
onChange={(e) => {
|
||||
setVar2(e.target.value);
|
||||
}}
|
||||
onKeyDown={handleEnterKey}
|
||||
/>
|
||||
{/* 조회 버튼 */}
|
||||
<div className="flex-1 flex justify-end">
|
||||
|
||||
@@ -307,8 +307,8 @@ const Result = () => {
|
||||
onDeleteFile={handleFileDelete}
|
||||
selectedRowData={selectedRowData}
|
||||
>
|
||||
{[<div key='table1' className="h-[55vh] flex flex-col p-4 border rounded-lg bg-white shadow-md">
|
||||
<div className="mb-[1.2rem] text-xl font-medium">○ RDII 분석결과 현황</div>
|
||||
{[<div key='table1' className="h-[58vh] flex flex-col border rounded-lg bg-white shadow-md">
|
||||
{/* <div className="mb-[1.2rem] text-xl font-medium">○ RDII 분석결과 현황</div> */}
|
||||
<div className="flex-grow overflow-auto">
|
||||
<UiTable
|
||||
headName=''
|
||||
|
||||
@@ -307,8 +307,8 @@ const Result = () => {
|
||||
onDeleteFile={handleFileDelete}
|
||||
selectedRowData={selectedRowData}
|
||||
>
|
||||
{[<div key='table1' className="h-[55vh] flex flex-col p-4 border rounded-lg bg-white shadow-md">
|
||||
<div className="mb-[1.2rem] text-xl font-medium">○ 침입수 산정결과 현황</div>
|
||||
{[<div key='table1' className="h-[58vh] flex flex-col border rounded-lg bg-white shadow-md">
|
||||
{/* <div className="mb-[1.2rem] text-xl font-medium">○ 침입수 산정결과 현황</div> */}
|
||||
<div className="flex-grow overflow-auto">
|
||||
<UiTable
|
||||
headName=''
|
||||
|
||||
@@ -87,7 +87,6 @@ export const deleteData = async (url: string, data?: object): Promise<any> => {
|
||||
|
||||
// RSONE DC API 호출
|
||||
export const getDcData = async (url: string, data?: object): Promise<any> => {
|
||||
console.log(url);
|
||||
const res = await fetch('/dc-service' + url, {
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
@@ -7,8 +7,8 @@ import { useRouter } from "next/navigation";
|
||||
|
||||
export default function Home() {
|
||||
const router = useRouter();
|
||||
const userId = "admin1gmail";
|
||||
const password = "test1234!";
|
||||
const userId = "CLEANWATER";
|
||||
const password = "gktneh12!@";
|
||||
const checkToken = getCookie(AUTH_USER_ID);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
NEXT_PUBLIC_SITE_ID = WR
|
||||
NEXT_PUBLIC_PORT = 11301
|
||||
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
|
||||
# NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
NEXT_PUBLIC_SITE_ID = WR
|
||||
NEXT_PUBLIC_PORT = 3001
|
||||
NEXT_PUBLIC_PROXY_HOST = http://localhost:3001
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_SERVER_API_URL=http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
@@ -13,7 +14,7 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
|
||||
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
|
||||
|
||||
|
||||
|
||||
+32
-32
@@ -1,39 +1,39 @@
|
||||
# NEXT_PUBLIC_SITE_ID = WR
|
||||
# NEXT_PUBLIC_PORT = 3000
|
||||
# NEXT_PUBLIC_PROXY_HOST = http://wr.hasuon.or.kr
|
||||
# NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/api/v1
|
||||
# NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/operation-service/api/v1
|
||||
# NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000
|
||||
# NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
# NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver
|
||||
# NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
|
||||
# NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
# NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
# NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
# NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
# NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEXT_PUBLIC_SITE_ID = WR
|
||||
NEXT_PUBLIC_PORT = 11301
|
||||
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
|
||||
# NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_PORT = 3000
|
||||
NEXT_PUBLIC_PROXY_HOST = http://wr.hasuon.or.kr
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/api/v1
|
||||
NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/operation-service/api/v1
|
||||
NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||
NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
|
||||
NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# NEXT_PUBLIC_SITE_ID = WR
|
||||
# NEXT_PUBLIC_PORT = 11301
|
||||
# NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
|
||||
# # NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
# NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
|
||||
# NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
|
||||
# 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 = http://rsone.iptime.org:10010/geoserver
|
||||
# NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||
# NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
# NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
# NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
# NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
|
||||
# NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
|
||||
|
||||
+15
-14
@@ -1,24 +1,25 @@
|
||||
"use client"
|
||||
import { BaseLayout } from "@common/components/ui"
|
||||
import { useWrStore } from "./store"
|
||||
import { MainDiv } from "@common/business_components/ui"
|
||||
import type { MenuItem } from "./store/common/type/menu"
|
||||
import { useRouter } from "next/navigation"
|
||||
"use client";
|
||||
import { BaseLayout } from "@common/components/ui";
|
||||
import { useWrStore } from "./store";
|
||||
import { MainDiv } from "@common/business_components/ui";
|
||||
import type { MenuItem } from "./store/common/type/menu";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
export default function Base({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const { getMenuAuthrts } = useWrStore((state) => state)
|
||||
const router = useRouter()
|
||||
const { getMenuAuthrts } = useWrStore((state) => state);
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
|
||||
const changeMenu = (path: MenuItem) => {
|
||||
getMenuAuthrts(path.menuCd)
|
||||
router.push(path.urlPath)
|
||||
}
|
||||
getMenuAuthrts(path.menuCd);
|
||||
router.push(path.urlPath);
|
||||
};
|
||||
return (
|
||||
<BaseLayout handleMenuClick={changeMenu}>
|
||||
<BaseLayout currentPath={pathname ?? ""} handleMenuClick={changeMenu}>
|
||||
<MainDiv>{children}</MainDiv>
|
||||
</BaseLayout>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,10 @@ const Map = () => {
|
||||
}, []);
|
||||
|
||||
// 체크된 레이어 정보를 받는 핸들러
|
||||
const handleCheckedLayersChange = (checkedIds: string[], checkedNodesData: any[]) => {
|
||||
const handleCheckedLayersChange = (
|
||||
checkedIds: string[],
|
||||
checkedNodesData: any[]
|
||||
) => {
|
||||
setCheckedLayers(checkedIds);
|
||||
setCheckedLayersData(checkedNodesData);
|
||||
};
|
||||
@@ -58,28 +61,41 @@ const Map = () => {
|
||||
|
||||
// 2. data가 OpenLayers Feature 인스턴스인지 확인
|
||||
let foundFeature: any = null;
|
||||
if (
|
||||
data &&
|
||||
typeof data.getGeometry === "function" &&
|
||||
typeof data.setStyle === "function"
|
||||
console.log(data)
|
||||
//console.log(data.getId())
|
||||
let featureId = data.fid;
|
||||
const layerName = data.layerNm;
|
||||
|
||||
if (layerName === "재이용시설") {
|
||||
// 재이용시설
|
||||
featureId = `${layerName}.${data.searchPk}`;
|
||||
} else if ( //빗물이용시설, 중수도시설
|
||||
layerName === "빗물이용시설" ||
|
||||
layerName == "tb_wr_rswtr_fclt"
|
||||
) {
|
||||
// 이미 Feature 인스턴스라면 그대로 사용
|
||||
foundFeature = data;
|
||||
featureId = `${layerName}.${data.bdstInfoSn}`;
|
||||
} else if (layerName === "tb_il_swage_prcs_fclt") { //하수처리시설
|
||||
featureId = `${layerName}.${data.bscFctCd}`;
|
||||
} else if (layerName === "tb_wr_htdfl_fclt") { //온배수시설
|
||||
featureId = `${layerName}.${data.bdstRuseFcltSn}`;
|
||||
} else if (layerName == "tb_wr_ruse_fclt_dmd_co") { //수요처
|
||||
featureId = `${layerName}.${data.dmdInfoId.replaceAll("-", "")}`;
|
||||
} else {
|
||||
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
|
||||
const featureId = data.fid || data.ftrIdn || data.id;
|
||||
map
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatureById) {
|
||||
const feature = source.getFeatureById(String(featureId).trim());
|
||||
if (feature) foundFeature = feature;
|
||||
}
|
||||
});
|
||||
console.warn("해당 레이어에 대한 featureId 매핑 없음", layerName);
|
||||
featureId = `${layerName}.${data.fid || data.id || data.ftrIdn}`;
|
||||
}
|
||||
|
||||
map
|
||||
.getLayers()
|
||||
.getArray()
|
||||
.forEach((layer: any) => {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatureById) {
|
||||
const feature = source.getFeatureById(String(featureId).trim());
|
||||
if (feature) foundFeature = feature;
|
||||
}
|
||||
});
|
||||
|
||||
// 3. 피처 선택
|
||||
if (foundFeature) {
|
||||
const geometry = foundFeature.getGeometry();
|
||||
@@ -123,17 +139,7 @@ const Map = () => {
|
||||
gisMaps={gisMaps}
|
||||
isMiniMap={false}
|
||||
searchView={undefined}
|
||||
// searchView={(props: any) => (
|
||||
// <MapSearchBar
|
||||
// searchType="공급처 후보지 조회"
|
||||
// showApplyButton={false}
|
||||
// checkedLayers={checkedLayers}
|
||||
// checkedLayersData={checkedLayersData}
|
||||
// {...props}
|
||||
// />
|
||||
// )
|
||||
// }
|
||||
detailView={(props: any) =>(
|
||||
detailView={(props: any) => (
|
||||
<NewWindowPopup
|
||||
onClose={handlePopupClose} // 메모이제이션된 함수 사용
|
||||
checkedLayers={checkedLayers}
|
||||
|
||||
@@ -116,6 +116,7 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
||||
const [mngList, setMngList] = useState<DemandCompType[]>(coSttnRes || []);
|
||||
///////////////////////////////////////////// 피쳐데이터 선택 시 각 시설별 데이터 처리 ///////////////////////////////////////////////
|
||||
const getSelectedLayers = () => {
|
||||
console.log(1)
|
||||
let result = null;
|
||||
const layers = gisMap ? gisMap.getLayers().getArray().filter((l: any) => l.getVisible()) : []; // gisMap이 null인지 확인 후 레이어 가져오기
|
||||
let featureLayer: { get: (key: string) => any } = { get: () => null };
|
||||
@@ -127,6 +128,7 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
||||
}
|
||||
});
|
||||
result = featureLayer.get('lyrNm');
|
||||
console.log(result)
|
||||
|
||||
return result;
|
||||
};
|
||||
@@ -156,15 +158,15 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
||||
}
|
||||
};
|
||||
const detainSttn = async (featureCd: string, layerNm: string) => {
|
||||
if (layerNm == '빗물이용시설') {
|
||||
if (layerNm == '빗물이용시설') { //빗물이용시설
|
||||
const res = await getFetch(fetchType.WR, `/reuseFc/rainyInfoList/1/20/0/${featureCd}`)
|
||||
setRainList(res)
|
||||
}
|
||||
else if (layerNm == '중수도시설') {
|
||||
else if (layerNm == '중수도시설') { //중수도 시설
|
||||
const res = await getFetch(fetchType.WR, `/reuseFc/waterreuseFc/1/20/0/${featureCd}`)
|
||||
setRswtrList(res)
|
||||
}
|
||||
else if(layerNm =='수요처'){
|
||||
else if(layerNm =='수요처'){ //수요처
|
||||
const res = await getFetch(fetchType.WR, `/reuseFc/request/1/20/0/${featureCd}`)
|
||||
setMngList(res)
|
||||
}
|
||||
@@ -192,6 +194,7 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
||||
},[mngList])
|
||||
|
||||
const layerId = getSelectedLayers();
|
||||
console.log(layerId)
|
||||
if (featureData && typeof featureData.getProperties === "function") {
|
||||
const selectedVal = featureData.getProperties();
|
||||
let featureCd = layerId == '하수재이용시설' ? selectedVal?.swtrmt_fclt_cd : layerId == '빗물이용시설' || layerId == '중수도시설' || layerId == '온배수시설' || layerId == '수요처' ? selectedVal?.bdst_nm : layerId == '하수처리시설' ? selectedVal?.swtrmt_fclt_nm : null;
|
||||
@@ -507,7 +510,7 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
||||
//하수처리시설
|
||||
const isPrcsFclt = layerId == '하수처리시설'
|
||||
// 재이용시설
|
||||
const isPbnst = layerId == '하수재이용시설';
|
||||
const isPbnst = layerId == '재이용시설';
|
||||
// 빗물이용시설
|
||||
const isRain = layerId == '빗물이용시설';
|
||||
// 중수도시설
|
||||
@@ -515,7 +518,7 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
|
||||
// 온배수시설
|
||||
const isHtdfl = layerId == '온배수시설';
|
||||
// 수요처관리
|
||||
const isReuseMng = layerId == '수요처';
|
||||
const isReuseMng = layerId == '수요처관리';
|
||||
if (isPrcsFclt) {
|
||||
if (viewMode == 'list') {
|
||||
return (
|
||||
|
||||
@@ -617,63 +617,31 @@ export default function CoMatRvw() {
|
||||
<div className="col-span-12 w-full">
|
||||
<h1 className={formH1Class}>공급처 후보지</h1>
|
||||
</div>
|
||||
<div className="col-span-4 mt-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`demandMatching.splyCndtList.${0}`}
|
||||
render={({ field }) => (
|
||||
<FormUi label="후보지1">
|
||||
<Input
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
field.onChange(String(e.target.value));
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-4 mt-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`demandMatching.splyCndtList.${1}`}
|
||||
render={({ field }) => (
|
||||
<FormUi label="후보지2">
|
||||
<Input
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value);
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-4 mt-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`demandMatching.splyCndtList.${2}`}
|
||||
render={({ field }) => (
|
||||
<FormUi label="후보지3">
|
||||
<Input
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value);
|
||||
}}
|
||||
value={field.value ?? ""}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
{[0, 1, 2].map((idx) => (
|
||||
<div key={idx} className="col-span-4 mt-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`splyCndtList.${idx}`}
|
||||
render={({ field }) => (
|
||||
<FormUi label={`후보지${idx + 1}`}>
|
||||
<Input
|
||||
placeholder=""
|
||||
type="text"
|
||||
onChange={(e) => {
|
||||
const newValue = {
|
||||
...(field.value || {}),
|
||||
ruseUtztnFcltNm: e.target.value,
|
||||
};
|
||||
field.onChange(newValue);
|
||||
}}
|
||||
value={field.value?.ruseUtztnFcltNm ?? ""}
|
||||
readOnly
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Form>
|
||||
<ConCostForm
|
||||
|
||||
@@ -71,7 +71,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
// defaultValues: { items: pbnstRegArrayZod.parse([]) },
|
||||
mode: "onChange",
|
||||
});
|
||||
const { isDirty } = form.formState;
|
||||
// const { isDirty } = form.formState;
|
||||
|
||||
const {
|
||||
fields: items,
|
||||
@@ -90,10 +90,10 @@ export default function PublicReuseFaciltyInsert() {
|
||||
}, [pbnst.isInit, pubHasuInit]);
|
||||
|
||||
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
|
||||
if (!isDirty) {
|
||||
toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시
|
||||
return;
|
||||
}
|
||||
// if (!isDirty) {
|
||||
// toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시
|
||||
// return;
|
||||
// }
|
||||
const data = writeRgtrAndMdfr(valuse.items);
|
||||
let bizs = [] as fcBizType[];
|
||||
data.forEach((fclt) => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { btnClass } from "@/app/store/common/code";
|
||||
import { prfRegPageSize } from "@/app/store/prfmncReg/pbnstPrfmncReg";
|
||||
import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type";
|
||||
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
|
||||
@@ -33,6 +34,8 @@ export default function PbnstSttn() {
|
||||
} = useWrStore((state) => state);
|
||||
|
||||
const { pbnstSttnRes, fclts, pbnstSttnResCount } = pbnstSttn;
|
||||
|
||||
const [isReset, setIsReset] = useState(false);
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
@@ -67,6 +70,24 @@ export default function PbnstSttn() {
|
||||
},
|
||||
[getPbnStnDetail, pbnstSttnRes]
|
||||
);
|
||||
useEffect(() => {
|
||||
if (!pbnstSttn.isInit) {
|
||||
getFlcts();
|
||||
}
|
||||
}, [pbnstSttn.isInit]);
|
||||
useEffect(() => {
|
||||
|
||||
pbnSttnInit("1", "15", ref.current, searchYear, fclts);
|
||||
}, [fclts]);
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnstSttnRes && pbnstSttnRes.length > 0) {
|
||||
setBdstTable(pbnstSttnRes);
|
||||
} else {
|
||||
setBdstTable([]);
|
||||
}
|
||||
}, [pbnstSttnRes]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnstSttn.excelList.length >= 0) {
|
||||
@@ -79,22 +100,7 @@ export default function PbnstSttn() {
|
||||
);
|
||||
}
|
||||
}, [pbnstSttn.excelList]);
|
||||
useEffect(() => {
|
||||
if (!pbnstSttn.isInit) {
|
||||
getFlcts();
|
||||
}
|
||||
}, [pbnstSttn.isInit, pbnSttnInit, ref.current]);
|
||||
useEffect(() => {
|
||||
if (pbnstSttnRes && pbnstSttnRes.length > 0) {
|
||||
setBdstTable(pbnstSttnRes);
|
||||
} else {
|
||||
setBdstTable([]);
|
||||
}
|
||||
}, [pbnstSttnRes]);
|
||||
|
||||
useEffect(() => {
|
||||
pbnSttnInit("1", "15", ref.current, searchYear, pbnstSttn.fclts);
|
||||
}, [fclts]);
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnstSttn.pbnstDetail.pbnstRuseFcltId)
|
||||
@@ -117,6 +123,7 @@ export default function PbnstSttn() {
|
||||
selectUnitWaterShedData={code.lgbsnCd}
|
||||
selectMiddleRegionData={code.mdmbsnCd}
|
||||
selectEnvPartData={code.lclgvrnmntCd}
|
||||
buttonOrder={["query", "init", "excel"]}
|
||||
rightClassName="ml-auto mr-6 flex items-center space-x-1"
|
||||
leftClassName="flex gap-5 w-9/12 m-4"
|
||||
leftSelectClassName="w-1/4"
|
||||
@@ -155,16 +162,11 @@ export default function PbnstSttn() {
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
queryClick={function (returnType: ReturnType): void {
|
||||
pbnstSttnSearch(
|
||||
false,
|
||||
"1",
|
||||
"15",
|
||||
returnType,
|
||||
pbnRuseNm,
|
||||
searchYear,
|
||||
fclts
|
||||
);
|
||||
queryClick={ ()=> {
|
||||
// pbnSearch(returnType);
|
||||
|
||||
//setTableIndex(0)
|
||||
setIsReset(true);
|
||||
}}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void {
|
||||
@@ -192,13 +194,16 @@ export default function PbnstSttn() {
|
||||
pbnstSttnSearch(
|
||||
false,
|
||||
String(page),
|
||||
String(15),
|
||||
String(prfRegPageSize),
|
||||
ref.current,
|
||||
pbnRuseNm,
|
||||
searchYear,
|
||||
fclts
|
||||
);
|
||||
setIsReset(false);
|
||||
}}
|
||||
|
||||
resetPageNo={isReset}
|
||||
>
|
||||
<HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} />
|
||||
</UiTable>
|
||||
|
||||
@@ -38,11 +38,12 @@ import { useTranslation } from "react-i18next";
|
||||
import { headMakeprfmnc } from "../chkgdnReg/TableHead";
|
||||
|
||||
export default function PrfmncPrfmncReg() {
|
||||
const { auth, prfmnc, prfmncHasuInit, prfmnRegData, prfmncHasuNmSearch } = useWrStore(
|
||||
const { auth, prfmnc, prfmncHasuInit, prfmnRegData, prfmncHasuNmSearch,getPrfFmcRes } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { pbnstPrfmncHeadList, monthHeadList, prfmncRes, prfmncResCount } = prfmnc;
|
||||
const { prfPbnFclts, pbnstPrfmncHeadList, monthHeadList, prfmncRes, prfmncResCount } = prfmnc;
|
||||
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
|
||||
const [isReset, setIsReset] = useState(false);
|
||||
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [isExcelOpen, setIsExcelOPen] = useState<{
|
||||
@@ -51,7 +52,6 @@ export default function PrfmncPrfmncReg() {
|
||||
}>({ isModal: false, data: {} as FcPrfType });
|
||||
const [inputData, setInputData] = useState<any[]>();
|
||||
const [pbnstRuseFcltId, setpbnstRuseFcltId] = useState<string>();
|
||||
const [pageNation, setPageNation] = useState<number>(1);
|
||||
const [cellNum, setCellNum] = useState<number>(1);
|
||||
const [searchYear, setSearchYear] = useState<string>(
|
||||
String(new Date().getFullYear())
|
||||
@@ -65,20 +65,6 @@ export default function PrfmncPrfmncReg() {
|
||||
"A1:O1"
|
||||
);
|
||||
}, [prfmnc.excelList]);
|
||||
/*
|
||||
const onSave = useCallback(
|
||||
async() => {
|
||||
if (pbnstRuseFcltId) {
|
||||
await prfmnRegData(pageNation,'41',
|
||||
excelToPbnPrfData(
|
||||
inputData as unknown as JSON[],
|
||||
searchYear,
|
||||
pbnstRuseFcltId
|
||||
) as unknown as PrfType
|
||||
);
|
||||
// cellClick(cellNum)
|
||||
}
|
||||
}, [inputData, searchYear, pbnstRuseFcltId, pageNation,cellNum]);*/
|
||||
|
||||
const { t } = useTranslation('base');
|
||||
const onSave = useCallback(() => {
|
||||
@@ -86,19 +72,20 @@ export default function PrfmncPrfmncReg() {
|
||||
if (!pbnstRuseFcltId) return;
|
||||
|
||||
prfmnRegData(
|
||||
pageNation,
|
||||
1,
|
||||
'41',
|
||||
excelToPbnPrfData(
|
||||
inputData as unknown as JSON[],
|
||||
searchYear,
|
||||
pbnstRuseFcltId
|
||||
) as unknown as PrfType
|
||||
, searchYear
|
||||
, searchYear,
|
||||
prfPbnFclts
|
||||
);
|
||||
};
|
||||
|
||||
confirmToast(t('isUpdateMsg'), handleConfirm);
|
||||
}, [inputData, searchYear, pbnstRuseFcltId, pageNation, cellNum]);
|
||||
}, [inputData, searchYear, pbnstRuseFcltId, cellNum,prfPbnFclts]);
|
||||
|
||||
const cellClick = useCallback(
|
||||
(index: number | undefined) => {
|
||||
@@ -194,10 +181,15 @@ export default function PrfmncPrfmncReg() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!prfmnc.isInit) {
|
||||
const year = new Date().getFullYear()
|
||||
prfmncHasuInit(1, '41', String(year));
|
||||
getPrfFmcRes()
|
||||
}
|
||||
}, [prfmnc.isInit, prfmncHasuInit]);
|
||||
}, [prfmnc.isInit, getPrfFmcRes]);
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
const year = new Date().getFullYear()
|
||||
prfmncHasuInit(1, '41',String(year) ,prfPbnFclts);
|
||||
},[prfPbnFclts])
|
||||
useEffect(() => {
|
||||
|
||||
|
||||
@@ -254,14 +246,8 @@ export default function PrfmncPrfmncReg() {
|
||||
<div className="flex flex-row space-x-2">
|
||||
<Button size={"sm"} onClick={() => {
|
||||
|
||||
if (searchTxt && searchTxt?.length > 0) {
|
||||
prfmncHasuNmSearch(1, '41', searchYear, searchTxt)
|
||||
setPageNation(1)
|
||||
} else {
|
||||
prfmncHasuInit(1, '41', searchYear)
|
||||
setPageNation(1)
|
||||
}
|
||||
|
||||
|
||||
setIsReset(true)
|
||||
}}>
|
||||
조회
|
||||
</Button>
|
||||
@@ -314,10 +300,15 @@ export default function PrfmncPrfmncReg() {
|
||||
setCellNum(index ?? 0);
|
||||
}}
|
||||
onPageChange={
|
||||
(page) => {
|
||||
prfmncHasuInit(page, '41', searchYear);
|
||||
setPageNation(page)
|
||||
(page:number) => {
|
||||
if (searchTxt && searchTxt?.length > 0) {
|
||||
prfmncHasuNmSearch(page, '41', searchYear, searchTxt,prfPbnFclts)
|
||||
} else {
|
||||
prfmncHasuInit(page, '41', searchYear,prfPbnFclts)
|
||||
}
|
||||
setIsReset(false);
|
||||
}}
|
||||
resetPageNo={isReset}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
@@ -350,9 +341,10 @@ export default function PrfmncPrfmncReg() {
|
||||
setIsExcelOPen({ ...isExcelOpen, isModal: open })
|
||||
}}
|
||||
setModalExcelData={async (excelData) => {
|
||||
await prfmnRegData(pageNation, '41',
|
||||
await prfmnRegData(1, '41',
|
||||
excelData,
|
||||
searchYear
|
||||
,prfPbnFclts
|
||||
);
|
||||
// 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다.
|
||||
}
|
||||
|
||||
@@ -6,8 +6,7 @@ import { initValInUsage, initValOutUsage, subTotalObj, totalObj, type FcPrfType,
|
||||
import { excelPrfmncSttnParsing } from "@/app/store/prfmncSttn/pbnstPrfmncSttn/excel";
|
||||
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
|
||||
import { InputTableBody } from "@/components/lib/func/TableData";
|
||||
import SearchInputText from "@/components/ui/searchInput/searchInput";
|
||||
import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components";
|
||||
import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Label, Table, TableBody, TableHeader } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
@@ -22,12 +21,12 @@ export default function PbnstPrfmncSttn() {
|
||||
pbnstPrfmncSttn,
|
||||
// pbnstPrfmncInit,
|
||||
pbnstPrfmncSearch,
|
||||
getFlctsSttn,
|
||||
prfmnc,
|
||||
pbnstSttn,
|
||||
pbnNmSearch
|
||||
} = useWrStore((state) => state);
|
||||
const { monthHeadList } = prfmnc
|
||||
const { pbnstPrfHeadList, prfmncRes, rawData, selectYearList } = pbnstPrfmncSttn;
|
||||
const { pbnstPrfHeadList, prfmncResCount, prfmncRes, rawData, selectYearList, fclts } = pbnstPrfmncSttn;
|
||||
// const [isChHead, setIsChHead] = useState(false);
|
||||
const [fromDate, setFromDate] = useState<string>(String(new Date().getFullYear()));
|
||||
const [toDate, setToDate] = useState<string>(String(new Date().getFullYear()));
|
||||
@@ -39,6 +38,9 @@ export default function PbnstPrfmncSttn() {
|
||||
const { t } = useTranslation('base');
|
||||
const searchYear = String(new Date().getFullYear());
|
||||
const [excelData, setExcelData] = useState<any[]>([]);
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
if (!excelData || excelData.length === 0) {
|
||||
toast.error(t('excelDownErrMsg'));
|
||||
@@ -98,11 +100,12 @@ export default function PbnstPrfmncSttn() {
|
||||
}));
|
||||
const inSubtotal = { ...structuredClone(subTotalObj), 구분: "장내용수" };
|
||||
const outSubtotal = { ...structuredClone(subTotalObj), 구분: "장외용수" };
|
||||
|
||||
const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year)
|
||||
const prfFilter = prfList?.filter((e) =>
|
||||
e.ym.slice(0, 4) === year
|
||||
)
|
||||
if (prfList && prfFilter.length > 0) {
|
||||
|
||||
prfList?.forEach((prfItem) => {
|
||||
prfFilter.forEach((prfItem) => {
|
||||
const month = Number(prfItem?.ym?.slice(4)); // "MM"
|
||||
const monthKey = `${month}월`;
|
||||
|
||||
@@ -147,8 +150,9 @@ export default function PbnstPrfmncSttn() {
|
||||
}
|
||||
const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
|
||||
setPrfData(tableData);
|
||||
setExcelData(excelPrfmncSttnParsing(prfData ?? []))
|
||||
setExcelData(excelPrfmncSttnParsing(tableData ?? []))
|
||||
} else {
|
||||
setExcelData(excelPrfmncSttnParsing([]))
|
||||
setPrfData([]);
|
||||
}
|
||||
}
|
||||
@@ -209,9 +213,10 @@ export default function PbnstPrfmncSttn() {
|
||||
rawData.forEach((item) => {
|
||||
// 실적 테이블 데이터
|
||||
if (chartId) {
|
||||
if (item.prfList?.[0]?.ym.slice(0, 4) === year && item.prfList?.[0]?.pbnstRuseFcltId === chartId) {
|
||||
if (item.prfList.find((e) => e.ym.slice(0, 4) === year) && item.prfList?.[0]?.pbnstRuseFcltId === chartId) {
|
||||
prfTableData(item.prfList, year);
|
||||
}
|
||||
|
||||
item.prfList.filter((e) => e.ym.slice(0, 4) === year && e.pbnstRuseFcltId === chartId).forEach((element) => {
|
||||
// 누적
|
||||
wshwtr += element.wshwtr;
|
||||
@@ -435,7 +440,6 @@ export default function PbnstPrfmncSttn() {
|
||||
}
|
||||
}, [inLineData]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (outLineData?.chartData1) {
|
||||
const newChartConfig = {
|
||||
@@ -489,22 +493,28 @@ export default function PbnstPrfmncSttn() {
|
||||
sigunText: ""
|
||||
}
|
||||
tableHeadMaker(Number(searchYear), Number(searchYear));
|
||||
pbnstPrfmncSearch(returnType, "", searchYear, searchYear)
|
||||
getFlctsSttn();
|
||||
pbnstPrfmncSearch(1, returnType, "", searchYear, searchYear, fclts)
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setbdstTable(prfmncRes.map((e, idx) => {
|
||||
pbnstPrfmncSearch(pageNation, ref.current, pbnRuseNm, fromDate, toDate, pbnstPrfmncSttn.fclts);
|
||||
isResetPage(false)
|
||||
}, [fclts, pageNation]);
|
||||
|
||||
useEffect(() => {
|
||||
const tableData = prfmncRes.map((e, idx) => {
|
||||
|
||||
return ({
|
||||
...e,
|
||||
number: String(idx + 1)
|
||||
})
|
||||
}))
|
||||
})
|
||||
setbdstTable(tableData)
|
||||
|
||||
if (prfmncRes?.[0]?.pbnstRuseFcltId) setChartId(prfmncRes[0].pbnstRuseFcltId)
|
||||
}, [prfmncRes]);
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnRuseNm.length > 1)
|
||||
pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear, []);
|
||||
@@ -515,7 +525,6 @@ export default function PbnstPrfmncSttn() {
|
||||
setChartId(prfmncRes[index].pbnstRuseFcltId)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -533,6 +542,7 @@ export default function PbnstPrfmncSttn() {
|
||||
rightClassName="ml-auto mr-6 flex items-center space-x-1"
|
||||
leftClassName="flex gap-5 w-9/12 m-4"
|
||||
leftSelectClassName="w-1/6"
|
||||
buttonOrder={["query", "init", "excel"]}
|
||||
leftChildren={<div className="col-span-5">
|
||||
<div className="flex flex-row">
|
||||
{/* <div className="flex flex-row items-center"> */}
|
||||
@@ -548,7 +558,7 @@ export default function PbnstPrfmncSttn() {
|
||||
selectArray={yearOptions}
|
||||
value={fromDate}
|
||||
onSelectValue={(val: string | number) => setFromDate(String(val))} />
|
||||
<span> ~</span>
|
||||
<span> ~</span>
|
||||
<SelectBox
|
||||
// className="w-full h-full text-2xl mx-4"
|
||||
className="flex-none w-32 h-full text-2xl mr-4"
|
||||
@@ -557,18 +567,16 @@ export default function PbnstPrfmncSttn() {
|
||||
selectArray={yearOptions}
|
||||
value={toDate}
|
||||
onSelectValue={(val: string | number) => setToDate(String(val))} />
|
||||
<Label className="w-28 mt-2 text-xl">
|
||||
{"시설명"}
|
||||
</Label>
|
||||
<SearchInput
|
||||
className={" h-full text-2xl"}
|
||||
label={""}
|
||||
textValue={pbnRuseNm || ""}
|
||||
setText={setPbnRuseNm}
|
||||
/>
|
||||
</div>
|
||||
<SearchInputText
|
||||
label={"하수처리시설"}
|
||||
initValue={pbnRuseNm ?? ""}
|
||||
setValue={(searchNm?: string) => {
|
||||
setPbnRuseNm(searchNm || "");
|
||||
}}
|
||||
setRtnData={/*function (rtnData: any[]): void {setbdstTable(rtnData);}*/
|
||||
() => { }
|
||||
}
|
||||
searchList={pbnstSttn.pbnstSearchData || []}
|
||||
></SearchInputText>
|
||||
{/* <SelectBox
|
||||
className="h-full text-2xl"
|
||||
label="재이용시설명"
|
||||
@@ -579,7 +587,7 @@ export default function PbnstPrfmncSttn() {
|
||||
</div>
|
||||
</div>}
|
||||
queryClick={function (returnType: ReturnType): void {
|
||||
pbnstPrfmncSearch(returnType, pbnRuseNm ?? "", fromDate, toDate);
|
||||
pbnstPrfmncSearch(1, returnType, pbnRuseNm ?? "", fromDate, toDate, fclts);
|
||||
if (fromDate && toDate) {
|
||||
const fromNum = Number(fromDate);
|
||||
const toNum = Number(toDate);
|
||||
@@ -594,9 +602,14 @@ export default function PbnstPrfmncSttn() {
|
||||
}
|
||||
}
|
||||
}
|
||||
isResetPage(true)
|
||||
}}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void { }}
|
||||
initClick={function (): void {
|
||||
setPbnRuseNm("");
|
||||
setFromDate(String(new Date().getFullYear()));
|
||||
setToDate(String(new Date().getFullYear()))
|
||||
}}
|
||||
btnClass={btnClass}
|
||||
ref={ref} isAdmin={false} />
|
||||
</div>
|
||||
@@ -608,13 +621,14 @@ export default function PbnstPrfmncSttn() {
|
||||
headName={undefined}
|
||||
tableData={bdstTable || []}
|
||||
headlist={pbnstPrfHeadList}
|
||||
pageSize={20}
|
||||
total={10000}
|
||||
pageSize={5}
|
||||
total={prfmncResCount}
|
||||
cellClick={(index: number | undefined, headId: string) => {
|
||||
cellClick(index ?? undefined, headId);
|
||||
}}
|
||||
onPageChange={() => { }}
|
||||
onPageChange={setPageNation}
|
||||
index={0}
|
||||
resetPageNo={resetPage}
|
||||
/>
|
||||
|
||||
<hr />
|
||||
@@ -631,54 +645,62 @@ export default function PbnstPrfmncSttn() {
|
||||
|
||||
<div className="flex">
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={chartConfig} chartData={chartData} chartTitle={"장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
{chartData.find((e) => e.val > 0) ?
|
||||
<MainChart chartConfig={chartConfig} chartData={chartData} chartTitle={"장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
:
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 장내·외 용수 총 실적(m³) 데이터가 없습니다.
|
||||
</div>}
|
||||
</div>
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={dnInChartConfig} chartData={dnInUsage} chartTitle={"장내용수 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
{dnInUsage.find((e) => e.val > 0) ?
|
||||
<MainChart chartConfig={dnInChartConfig} chartData={dnInUsage} chartTitle={"장내용수 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
:
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 장내용수 실적(m³) 데이터가 없습니다.
|
||||
</div>}
|
||||
</div>
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={dnOutChartConfig} chartData={dnOutUsage} chartTitle={"장외용수 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
{dnOutUsage.find((e) => e.val > 0) ?
|
||||
<MainChart chartConfig={dnOutChartConfig} chartData={dnOutUsage} chartTitle={"장외용수 실적(m³)"} chartForm={CHART_FORM.DN} />
|
||||
:
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 장외용수 실적(m³) 데이터가 없습니다.
|
||||
</div>}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<h1 className="">장내·외 월별 하수재이용실적 현황</h1>
|
||||
<div className="flex">
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DOUBLEBAR} showLegend={true} />
|
||||
{barData.length > 0 ?
|
||||
<MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DOUBLEBAR} showLegend={true} />
|
||||
:
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 월별 장내·외 용수 총 실적(m³) 데이터가 없습니다.
|
||||
</div>}
|
||||
</div>
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적(m³)"} chartForm={CHART_FORM.LINE} />
|
||||
{inLineData && Object.values(inLineData).every(arr => Array.isArray(arr) && arr.length === 0) ?
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 월별 장내 용수 실적(m³) 데이터가 없습니다.
|
||||
</div>
|
||||
:
|
||||
<MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적(m³)"} chartForm={CHART_FORM.LINE} />
|
||||
}
|
||||
</div>
|
||||
<div className="w-1/3">
|
||||
<MainChart chartConfig={lnOutChartConfig} chartData={outLineData} chartTitle={"월별 장외 용수 총 실적(m³)"} chartForm={CHART_FORM.LINE} />
|
||||
</div>
|
||||
{outLineData && Object.values(outLineData).every(arr => Array.isArray(arr) && arr.length === 0) ?
|
||||
<div className="flex items-center justify-center text-2xl">
|
||||
조회된 월별 장외 용수 총 실적(m³) 데이터가 없습니다.
|
||||
</div>
|
||||
:
|
||||
<MainChart chartConfig={lnOutChartConfig} chartData={outLineData} chartTitle={"월별 장외 용수 총 실적(m³)"} chartForm={CHART_FORM.LINE} />
|
||||
}</div>
|
||||
</div>
|
||||
<h1 className="">하수재이용실적 현황 (단위: m³)</h1>
|
||||
{/* <ListDiv className="col-span-8 pr-6 "> */}
|
||||
{/* <ScrollArea className="h-[60vh]"> */}
|
||||
{/* <div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">
|
||||
{"하수처리수재이용 실적(m³) 등록결과"}
|
||||
</h3>
|
||||
</div> */}
|
||||
|
||||
{/* <UiTable
|
||||
headName={undefined}
|
||||
tableData={prfData || []}
|
||||
headlist={monthHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
onPageChange={()=>{}}>
|
||||
</UiTable> */}
|
||||
|
||||
<ListDiv className="col-span-8 pr-6 ">
|
||||
<ScrollArea className={prfData && prfData.length > 0 ? "h-[60vh]" : ""}>
|
||||
{/* <div className="card-header">
|
||||
<h3 className="text-2xl font-medium text-label">
|
||||
{"하수재이용실적 현황 (단위: m³)"}
|
||||
</h3>
|
||||
</div> */}
|
||||
|
||||
<Table variant="secondary">
|
||||
<TableHeader className="font-bold">
|
||||
{headMakeprfmnc(monthHeadList, [])}
|
||||
@@ -690,10 +712,7 @@ export default function PbnstPrfmncSttn() {
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
{/* </ScrollArea> */}
|
||||
</ListDiv>
|
||||
|
||||
{/* </ListDiv> */}
|
||||
</div>
|
||||
</div>
|
||||
</ContentsDiv>
|
||||
|
||||
@@ -94,6 +94,12 @@ export const DmdCoReqSchema = z.object({
|
||||
demandMatching: DemandMatchingSchema.nullish(),
|
||||
demandCst: DemandCstSchema.nullish(),
|
||||
ruseUtztnFcltNm: z.string().nullish(),
|
||||
splyCndtList: z.array(
|
||||
z.object({
|
||||
ruseUtztnFcltNm: z.string(),
|
||||
ruseUtztnFcltCd: z.string(),
|
||||
}).nullish()
|
||||
).nullish(),
|
||||
totalConstCost: z.number().nullish(),
|
||||
});
|
||||
|
||||
@@ -147,3 +153,10 @@ export type rateFeeType = {
|
||||
stdCost: number;
|
||||
rt: number;
|
||||
};
|
||||
|
||||
|
||||
// 공급 후보자 타입 정의
|
||||
export type SupplyCandidate = {
|
||||
ruseUtztnFcltNm: string;
|
||||
ruseUtztnFcltCd: string;
|
||||
};
|
||||
@@ -52,8 +52,6 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
|
||||
`/reuseFc/request/${pageNo}/${pageCnt}/${con}`
|
||||
);
|
||||
|
||||
console.log('coSttnRes ', coSttnRes)
|
||||
|
||||
set((state: coSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
isInvalidNumber,
|
||||
parseRawValue,
|
||||
} from "@/components/lib/func/excelFunc";
|
||||
import toast from "react-hot-toast";
|
||||
export const useTypes = [
|
||||
"조경용수",
|
||||
"청소화장실용수",
|
||||
@@ -16,6 +17,18 @@ export const useTypes = [
|
||||
"기타",
|
||||
];
|
||||
|
||||
|
||||
export const chkMngType =[
|
||||
'위탁',
|
||||
'자체'
|
||||
]
|
||||
export const chkSpwtPositnType = [
|
||||
'유량계',
|
||||
'수위계',
|
||||
'펌프적산전력계',
|
||||
'기타'
|
||||
]
|
||||
|
||||
export type Buildingtype = {
|
||||
bdstInfoSn: number;
|
||||
ctpvCd: 1;
|
||||
@@ -143,43 +156,56 @@ export const excelToRainChkData = (excelData: any, year: string) => {
|
||||
})
|
||||
.filter((el: any) => el !== undefined);
|
||||
|
||||
console.log("rainChkgdData", rainChkgdData);
|
||||
if (rainChkgdData.length > 0) {
|
||||
rainChkgdData.forEach((rain: any) => {
|
||||
const defaultMessage = `[시설명: ${rain.bdstNm}, 점검일: ${rain.chckYmd}, 이용용도: ${rain.guideDetails[0]?.utztnUsgCd}] 항목에서 `;
|
||||
|
||||
if (rain.chckYmd && isInvalidDate(rain.chckYmd)) {
|
||||
issues.push(
|
||||
defaultMessage + `점검일: 날짜 형식 아님 (${rain.chckYmd})`
|
||||
defaultMessage + `점검일: 날짜 형식 아님 입력값 : (${rain.chckYmd})`
|
||||
);
|
||||
}
|
||||
if (rain.anlOperCst.length > 2 && isInvalidNumber(rain.anlOperCst)) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
` 연간운영비(원/년): 숫자 형식 아님 (${rain.anlOperCst})`
|
||||
` 연간운영비(원/년): 숫자 형식 아님 /입력값:${rain.anlOperCst}`
|
||||
);
|
||||
}
|
||||
if (rain.oilqMeasMthd.length > 1 && !chkMngType.includes(rain.oilqMeasMthd)) {
|
||||
issues.push(
|
||||
defaultMessage + `유량측정방법: 위탁 혹은 자체 만 허용) /입력값:${rain.oilqMeasMthd}`
|
||||
);
|
||||
}
|
||||
if (rain.spwtPositn.length > 1 && !chkSpwtPositnType.includes(rain.spwtPositn)) {
|
||||
issues.push(
|
||||
defaultMessage + `측정위치: 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rain.spwtPositn}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
rain.rainyDetails?.forEach((key) => {
|
||||
if (key.ph?.length > 1 && isInvalidNumber(key.ph)) {
|
||||
issues.push(defaultMessage + `PH: 숫자 형식 아님 (${key.ph})`);
|
||||
issues.push(defaultMessage + `PH: 숫자 형식 아님 /입력값:${key.ph}`);
|
||||
}
|
||||
if (key.trbt?.length > 1 && isInvalidNumber(key.trbt)) {
|
||||
issues.push(defaultMessage + `탁도: 숫자 형식 아님 (${key.trbt})`);
|
||||
issues.push(defaultMessage + `탁도: 숫자 형식 아님 /입력값:${key.trbt}`);
|
||||
}
|
||||
if (key.grssClfg?.length > 1 && isInvalidNumber(key.grssClfg)) {
|
||||
issues.push(
|
||||
defaultMessage + `총대장균군수: 숫자 형식 아님 (${key.grssClfg})`
|
||||
defaultMessage + `총대장균군수: 숫자 형식 아님 /입력값:${key.grssClfg}`
|
||||
);
|
||||
}
|
||||
if (key.levyAmt?.length > 1 && isInvalidNumber(key.levyAmt)) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`과태료부과금액(천원): 숫자 형식 아님 (${key.levyAmt})`
|
||||
`과태료부과금액(천원): 숫자 형식 아님 /입력값:${key.levyAmt}`
|
||||
);
|
||||
}
|
||||
if (key.vltnDt?.length > 2 && isInvalidDate(key.vltnDt)) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`과태료 부과일(위반일): 날짜 형식 아님 (${key.vltnDt})`
|
||||
`과태료 부과일(위반일): 날짜 형식 아님 /입력값:${key.vltnDt}`
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -188,17 +214,19 @@ export const excelToRainChkData = (excelData: any, year: string) => {
|
||||
if (isInvalidNumber(guide.splyUswtrUtztnQnt)) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`대체_${mm}: 숫자 형식 아님 (${guide.splyUswtrUtztnQnt})`
|
||||
`대체_${mm}: 숫자 형식 아님 /입력값:${guide.splyUswtrUtztnQnt}`
|
||||
);
|
||||
}
|
||||
if (isInvalidNumber(guide.ruseFcltUtztnQnt)) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`빗물_${mm}: 숫자 형식 아님 (${guide.ruseFcltUtztnQnt})`
|
||||
`빗물_${mm}: 숫자 형식 아님 /입력값:${guide.ruseFcltUtztnQnt}`
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
}else{
|
||||
toast.error("데이터가 없습니다. 점검 데이터를 확인해주세요.");
|
||||
}
|
||||
|
||||
if (issues.length > 0) {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import type { SelectDataType } from "@common/business_components/ui";
|
||||
import { useTypes, type Buildingtype } from "../rainChkgdn/excel";
|
||||
import {
|
||||
chkMngType,
|
||||
chkSpwtPositnType,
|
||||
useTypes,
|
||||
type Buildingtype,
|
||||
} from "../rainChkgdn/excel";
|
||||
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { rswtChkZodType } from ".";
|
||||
import {
|
||||
@@ -171,14 +176,14 @@ export const excelToRswtGuideData = (
|
||||
.filter((el: any) => el !== undefined);
|
||||
|
||||
if (rswtChkgdData.length > 0) {
|
||||
rswtExcelDataCheck(rswtChkgdData,issues)
|
||||
rswtExcelDataCheck(rswtChkgdData, issues);
|
||||
}
|
||||
|
||||
if (issues.length > 0) {
|
||||
return { data: [], issues };
|
||||
}
|
||||
|
||||
return { data:rswtChkgdData, issues: [] };
|
||||
return { data: rswtChkgdData, issues: [] };
|
||||
};
|
||||
|
||||
export const excelToRswtPolution = (excelData: any, issues: string[]) => {
|
||||
@@ -248,25 +253,25 @@ export const excelToRswtPolution = (excelData: any, issues: string[]) => {
|
||||
})
|
||||
.filter((el: any) => el !== undefined);
|
||||
if (rswtChkgdData.length > 0) {
|
||||
rswtExcelDataCheck(rswtChkgdData,issues)
|
||||
rswtExcelDataCheck(rswtChkgdData, issues);
|
||||
}
|
||||
|
||||
if (issues.length > 0) {
|
||||
return { data: [], issues };
|
||||
}
|
||||
|
||||
return { data:rswtChkgdData, issues: [] };
|
||||
return { data: rswtChkgdData, issues: [] };
|
||||
};
|
||||
|
||||
|
||||
const rswtExcelDataCheck=(rswtChkgdData:rswtChkZodType[], issues:string[]) =>{
|
||||
const rswtExcelDataCheck = (
|
||||
rswtChkgdData: rswtChkZodType[],
|
||||
issues: string[]
|
||||
) => {
|
||||
rswtChkgdData.forEach((rswt: any) => {
|
||||
const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${rswt.utztnUsgCd}] 항목에서 `;
|
||||
|
||||
if (rswt.chckYmd && isInvalidDate(rswt.chckYmd)) {
|
||||
issues.push(
|
||||
defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`
|
||||
);
|
||||
issues.push(defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`);
|
||||
}
|
||||
if (rswt.anlOperCst.length > 2 && isInvalidNumber(rswt.anlOperCst)) {
|
||||
issues.push(
|
||||
@@ -279,6 +284,25 @@ const rswtExcelDataCheck=(rswtChkgdData:rswtChkZodType[], issues:string[]) =>{
|
||||
defaultMessage + ` 처리용량(m³): 숫자 형식 아님 (${rswt.prcsCpct})`
|
||||
);
|
||||
}
|
||||
if (
|
||||
rswt.oilqMeasMthd.length > 1 &&
|
||||
!chkMngType.includes(rswt.oilqMeasMthd)
|
||||
) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`유량측정방법: 위탁 혹은 자체 만 허용) /입력값:${rswt.oilqMeasMthd}`
|
||||
);
|
||||
}
|
||||
if (
|
||||
rswt.spwtPositn.length > 1 &&
|
||||
!chkSpwtPositnType.includes(rswt.spwtPositn)
|
||||
) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`측정위치: 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rswt.spwtPositn}`
|
||||
);
|
||||
}
|
||||
|
||||
if (rswt?.rswtrPollutions && rswt?.rswtrPollutions.length > 0) {
|
||||
rswt.rswtrPollutions.forEach((pol) => {
|
||||
if (isInvalidNumber(pol.grssClfgUswtr)) {
|
||||
@@ -301,8 +325,7 @@ const rswtExcelDataCheck=(rswtChkgdData:rswtChkZodType[], issues:string[]) =>{
|
||||
}
|
||||
if (isInvalidNumber(pol.bod)) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`${pol.node}분기_BOD: 숫자 형식 아님 (${pol.bod})`
|
||||
defaultMessage + `${pol.node}분기_BOD: 숫자 형식 아님 (${pol.bod})`
|
||||
);
|
||||
}
|
||||
if (isInvalidNumber(pol.smll)) {
|
||||
@@ -319,8 +342,7 @@ const rswtExcelDataCheck=(rswtChkgdData:rswtChkZodType[], issues:string[]) =>{
|
||||
}
|
||||
if (isInvalidNumber(pol.tph)) {
|
||||
issues.push(
|
||||
defaultMessage +
|
||||
`${pol.node}분기_T-P: 숫자 형식 아님 (${pol.tph})`
|
||||
defaultMessage + `${pol.node}분기_T-P: 숫자 형식 아님 (${pol.tph})`
|
||||
);
|
||||
}
|
||||
if (isInvalidNumber(pol.tn)) {
|
||||
@@ -358,7 +380,5 @@ const rswtExcelDataCheck=(rswtChkgdData:rswtChkZodType[], issues:string[]) =>{
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -7,16 +7,17 @@ import toast from "react-hot-toast";
|
||||
|
||||
const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport;
|
||||
const monthHeadList = monthHeadListExport;
|
||||
|
||||
export const prfRegPageSize = 10;
|
||||
export type pbnstPrfmncState = {
|
||||
prfmnc: {
|
||||
isInit: boolean;
|
||||
pbnstPrfmncHeadList: TableUpperProps[];
|
||||
monthHeadList: TableUpperProps[];
|
||||
prfmncRes: FcPrfType[];
|
||||
prfmncResCount:number;
|
||||
prfmncResCount: number;
|
||||
excelList: number[];
|
||||
pageKey:number
|
||||
pageKey: number;
|
||||
prfPbnFclts: string[];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -26,68 +27,126 @@ export const pbnstPrfmncStateExport: pbnstPrfmncState = {
|
||||
pbnstPrfmncHeadList: pbnstPrfmncHeadList,
|
||||
monthHeadList: monthHeadList,
|
||||
prfmncRes: [],
|
||||
prfmncResCount:1,
|
||||
prfPbnFclts: [],
|
||||
prfmncResCount: 1,
|
||||
excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
pageKey:1
|
||||
pageKey: 1,
|
||||
},
|
||||
};
|
||||
|
||||
export type pbnstPrfmncType = pbnstPrfmncState & pbnstPrfmncActions;
|
||||
|
||||
type pbnstPrfmncActions = {
|
||||
prfmncHasuInit: (page: number, sggOrCity: string ,year:string) => void;
|
||||
prfmncHasuNmSearch: (page: number, sggOrCity: string , txt:string ,year:string) => void;
|
||||
prfmnRegData: (page:number,sggOrCity:string, data: PrfType,year:string) => void;
|
||||
prfmncHasuInit: (
|
||||
page: number,
|
||||
sggOrCity: string,
|
||||
year: string,
|
||||
prfPbnFclts: string[]
|
||||
) => void;
|
||||
prfmncHasuNmSearch: (
|
||||
page: number,
|
||||
sggOrCity: string,
|
||||
year: string,
|
||||
searchTxt: string,
|
||||
prfPbnFclts: string[]
|
||||
) => void;
|
||||
prfmnRegData: (
|
||||
page: number,
|
||||
sggOrCity: string,
|
||||
data: PrfType,
|
||||
year: string,
|
||||
prfPbnFclts: string[]
|
||||
) => void;
|
||||
getPrfFmcRes: () => void;
|
||||
};
|
||||
|
||||
const checkWrRegList = async (year:string) => {
|
||||
const url =`/reuseFc/pubDetailList`
|
||||
if(year&& year.length>0){
|
||||
// url+=`/${year}`
|
||||
const hasuListFetch = async (
|
||||
page: number,
|
||||
sggOrCity: string,
|
||||
year: string,
|
||||
prfPbnFclts: string[],
|
||||
searchTxt?: string
|
||||
) => {
|
||||
let filteredFclt = prfPbnFclts;
|
||||
if (sggOrCity !== "0") {
|
||||
filteredFclt = prfPbnFclts?.filter((fclt: string) => {
|
||||
return sggOrCity.length == 2
|
||||
? fclt.slice(0, 2) === sggOrCity
|
||||
: fclt.slice(0, 5) === sggOrCity;
|
||||
});
|
||||
}
|
||||
const wrRegList = await getFetch("wr", url);
|
||||
return wrRegList;
|
||||
};
|
||||
const hasuListFetch = async (page: number, sggOrCity: string , year:string,searchNm?:string ) => {
|
||||
const checkWrRegListRes = await checkWrRegList(year);
|
||||
const rainRes = await postFectch(
|
||||
`/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
|
||||
checkWrRegListRes?.fcltCds,
|
||||
fetchType.COMMON
|
||||
|
||||
let url = `/prcsFclt/ruseInfo/1/${filteredFclt.length + 1}/A/${sggOrCity}/0/1/SW`;
|
||||
if (searchTxt && searchTxt?.length > 0) {
|
||||
url += `/${searchTxt}`;
|
||||
}
|
||||
const rainRes = await postFectch(url, filteredFclt, fetchType.COMMON);
|
||||
|
||||
const checkRuseFcltList =
|
||||
searchTxt && searchTxt?.length > 0
|
||||
? rainRes.data.map((item) => item.bscFctCd)
|
||||
: filteredFclt;
|
||||
|
||||
const pubRuseList = await postFectch(
|
||||
`/reuseFc/pubDetailList/${year}/${sggOrCity}/${page}/${prfRegPageSize}`,
|
||||
checkRuseFcltList,
|
||||
fetchType.WR
|
||||
);
|
||||
let findData = rainRes.data.map((item: pubHasuType) => {
|
||||
const data = checkWrRegListRes?.fcPrfList.find(
|
||||
(fclt: FcPrfType) =>
|
||||
fclt.pbnstRuseFcltId.substring(0, 11) === item?.bscFctCd
|
||||
);
|
||||
if(data !==undefined){
|
||||
return( {
|
||||
const rusePrfList = pubRuseList.data
|
||||
.map((item: FcPrfType) => {
|
||||
const findData = rainRes.data?.find(
|
||||
(fclt: pubHasuType) =>
|
||||
item.pbnstRuseFcltId.substring(0, 11) === fclt?.bscFctCd
|
||||
);
|
||||
if (findData !== undefined) {
|
||||
return {
|
||||
sido: findData.sido,
|
||||
gugun: findData.gugun,
|
||||
bscFctNm: findData.bscFctNm,
|
||||
bscFctCd: findData.bscFctCd,
|
||||
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
|
||||
pbnstRuseFcltId: item.pbnstRuseFcltId,
|
||||
prfList: item.prfList,
|
||||
};
|
||||
}
|
||||
})
|
||||
.filter(Boolean); // undefined 값을 제거합니다.
|
||||
|
||||
sido: item.sido,
|
||||
gugun: item.gugun,
|
||||
bscFctNm: item.bscFctNm,
|
||||
bscFctCd: item.bscFctCd,
|
||||
ruseUtztnFcltNm: data.ruseUtztnFcltNm,
|
||||
pbnstRuseFcltId: data.pbnstRuseFcltId,
|
||||
prfList: data.prfList,
|
||||
});
|
||||
}
|
||||
}).filter(Boolean); // undefined 값을 제거합니다.
|
||||
|
||||
if(searchNm){
|
||||
|
||||
findData= findData.filter((ruse:any) => ruse.ruseUtztnFcltNm.includes(searchNm))
|
||||
}
|
||||
|
||||
return {data:findData, count:findData.length};
|
||||
return { data: rusePrfList, count: pubRuseList.count };
|
||||
};
|
||||
export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
prfmncHasuInit: async (page: number, sggOrCity: string,year:string) => {
|
||||
getPrfFmcRes: async () => {
|
||||
try {
|
||||
const prfmncRes = await hasuListFetch(page, sggOrCity, year);
|
||||
const pbnPrfRes = await getFetch(fetchType.WR, "/reuseFc/pubFc");
|
||||
console.log("pbnPrfRes ", pbnPrfRes);
|
||||
set((state: pbnstPrfmncState) => ({
|
||||
...state,
|
||||
prfmnc: {
|
||||
...state.prfmnc,
|
||||
prfPbnFclts: pbnPrfRes,
|
||||
},
|
||||
}));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
prfmncHasuInit: async (
|
||||
page: number,
|
||||
sggOrCity: string,
|
||||
year: string,
|
||||
prfPbnFclts: string[]
|
||||
) => {
|
||||
try {
|
||||
console.log("prfPbnFclts ", prfPbnFclts);
|
||||
const prfmncRes = await hasuListFetch(
|
||||
page,
|
||||
sggOrCity,
|
||||
year,
|
||||
prfPbnFclts
|
||||
);
|
||||
return set((state: pbnstPrfmncState) => ({
|
||||
...state,
|
||||
prfmnc: {
|
||||
@@ -101,9 +160,21 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
console.log(errorHasu);
|
||||
}
|
||||
},
|
||||
prfmncHasuNmSearch: async (page: number, sggOrCity: string,fcltNm:string ,year:string)=> {
|
||||
prfmncHasuNmSearch: async (
|
||||
page: number,
|
||||
sggOrCity: string,
|
||||
year: string,
|
||||
searchTxt: string,
|
||||
prfPbnFclts: string[]
|
||||
) => {
|
||||
try {
|
||||
const prfmncRes = await hasuListFetch(page, sggOrCity,fcltNm ,year);
|
||||
const prfmncRes = await hasuListFetch(
|
||||
page,
|
||||
sggOrCity,
|
||||
year,
|
||||
prfPbnFclts,
|
||||
searchTxt
|
||||
);
|
||||
return set((state: pbnstPrfmncState) => ({
|
||||
...state,
|
||||
prfmnc: {
|
||||
@@ -117,7 +188,13 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
console.log(errorHasu);
|
||||
}
|
||||
},
|
||||
prfmnRegData: async (page:number,sggOrCity:string,data: PrfType,year:string) => {
|
||||
prfmnRegData: async (
|
||||
page: number,
|
||||
sggOrCity: string,
|
||||
data: PrfType,
|
||||
year: string,
|
||||
prfPbnFclts: string[]
|
||||
) => {
|
||||
try {
|
||||
const ressponse = await postFectch(
|
||||
"/reuseFc/pubFcPrf",
|
||||
@@ -125,11 +202,14 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
fetchType.WR
|
||||
);
|
||||
|
||||
|
||||
if (ressponse.status === 200) {
|
||||
toast.success("하수재이용 시설 실적 등록이 완료되었습니다.");
|
||||
const prfmncRes = await hasuListFetch(page, sggOrCity,year) ;
|
||||
|
||||
const prfmncRes = await hasuListFetch(
|
||||
page,
|
||||
sggOrCity,
|
||||
year,
|
||||
prfPbnFclts
|
||||
);
|
||||
|
||||
return set((state: pbnstPrfmncState) => ({
|
||||
...state,
|
||||
@@ -138,10 +218,9 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
|
||||
prfmncRes: prfmncRes.data,
|
||||
prfmncResCount: prfmncRes.count,
|
||||
isInit: false,
|
||||
pageKey: state.prfmnc.pageKey + 1
|
||||
pageKey: state.prfmnc.pageKey + 1,
|
||||
},
|
||||
}));
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
||||
@@ -4,11 +4,13 @@ import { monthSttnHeadListExport, pbnstPrfmncSttnHeadListExport, pbnstYearHeadLi
|
||||
import type { FcPrfType, PrfType } from "../../prfmncReg/pbnstPrfmncReg/type";
|
||||
import type { pubHasuType, selectLabel } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import type { ReturnType } from "@common/business_components";
|
||||
import type { WaterReuseFacility } from "../../ruseFcltMng/fcltSttn/pbnstSttn/type";
|
||||
|
||||
type pbnstPrfmncSttnActions = {
|
||||
tableHeadMaker: (startYear: number, endYear: number) => void;
|
||||
pbnstPrfmncInit: (page: string, sggOrCity: string) => void;
|
||||
pbnstPrfmncSearch: (returnType: ReturnType, swtrmtFcltNm: string, fromDate: string, toDate: string) => void;
|
||||
// pbnstPrfmncInit: (page: string, sggOrCity: string) => void;
|
||||
pbnstPrfmncSearch: (page: number, returnType: ReturnType, fcltNm: string, fromDate: string, toDate: string, fclts: string[]) => void;
|
||||
getFlctsSttn: () => void;
|
||||
}
|
||||
|
||||
const pbnstPrfmncRes: PrfType[] = [];
|
||||
@@ -22,7 +24,9 @@ export type pbnstPrfmncSttnState = {
|
||||
isInit: boolean;
|
||||
rawData: any[];
|
||||
selectYearList: selectLabel[]
|
||||
monthSttnHeadList:TableUpperProps[];
|
||||
monthSttnHeadList: TableUpperProps[];
|
||||
fclts: string[];
|
||||
prfmncResCount: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,41 +40,104 @@ export const pbnstPrfmncSttnExport: pbnstPrfmncSttnState = {
|
||||
isInit: false,
|
||||
rawData: [],
|
||||
selectYearList: [],
|
||||
monthSttnHeadList:monthSttnHeadListExport
|
||||
monthSttnHeadList: monthSttnHeadListExport,
|
||||
fclts: [],
|
||||
prfmncResCount: 1,
|
||||
}
|
||||
}
|
||||
|
||||
const checkWrRegList = async () => {
|
||||
const wrRegList = await getFetch("wr", `/reuseFc/pubDetailList`);
|
||||
return wrRegList;
|
||||
};
|
||||
const hasuListFetch = async (page: string, sggOrCity: string) => {
|
||||
const checkWrRegListRes = await checkWrRegList();
|
||||
const rainRes = await postFectch(
|
||||
`/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
|
||||
checkWrRegListRes?.fcltCds,
|
||||
fetchType.COMMON
|
||||
const hasuListFetch = async (
|
||||
page: number,
|
||||
returnType: ReturnType,
|
||||
searchNm: string | undefined,
|
||||
fromDate: string,
|
||||
toDate: string,
|
||||
flcts: string[]
|
||||
) => {
|
||||
let url = '';
|
||||
let filteredFclt = flcts;
|
||||
const filterData = returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue
|
||||
|
||||
if (filterData !== '0')
|
||||
filteredFclt = flcts.filter((fclt: string) => {
|
||||
return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData
|
||||
})
|
||||
if (returnType.partValue === "A") {
|
||||
url += `${returnType.partValue}/${
|
||||
// returnType.sidoValue ? returnType.sidoValue : returnType.sigunValue
|
||||
returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue
|
||||
}/0/1/SW`
|
||||
|
||||
if (filterData !== '0')
|
||||
filteredFclt = flcts.filter((fclt: string) => {
|
||||
return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData
|
||||
})
|
||||
} else if (returnType.partValue === "R") {
|
||||
url += `${returnType.partValue}/${returnType.regionValue
|
||||
? returnType.regionValue
|
||||
: returnType.unitWaterShedValue
|
||||
? returnType.unitWaterShedValue
|
||||
: returnType.middleRegionValue
|
||||
}/0/1/SW`
|
||||
} else if (returnType.partValue === 'G') {
|
||||
url += `${returnType.envPartValue}/${returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue}/0/1/SW`
|
||||
if (filterData !== '0')
|
||||
filteredFclt = flcts.filter((fclt: string) => {
|
||||
return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData
|
||||
})
|
||||
} else {
|
||||
url += `A/0/0/1/SW`
|
||||
}
|
||||
if (searchNm && searchNm?.length > 0) {
|
||||
url += "/" + searchNm
|
||||
}
|
||||
const pbnList = await postFectch(`/prcsFclt/ruseInfo/1/${filteredFclt.length}/` + url, filteredFclt, fetchType.COMMON);
|
||||
const checkRuseFcltList = searchNm && searchNm?.length > 0 ? pbnList.data.map((item) => item.bscFctCd) : filteredFclt
|
||||
const getRuseList = await postFectch(
|
||||
`/reuseFc/pubDetailPrfList/${fromDate}/${toDate}/${filterData}/${page}/5`,
|
||||
checkRuseFcltList,
|
||||
fetchType.WR
|
||||
);
|
||||
const data = checkWrRegListRes.fcPrfList.map((item: FcPrfType) => {
|
||||
const findData = rainRes.data.find(
|
||||
(fclt: pubHasuType) =>
|
||||
fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11)
|
||||
);
|
||||
return {
|
||||
sido: findData?.sido,
|
||||
gugun: findData?.gugun,
|
||||
bscFctNm: findData?.bscFctNm,
|
||||
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
|
||||
pbnstRuseFcltId: item.pbnstRuseFcltId,
|
||||
};
|
||||
});
|
||||
return data;
|
||||
const checkWrRegListRes = getRuseList.data;
|
||||
|
||||
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
||||
(item: FcPrfType) => {
|
||||
if (!item.prfList || item.prfList.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const findData = pbnList.data.find(
|
||||
(fclt: pubHasuType) =>
|
||||
fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11)
|
||||
);
|
||||
if (findData) {
|
||||
return {
|
||||
sido: findData?.sido || '-',
|
||||
gugun: findData?.gugun || '-',
|
||||
bscFctNm: findData?.bscFctNm || '-',
|
||||
ruseUtztnFcltNm: item?.ruseUtztnFcltNm || '-',
|
||||
pbnstRuseFcltId: item?.pbnstRuseFcltId || '-',
|
||||
bscFctCd: findData?.bscFctCd || '-',
|
||||
prfList: item.prfList,
|
||||
}
|
||||
}
|
||||
}
|
||||
).filter(Boolean);
|
||||
return {data: data, count: getRuseList.count};
|
||||
}
|
||||
|
||||
export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
getFlctsSttn: async () => {
|
||||
const fclts = await getFetch(fetchType.WR, '/reuseFc/pubFc')
|
||||
return set((state: pbnstPrfmncSttnState) => ({
|
||||
pbnstPrfmncSttn: {
|
||||
...state.pbnstPrfmncSttn,
|
||||
fclts: fclts
|
||||
},
|
||||
}));
|
||||
},
|
||||
tableHeadMaker: (startYear: number, endYear: number) => {
|
||||
let yearHeader: TableUpperProps[] = [...pbnstPrfmncSttnHeadListExport];
|
||||
const selectList = [] as unknown as selectLabel[]
|
||||
@@ -79,7 +146,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
if (yearHead) {
|
||||
yearHead.forEach((item: { id?: string; }) => {
|
||||
if (item.id) {
|
||||
if(item.id === "year") {item.id = ""; return;}
|
||||
if (item.id === "year") { item.id = ""; return; }
|
||||
item.id = i + item.id;
|
||||
}
|
||||
})
|
||||
@@ -100,117 +167,132 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
};
|
||||
});
|
||||
},
|
||||
pbnstPrfmncInit: async (page: string, sggOrCity: string) => {
|
||||
// pbnstPrfmncInit: async (page: string, sggOrCity: string) => {
|
||||
// try {
|
||||
// const prfmncRes = await hasuListFetch(page, sggOrCity);
|
||||
// return set((state: pbnstPrfmncSttnState) => ({
|
||||
// ...state,
|
||||
// pbnstPrfmncSttn: {
|
||||
// ...state.pbnstPrfmncSttn,
|
||||
// prfmncRes: prfmncRes,
|
||||
// isInit: true,
|
||||
// },
|
||||
// }));
|
||||
// } catch (e) {
|
||||
// console.log(e)
|
||||
// }
|
||||
// },
|
||||
pbnstPrfmncSearch: async (page: number, returnType: ReturnType, fcltNm: string, fromDate: string, toDate: string, fclts: string[]) => {
|
||||
try {
|
||||
const prfmncRes = await hasuListFetch(page, sggOrCity);
|
||||
const prfmncRes = await hasuListFetch(
|
||||
page,
|
||||
returnType,
|
||||
fcltNm,
|
||||
fromDate,
|
||||
toDate,
|
||||
fclts);
|
||||
|
||||
let inUsageSum = 0;
|
||||
let outUsageSum = 0;
|
||||
let year = "";
|
||||
const yearsData = [] as any
|
||||
|
||||
prfmncRes.data.forEach((item: any) => {
|
||||
if (!item.prfList || item.prfList.length === 0) {
|
||||
const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출.
|
||||
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" };
|
||||
yearVal[`${year}inUsage`] = 0;
|
||||
yearVal[`${year}outUsage`] = 0;
|
||||
yearVal[`${year}total`] = 0;
|
||||
yearsData.push(yearVal);
|
||||
}
|
||||
item.prfList?.forEach((acc: any) => {
|
||||
year = acc.ym?.substring(0, 4) ?? "";
|
||||
inUsageSum =
|
||||
(acc.wshwtr ?? 0) + //조경용수
|
||||
(acc.coolUswtr ?? 0) + //냉각수
|
||||
(acc.cleanUswtr ?? 0) + //청소수
|
||||
(acc.drwtUswtr ?? 0) + //식수대
|
||||
(acc.dltnUswtr ?? 0) + //희석용수
|
||||
(acc.ithlRswtr ?? 0) + //중수도
|
||||
(acc.ithlEtcUswtr ?? 0) //기타
|
||||
outUsageSum =
|
||||
(acc.cleanToilUswtr ?? 0) + //청소화장실용수
|
||||
(acc.resn ?? 0) + //세척살수용도
|
||||
(acc.lndwtr ?? 0) + //조경용수
|
||||
(acc.hydUswtr ?? 0) + //친수용수
|
||||
(acc.ugwtChr ?? 0) + //지하수충전
|
||||
(acc.farmUswtr ?? 0) + //농업용수
|
||||
(acc.rvrKeepUswtr ?? 0) + //하천등유지용수
|
||||
(acc.indstUswtr ?? 0); //공업용수
|
||||
const yearData = yearsData.find(
|
||||
(yearItem) =>
|
||||
yearItem.year === year &&
|
||||
yearItem.pbnstRuseFcltId == acc.pbnstRuseFcltId
|
||||
);
|
||||
|
||||
if (yearData) {
|
||||
yearData[`${year}inUsage`] += inUsageSum;
|
||||
yearData[`${year}outUsage`] += outUsageSum;
|
||||
yearData[`${year}total`] += (inUsageSum + outUsageSum);
|
||||
} else {
|
||||
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: acc.pbnstRuseFcltId, ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" };
|
||||
yearVal[`${year}inUsage`] = inUsageSum;
|
||||
yearVal[`${year}outUsage`] = outUsageSum;
|
||||
yearVal[`${year}total`] = inUsageSum + outUsageSum;
|
||||
yearsData.push(yearVal);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 연도 필터링
|
||||
const from = Number(fromDate);
|
||||
const to = Number(toDate);
|
||||
|
||||
// 연도별 실적을 시설별로 병합
|
||||
const mergedMap: { [key: string]: any } = {};
|
||||
|
||||
yearsData.forEach((acc) => {
|
||||
const facilityId = acc.pbnstRuseFcltId;
|
||||
const year = acc.year;
|
||||
|
||||
// 연도 필터 범위 안에만 포함
|
||||
if (!year || Number(year) < from || Number(year) > to) return;
|
||||
|
||||
if (!mergedMap[facilityId]) {
|
||||
mergedMap[facilityId] = {
|
||||
pbnstRuseFcltId: facilityId,
|
||||
ruseUtztnFcltNm: acc.ruseUtztnFcltNm,
|
||||
};
|
||||
}
|
||||
|
||||
// 해당 연도 데이터 추가
|
||||
mergedMap[facilityId][`${year}inUsage`] = acc[`${year}inUsage`] ?? 0;
|
||||
mergedMap[facilityId][`${year}outUsage`] = acc[`${year}outUsage`] ?? 0;
|
||||
mergedMap[facilityId][`${year}total`] = acc[`${year}total`] ?? 0;
|
||||
});
|
||||
|
||||
// prfmncRes 정보 merge
|
||||
const resData = Object.values(mergedMap).map((item: any) => {
|
||||
const match = prfmncRes.data.find((res) => res.pbnstRuseFcltId === item.pbnstRuseFcltId);
|
||||
return match ? { ...item, ...match } : item;
|
||||
});
|
||||
|
||||
return set((state: pbnstPrfmncSttnState) => ({
|
||||
...state,
|
||||
pbnstPrfmncSttn: {
|
||||
...state.pbnstPrfmncSttn,
|
||||
prfmncRes: prfmncRes,
|
||||
isInit: true,
|
||||
// prfmncRes: prfmncRes,
|
||||
prfmncResCount: prfmncRes.count,
|
||||
isInit: false,
|
||||
prfmncRes: resData,
|
||||
rawData: prfmncRes.data
|
||||
},
|
||||
}));
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} catch (errorHasu) {
|
||||
console.log(errorHasu);
|
||||
}
|
||||
},
|
||||
pbnstPrfmncSearch: async (returnType: ReturnType, swtrmtFcltNm: string, fromDate: string, toDate: string) => {
|
||||
let searchUrl = "";
|
||||
if (returnType.sigunValue !== "0") {
|
||||
if (swtrmtFcltNm !== "") {
|
||||
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sigunValue}/0/1/SW${'/' + swtrmtFcltNm}`;
|
||||
} else {
|
||||
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sigunValue}/0/1/SW`;
|
||||
}
|
||||
} else {
|
||||
if (swtrmtFcltNm !== "") {
|
||||
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sidoValue}/0/1/SW${'/' + swtrmtFcltNm}`;
|
||||
} else {
|
||||
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sidoValue}/0/1/SW`;
|
||||
}
|
||||
}
|
||||
|
||||
const pbnstRes = await getFetch(
|
||||
fetchType.COMMON,
|
||||
searchUrl
|
||||
);
|
||||
|
||||
const bscFctCdList = pbnstRes.map((item: any) => {
|
||||
return item.bscFctCd;
|
||||
})
|
||||
const res = await postFectch(
|
||||
`/reuseFc/pubDetailList/${fromDate}/${toDate}`,
|
||||
bscFctCdList,
|
||||
`wr`,
|
||||
)
|
||||
let inUsageSum = 0;
|
||||
let outUsageSum = 0;
|
||||
let year = "";
|
||||
const yearsData = [] as any
|
||||
|
||||
res.data.forEach((item : any) => {
|
||||
if (item.prfList.length === 0) {
|
||||
const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출.
|
||||
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm : item.ruseUtztnFcltNm ?? "" };
|
||||
yearVal[`${year}inUsage`] = 0;
|
||||
yearVal[`${year}outUsage`] = 0;
|
||||
yearVal[`${year}total`] = 0;
|
||||
yearsData.push(yearVal);
|
||||
}
|
||||
item.prfList.forEach((acc) => {
|
||||
year = acc.ym?.substring(0, 4) ?? "";
|
||||
inUsageSum =
|
||||
(acc.wshwtr ?? 0) + //조경용수
|
||||
(acc.coolUswtr ?? 0) + //냉각수
|
||||
(acc.cleanUswtr ?? 0) + //청소수
|
||||
(acc.drwtUswtr ?? 0) + //식수대
|
||||
(acc.dltnUswtr ?? 0) + //희석용수
|
||||
(acc.ithlRswtr ?? 0) + //중수도
|
||||
(acc.ithlEtcUswtr ?? 0) //기타
|
||||
outUsageSum =
|
||||
(acc.cleanToilUswtr ?? 0) + //청소화장실용수
|
||||
(acc.resn ?? 0)+ //세척살수용도
|
||||
(acc.lndwtr ?? 0) + //조경용수
|
||||
(acc.hydUswtr ?? 0) + //친수용수
|
||||
(acc.ugwtChr ?? 0) + //지하수충전
|
||||
(acc.farmUswtr ?? 0) + //농업용수
|
||||
(acc.rvrKeepUswtr ?? 0) + //하천등유지용수
|
||||
(acc.indstUswtr ?? 0); //공업용수
|
||||
const yearData = yearsData.find(
|
||||
(yearItem) =>
|
||||
yearItem.year === year &&
|
||||
yearItem.pbnstRuseFcltId == acc.pbnstRuseFcltId
|
||||
);
|
||||
|
||||
if (yearData) {
|
||||
yearData[`${year}inUsage`] += inUsageSum;
|
||||
yearData[`${year}outUsage`] += outUsageSum;
|
||||
yearData[`${year}total`] += (inUsageSum + outUsageSum);
|
||||
} else {
|
||||
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: acc.pbnstRuseFcltId, ruseUtztnFcltNm : item.ruseUtztnFcltNm ?? "" };
|
||||
yearVal[`${year}inUsage`] = inUsageSum;
|
||||
yearVal[`${year}outUsage`] = outUsageSum;
|
||||
yearVal[`${year}total`] = inUsageSum + outUsageSum;
|
||||
yearsData.push(yearVal);
|
||||
}
|
||||
});
|
||||
});
|
||||
const resData: any[] = []
|
||||
pbnstRes.forEach((acc) => {
|
||||
const data = yearsData.find((item) => item.pbnstRuseFcltId.substring(0, 11) === acc.bscFctCd)
|
||||
if (data) {
|
||||
resData.push({ ...acc, ...data })
|
||||
}
|
||||
})
|
||||
return set((state: pbnstPrfmncSttnState) => ({
|
||||
...state,
|
||||
pbnstPrfmncSttn: {
|
||||
...state.pbnstPrfmncSttn,
|
||||
prfmncRes: resData,
|
||||
rawData: res.data
|
||||
},
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,43 +95,59 @@ const hasuListFetch = async (
|
||||
year: string,
|
||||
flcts: string[]
|
||||
) => {
|
||||
let url = `/prcsFclt/ruseInfo/`;
|
||||
let url = ``;
|
||||
let filteredFclt = flcts;
|
||||
const filterData = reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue
|
||||
|
||||
|
||||
if(filterData !== '0')
|
||||
filteredFclt= flcts.filter((fclt: string) => {
|
||||
return filterData.length==2 ?fclt.slice(0, 2) === filterData:fclt.slice(0, 5) === filterData
|
||||
})
|
||||
if (reurnValue.partValue === "A") {
|
||||
url += `${page}/${total}/${reurnValue.partValue}/${
|
||||
url += `${reurnValue.partValue}/${
|
||||
// reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue
|
||||
reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue
|
||||
}/0/1/SW`
|
||||
|
||||
if(filterData !== '0')
|
||||
filteredFclt= flcts.filter((fclt: string) => {
|
||||
return filterData.length==2 ?fclt.slice(0, 2) === filterData:fclt.slice(0, 5) === filterData
|
||||
})
|
||||
} else if (reurnValue.partValue === "R") {
|
||||
url += `${page}/${total}/${reurnValue.partValue}/${reurnValue.regionValue
|
||||
url += `${reurnValue.partValue}/${reurnValue.regionValue
|
||||
? reurnValue.regionValue
|
||||
: reurnValue.unitWaterShedValue
|
||||
? reurnValue.unitWaterShedValue
|
||||
: reurnValue.middleRegionValue
|
||||
}/0/1/SW`
|
||||
} else if (reurnValue.partValue === 'G') {
|
||||
|
||||
|
||||
url += `${page}/${total}/${reurnValue.envPartValue}/${reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue}/0/1/SW`
|
||||
|
||||
url += `${reurnValue.envPartValue}/${reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue}/0/1/SW`
|
||||
if(filterData !== '0')
|
||||
filteredFclt= flcts.filter((fclt: string) => {
|
||||
return filterData.length==2 ?fclt.slice(0, 2) === filterData:fclt.slice(0, 5) === filterData
|
||||
})
|
||||
|
||||
} else {
|
||||
url += `1/2/A/0/0/1/SW`
|
||||
url += `A/0/0/1/SW`
|
||||
}
|
||||
|
||||
if (searchNm && searchNm?.length > 0) {
|
||||
url += "/" + searchNm
|
||||
}
|
||||
|
||||
const pbnList = await postFectch(url, flcts, fetchType.COMMON);
|
||||
const pbnList = await postFectch( `/prcsFclt/ruseInfo/1/${filteredFclt.length}/`+url, filteredFclt, fetchType.COMMON);
|
||||
|
||||
|
||||
const checkRuseFcltList = searchNm && searchNm?.length > 0?pbnList.data.map((item)=> item.bscFctCd ):filteredFclt
|
||||
const getRuseList = await postFectch(
|
||||
`/reuseFc/pubDetailList/${year}`,
|
||||
flcts,
|
||||
`/reuseFc/pubDetailList/${year}/${filterData}/${page}/${total}`,
|
||||
checkRuseFcltList,
|
||||
fetchType.WR
|
||||
);
|
||||
const checkWrRegListRes = getRuseList.data;
|
||||
|
||||
|
||||
|
||||
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
||||
(item: FcPrfType) => {
|
||||
const findData = pbnList.data.find(
|
||||
@@ -140,7 +156,6 @@ const hasuListFetch = async (
|
||||
);
|
||||
|
||||
if (findData) {
|
||||
|
||||
const usage = item.prfList.reduce(
|
||||
(acc, cur) => {
|
||||
acc.inUsage +=
|
||||
@@ -197,7 +212,11 @@ const hasuListFetch = async (
|
||||
|
||||
}
|
||||
).filter(Boolean);
|
||||
return data;
|
||||
|
||||
|
||||
|
||||
|
||||
return {data:data, count:getRuseList.count};
|
||||
};
|
||||
|
||||
export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
@@ -206,6 +225,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
return {
|
||||
getFlcts: async () => {
|
||||
const fclts = await getFetch(fetchType.WR, '/reuseFc/pubFc')
|
||||
|
||||
return set((state: pbnstSttnState) => ({
|
||||
pbnstSttn: {
|
||||
...state.pbnstSttn,
|
||||
@@ -236,8 +256,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
fclts: string[]
|
||||
) => {
|
||||
try {
|
||||
|
||||
|
||||
|
||||
const pbnstSttnRes = await hasuListFetch(
|
||||
page,
|
||||
total,
|
||||
@@ -249,7 +268,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
|
||||
// if (Number(total) > 9000) {
|
||||
if (isExcel) {
|
||||
const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes);
|
||||
const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes.data);
|
||||
set((state: pbnstSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
@@ -266,8 +285,8 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
...state,
|
||||
pbnstSttn: {
|
||||
...state.pbnstSttn,
|
||||
pbnstSttnRes: pbnstSttnRes,
|
||||
pbnstSttnResCount: pbnstSttnRes.length
|
||||
pbnstSttnRes: pbnstSttnRes.data,
|
||||
pbnstSttnResCount: pbnstSttnRes.count
|
||||
// isInit: false,
|
||||
},
|
||||
};
|
||||
@@ -293,13 +312,15 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
year,
|
||||
fclts
|
||||
);
|
||||
|
||||
|
||||
set((state: pbnstSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
pbnstSttn: {
|
||||
...state.pbnstSttn,
|
||||
pbnstSttnRes: pbnstSttnRes,
|
||||
pbnstSttnResCount: pbnstSttnRes.length,
|
||||
pbnstSttnRes: pbnstSttnRes.data,
|
||||
pbnstSttnResCount: pbnstSttnRes.count,
|
||||
isInit: false,
|
||||
pbnstDetail: {} as customPbnst
|
||||
},
|
||||
@@ -363,8 +384,8 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
...state,
|
||||
pbnstSttn: {
|
||||
...state.pbnstSttn,
|
||||
pbnstSearchData: pbnstSttnRes,
|
||||
pbnstSttnResCount: pbnstSttnRes.length,
|
||||
pbnstSearchData: pbnstSttnRes.data,
|
||||
pbnstSttnResCount: pbnstSttnRes.count,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
SERVER_API_CS_TUS_URL,
|
||||
SERVER_API_CS_URL,
|
||||
SERVER_API_FO_URL,
|
||||
SERVER_API_URL,
|
||||
SERVER_API_WR_URL,
|
||||
} from "@/src/shared/config";
|
||||
|
||||
//const DEV_PORT = "11080";
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
//export const CS_TUS_UPLOAD= "/attach-service/api/v1/tus/upload";
|
||||
|
||||
export const LOCAL_URL_WR = PROXY_HOST + `/api/v1`;
|
||||
export const DEV_URL_WR = SERVER_API_URL;
|
||||
export const DEV_URL_WR = SERVER_API_WR_URL;
|
||||
export const DEV_URL_FO = SERVER_API_FO_URL;
|
||||
export const LOCAL_URL = PROXY_HOST;
|
||||
export const CS_URL = SERVER_API_CS_URL;
|
||||
|
||||
@@ -156,6 +156,10 @@ export default function ConCostForm({
|
||||
toast.error("공사비 계산 진행 후 저장을 눌러주새요");
|
||||
return;
|
||||
}
|
||||
|
||||
const splycd = form.getValues("splyCndtList")
|
||||
const pk = splycd&&splycd[0]?.ruseUtztnFcltCd?splycd[0]?.ruseUtztnFcltCd:'11000SW001R1'
|
||||
|
||||
if (type === "mat") {
|
||||
if (value.demandCst) {
|
||||
const data: DedMatUpdateType = {
|
||||
@@ -178,8 +182,9 @@ export default function ConCostForm({
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
toast.dismiss(t.id);
|
||||
|
||||
coMatRvwUpdate(
|
||||
"11000SW001R1",
|
||||
pk,
|
||||
form.getValues("dmdInfoId"),
|
||||
data
|
||||
);
|
||||
@@ -194,12 +199,15 @@ export default function ConCostForm({
|
||||
</span>
|
||||
));
|
||||
} else {
|
||||
coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoId"), data);
|
||||
|
||||
coMatRvwUpdate(pk, form.getValues("dmdInfoId"), data);
|
||||
}
|
||||
}
|
||||
} else if (type === "hist") {
|
||||
delete value.totalConstCost;
|
||||
delete value.ruseUtztnFcltNm;
|
||||
console.log("onSubmit data ", pk);
|
||||
|
||||
ruseRvwCalUpdate(value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -488,16 +488,6 @@ export function PbnstBuseForm({
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* <MngRegFormDetail
|
||||
formList={ruseWaterQulityList}
|
||||
h1Title={`하수처리수 재이용시설 보증수질 `}
|
||||
subTitle="※재처리시설이 있는 경우만 작성"
|
||||
form={form}
|
||||
moClass="grid grid-cols-12 gap-4"
|
||||
sonClass="col-span-4"
|
||||
indexMng={indexMng}
|
||||
indexBiz={indexBiz}
|
||||
/> */}
|
||||
<div>
|
||||
|
||||
<BuseWaterQulity
|
||||
|
||||
@@ -48,10 +48,10 @@ export default function CoDetailModal({
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ScrollArea className="h-[85vh]">
|
||||
<ScrollArea className="h-[85vh] mx-8">
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onFormSubmit)}>
|
||||
<div className="grid grid-cols-12 flex items-center card-header">
|
||||
<div className="grid grid-cols-12 items-center card-header">
|
||||
<h1 className="text-2xl font-medium text-label col-span-10">
|
||||
잠재수요처 상세정보
|
||||
</h1>
|
||||
|
||||
@@ -17,7 +17,6 @@ export class LoginApiService implements LoginService {
|
||||
|
||||
public async login(payload: ILogin): Promise<void> {
|
||||
try {
|
||||
console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN)
|
||||
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "WR";
|
||||
export const PORT = process.env.NEXT_PUBLIC_PORT || "3001";
|
||||
export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
|
||||
export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL ||'http://con.mind-one.co.kr:11080/api/v1';
|
||||
export const SERVER_API_WR_URL = process.env.NEXT_PUBLIC_WR_SERVER_API_URL ||'http://con.mind-one.co.kr:11080/api/v1';
|
||||
export const SERVER_API_FO_URL = process.env.NEXT_PUBLIC_FO_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1';
|
||||
export const SERVER_API_CS_URL = process.env.NEXT_PUBLIC_CS_SERVER_API_URL||'http://dev.onasys.co.kr:8000';
|
||||
export const SERVER_API_CS_TUS_URL = process.env.NEXT_PUBLIC_CS_TUS_UPLOAD ||'/attach-service/api/v1/tus/upload'
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"dev:sn": "turbo run dev --filter=sn",
|
||||
"dev:wr": "turbo run dev --filter=wr",
|
||||
"dev:fo": "turbo run dev --filter=fo",
|
||||
"dev:dm": "turbo run dev --filter=dm",
|
||||
"preview:components": "turbo run storybook --filter=@common/components",
|
||||
"preinstall": "npx only-allow pnpm"
|
||||
},
|
||||
|
||||
@@ -83,7 +83,6 @@ export default function DoubleBarChart({chartConfig=undefined, chartData=[], cha
|
||||
.map(key => item[key])
|
||||
).flat());
|
||||
};
|
||||
console.log(chartData);
|
||||
const barMaxValue = getMaxValue(chartData, 'barVal');
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -18,6 +18,7 @@ type MonthPickerProps = {
|
||||
selectClass?: string;
|
||||
readOnly?: boolean;
|
||||
startYear?: number; // 시작 연도 props 추가
|
||||
yearReadOnly?: boolean;
|
||||
};
|
||||
|
||||
// yyyyMM → Date 객체
|
||||
@@ -39,6 +40,7 @@ export const DateMonthPicker = ({
|
||||
selectClass,
|
||||
readOnly = false,
|
||||
startYear,
|
||||
yearReadOnly = false,
|
||||
}: MonthPickerProps) => {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
@@ -78,6 +80,7 @@ export const DateMonthPicker = ({
|
||||
currentMonth={parsedDate}
|
||||
onMonthChange={handleSelect}
|
||||
startYear={startYear}
|
||||
yearReadOnly={yearReadOnly}
|
||||
/>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
|
||||
@@ -29,9 +29,10 @@ export type MonthPickerProps = {
|
||||
shouldClosePopover?: boolean
|
||||
) => void;
|
||||
startYear?: number;
|
||||
yearReadOnly?: boolean;
|
||||
};
|
||||
|
||||
export function MonthPicker({ currentMonth, onMonthChange, startYear }: MonthPickerProps) {
|
||||
export function MonthPicker({ currentMonth, onMonthChange, startYear, yearReadOnly }: MonthPickerProps) {
|
||||
|
||||
const today = startOfToday();
|
||||
const currentYear = today.getFullYear();
|
||||
@@ -73,6 +74,7 @@ const selectedYear = parseInt(yearFromProp);
|
||||
<div className="flex justify-center pt-1">
|
||||
<Select
|
||||
value={yearFromProp}
|
||||
disabled={yearReadOnly}
|
||||
onValueChange={(selectedYearStr) => {
|
||||
const selectedYearNum = parseInt(selectedYearStr);
|
||||
const newDate = new Date(
|
||||
|
||||
@@ -83,9 +83,8 @@ export const searchUpperPpls = async (fcltMngNo) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function Gis({
|
||||
isOpen,
|
||||
isOpen, //우측 상세 레이어 팝업
|
||||
gisMaps,
|
||||
isSearchModalOpen,
|
||||
treeData = [],
|
||||
@@ -100,9 +99,7 @@ function Gis({
|
||||
onFeatureSelect,
|
||||
setIsSearchModalOpen,
|
||||
onCheckedLayersChange,
|
||||
setData
|
||||
}) {
|
||||
|
||||
const mapRef = useRef();
|
||||
const [mapObject, setMapObject] = useState({});
|
||||
const [tabVisible, setTabVisible] = useState(true);
|
||||
@@ -130,96 +127,12 @@ function Gis({
|
||||
|
||||
// Feature Click Event
|
||||
const handleFeatureSelect = useCallback((data) => {
|
||||
gisMap = mapInstanceRef.current;
|
||||
|
||||
if (!gisMap) {
|
||||
console.warn('지도가 초기화되지 않았습니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
// 항상 같은 select 객체 사용
|
||||
const select = GisApp.Module.select;
|
||||
if (!select) return;
|
||||
|
||||
// 1. 기존 선택 초기화
|
||||
select.resetSelectedFeature();
|
||||
|
||||
// 2. data가 OpenLayers Feature 인스턴스인지 확인
|
||||
let foundFeature = null;
|
||||
if (data && typeof data.getGeometry === 'function' && typeof data.setStyle === 'function') {
|
||||
// 이미 Feature 인스턴스라면 그대로 사용
|
||||
foundFeature = data;
|
||||
} else {
|
||||
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
|
||||
let featureId = data.fid;
|
||||
const layerName = layerNmRef.current
|
||||
if (layerName === '하수재이용시설') {
|
||||
featureId = data.searchPk;
|
||||
} else if (layerName === '빗물이용시설' || layerName == '중수도시설') {
|
||||
featureId = data.bdstInfoSn;
|
||||
} else if (layerName === '하수처리시설') {
|
||||
featureId = data.bscFctCd;
|
||||
} else if (layerName === '온배수시설') {
|
||||
featureId = data.bdstRuseFcltSn;
|
||||
} else if(layerName == '수요처'){
|
||||
featureId = data.dmdInfoId.replaceAll('-','')
|
||||
}
|
||||
else {
|
||||
console.warn('해당 레이어에 대한 featureId 매핑 없음', layerNm);
|
||||
featureId = data.fid || data.id || data.ftrIdn;
|
||||
}
|
||||
// gisMap.getLayers().getArray().forEach(layer => {
|
||||
// const source = layer.getSource?.();
|
||||
// if (source?.getFeatureById) {
|
||||
// const feature = source.getFeatureById(String(featureId).trim());
|
||||
// if (feature) foundFeature = feature;
|
||||
// }
|
||||
// });
|
||||
// const [layerType, id] = String(featureId).split('.');
|
||||
gisMap.getLayers().getArray().forEach(layer => {
|
||||
const source = layer.getSource?.();
|
||||
if (source?.getFeatures) {
|
||||
const allFeatures = source.getFeatures();
|
||||
for (const f of allFeatures) {
|
||||
const id = String(f.getId());
|
||||
// console.log('id', id, featureId)
|
||||
if (id && id.split('.')[1] === String(featureId)) {
|
||||
foundFeature = f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 3. 피처 선택
|
||||
if (foundFeature) {
|
||||
let geometry = foundFeature.getGeometry();
|
||||
if (geometry) {
|
||||
let extent = geometry.getExtent();
|
||||
|
||||
gisMap.getView().fit(extent, {
|
||||
duration: 300,
|
||||
padding: [50, 50, 50, 50],
|
||||
maxZoom: 16,
|
||||
constrainResolution: true,
|
||||
nearest: true,
|
||||
});
|
||||
}
|
||||
select.selectFeature(foundFeature, true);
|
||||
} else {
|
||||
console.warn('OpenLayers Feature를 찾을 수 없습니다:', data);
|
||||
}
|
||||
|
||||
setFeatureData(data);
|
||||
setIsOpen(true);
|
||||
setIsSearchModalOpen(false);
|
||||
console.log(data);
|
||||
onFeatureSelect?.(data); // 선택된 피쳐 데이터 콜백 호출
|
||||
}, [mapInstanceRef]);
|
||||
|
||||
// 지도 생성 및 초기화
|
||||
useEffect(() => {
|
||||
|
||||
if (!mapRef.current) return;
|
||||
if (mapInstanceRef.current) return; // 이미 생성된 맵이 있다면 중단
|
||||
|
||||
@@ -281,6 +194,7 @@ function Gis({
|
||||
gisCore.changeBaseLayer('base');
|
||||
setMapObject({ map: map });
|
||||
mapInstanceRef.current = map; // 생성 완료 플래그 설정
|
||||
|
||||
}, []);
|
||||
|
||||
// treeData 변경 시 레이어 코드 생성
|
||||
@@ -297,7 +211,7 @@ function Gis({
|
||||
|
||||
//setTreeData(data);
|
||||
// 편집 가능한 레이어 목록 생성
|
||||
const layerItems = getLayerItems(layerCode);
|
||||
//const layerItems = getLayerItems(layerCode);
|
||||
//setEditLayerItems(prev => [...layerItems])
|
||||
}, [treeData]);
|
||||
|
||||
@@ -326,13 +240,127 @@ function Gis({
|
||||
}
|
||||
}
|
||||
|
||||
// // 데이터 로드 및 팝업 생성 로직
|
||||
// useEffect(() => {
|
||||
// if (!mapInstanceRef.current) return; // 맵이 생성되지 않았으면 실행 안 함
|
||||
|
||||
// // 1. 팝업 데이터 가져오기 (feature.js의 getData와 유사)
|
||||
// const fetchPopupData = async () => {
|
||||
// // 실제 API 호출 로직으로 대체해야 합니다.
|
||||
// // 예시: const response = await yourApiService.getFcltyWtCnt();
|
||||
// // setFacilityInfoPopupData(response.data);
|
||||
|
||||
// // 임시 목업 데이터
|
||||
// const mockData = [
|
||||
// { ftrIdn: 1, ftrCde: 'SA206', bplcNm: '처리장A', fcltyUseYn: 'Y', x: 127.005, y: 37.282, aCnt: 10, cCnt: 5, eCnt: 3, mCnt: 8, iCnt: 2 },
|
||||
// { ftrIdn: 2, ftrCde: 'SA112', bplcNm: '처리장B', fcltyUseYn: 'N', x: 127.010, y: 37.285, aCnt: 8, cCnt: 4, eCnt: 2, mCnt: 6, iCnt: 1 }
|
||||
// ];
|
||||
// setFacilityInfoPopupData(mockData);
|
||||
// };
|
||||
|
||||
// fetchPopupData();
|
||||
|
||||
// }, [mapInstanceRef.current]); // 맵 인스턴스가 생성된 후 한 번만 실행
|
||||
|
||||
// // 데이터가 변경되면 오버레이를 생성/업데이트하는 로직
|
||||
// useEffect(() => {
|
||||
// const map = mapInstanceRef.current;
|
||||
// if (!map || facilityInfoPopupData.length === 0) return;
|
||||
|
||||
// // 기존 오버레이 정리
|
||||
// facilityOverlaysRef.current.forEach(overlay => map.removeOverlay(overlay));
|
||||
// facilityOverlaysRef.current = [];
|
||||
|
||||
// facilityInfoPopupData.forEach(data => {
|
||||
// const popupId = `${data.ftrIdn}_${data.ftrCde}`;
|
||||
|
||||
// // 팝업을 담을 div 엘리먼트 생성
|
||||
// const popupElement = document.createElement('div');
|
||||
// popupElement.id = popupId;
|
||||
|
||||
// // OpenLayers Overlay 생성
|
||||
// const position = olProj.transform([Number(data.x), Number(data.y)], GisApp.FROM_PROJ, GisApp.TO_PROJ);
|
||||
// const overlay = new Overlay({
|
||||
// element: popupElement,
|
||||
// position: position,
|
||||
// offset: [-75, -210], // 팝업 너비의 절반, 높이만큼 오프셋 조정
|
||||
// positioning: 'bottom-center',
|
||||
// className: 'facility-popup-overlay' // 필요시 공통 클래스 추가
|
||||
// });
|
||||
|
||||
// map.addOverlay(overlay);
|
||||
// facilityOverlaysRef.current.push(overlay);
|
||||
|
||||
// // React 컴포넌트를 popupElement에 렌더링
|
||||
// const root = createRoot(popupElement);
|
||||
// root.render(<FacilityInfoPopup data={data} />);
|
||||
// });
|
||||
|
||||
// // 초기 가시성 업데이트
|
||||
// updatePopupVisibility();
|
||||
|
||||
// }, [facilityInfoPopupData]); // 팝업 데이터가 변경될 때마다 실행
|
||||
|
||||
// // 레이어 가시성에 따라 팝업 가시성을 제어하는 함수
|
||||
// const updatePopupVisibility = useCallback(() => {
|
||||
// const map = mapInstanceRef.current;
|
||||
// if (!map) return;
|
||||
|
||||
// const visibleLayers = new Set();
|
||||
// map.getLayers().forEach(layer => {
|
||||
// if (layer.getVisible()) {
|
||||
// // feature.js의 로직처럼 typeName이나 ftrCde를 사용해 필터링
|
||||
// const typeName = layer.get('typeName');
|
||||
// if (typeName === 'VW_WTL_FCLTY_AS') { // 예시 레이어 이름
|
||||
// visibleLayers.add(layer.get('ftrCde'));
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// facilityOverlaysRef.current.forEach(overlay => {
|
||||
// const element = overlay.getElement();
|
||||
// const ftrCde = element.querySelector('table')?.classList[0]; // FacilityPopup의 클래스에서 ftrCde 가져오기
|
||||
|
||||
// if (visibleLayers.has(ftrCde)) {
|
||||
// element.style.display = '';
|
||||
// } else {
|
||||
// element.style.display = 'none';
|
||||
// }
|
||||
// });
|
||||
// }, []);
|
||||
|
||||
// GisTree에서 체크 상태가 변경될 때 이 함수를 호출하도록 연결해야 합니다.
|
||||
// 예시: GisTree 컴포넌트에 onCheck 콜백을 추가하고, 그 콜백에서 이 함수를 호출
|
||||
// useEffect(() => {
|
||||
// // 레이어 가시성이 변경될 때마다 팝업 가시성 업데이트
|
||||
// const map = mapInstanceRef.current;
|
||||
// if (!map) return;
|
||||
|
||||
// const handleLayerVisibilityChange = () => {
|
||||
// updatePopupVisibility();
|
||||
// };
|
||||
|
||||
// map.getLayers().on('change:length', handleLayerVisibilityChange);
|
||||
// map.getLayers().forEach(layer => {
|
||||
// layer.on('change:visible', handleLayerVisibilityChange);
|
||||
// });
|
||||
|
||||
// return () => {
|
||||
// // 클린업
|
||||
// map.getLayers().un('change:length', handleLayerVisibilityChange);
|
||||
// map.getLayers().forEach(layer => {
|
||||
// layer.un('change:visible', handleLayerVisibilityChange);
|
||||
// });
|
||||
// };
|
||||
// }, [updatePopupVisibility]);
|
||||
|
||||
// 체크된 레이어 정보를 처리하는 함수
|
||||
const handleCheckedLayersChange = useCallback((checkedIds, checkedNodesData) => {
|
||||
setTimeout(() => {
|
||||
setCheckedLayers(checkedIds);
|
||||
setCheckedLayersData(checkedNodesData);
|
||||
onCheckedLayersChange?.(checkedIds, checkedNodesData);
|
||||
}, 0);
|
||||
}, 1000);
|
||||
}, [onCheckedLayersChange]);
|
||||
|
||||
return (
|
||||
@@ -344,9 +372,10 @@ function Gis({
|
||||
visible={tabVisible}
|
||||
setVisible={setTabVisible}
|
||||
onCheckedChange={handleCheckedLayersChange}
|
||||
onLayerIconClick={(nodeNm) => {
|
||||
layerNmRef.current = nodeNm
|
||||
setLayerNm(nodeNm); setIsOpen(true); const dummyFeature = {
|
||||
onLayerIconClick={(layerNm) => {
|
||||
console.log(layerNm)
|
||||
layerNmRef.current = layerNm
|
||||
setLayerNm(layerNm); setIsOpen(true); const dummyFeature = {
|
||||
getProperties: () => ({}), // 최소 구조
|
||||
};
|
||||
onFeatureSelect(dummyFeature);
|
||||
@@ -354,6 +383,8 @@ function Gis({
|
||||
imageVisible={imgVisble}
|
||||
/>
|
||||
|
||||
{/* <GisContent onFeatureSelect={handleFeatureSelect} isSearch={isSearch} isSearchModalOpen={isSearchModalOpen} setIsSearchModalOpen={setIsSearchModalOpen} /> */}
|
||||
|
||||
{/* DetailView가 존재할 때만 렌더링 isSearchModalOpen이 true면 visible=false로 팝업 숨김 */}
|
||||
{isOpen && !isSearchModalOpen && (
|
||||
<DetailView
|
||||
@@ -371,6 +402,7 @@ function Gis({
|
||||
onFeatureSelect={handleFeatureSelect}
|
||||
/>
|
||||
)}
|
||||
{/* <GisLonLat /> */}
|
||||
<GisToolBar />
|
||||
<GisMapToggle />
|
||||
<GisSelect onFeatureSelect={handleFeatureSelect} />
|
||||
|
||||
@@ -31,7 +31,6 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
|
||||
// 기본으로 체크된 노드들 찾기
|
||||
const defaultChecked = getDefaultCheckedNodes(nodes);
|
||||
setChecked(defaultChecked);
|
||||
console.log('defaultChecked : ', defaultChecked);
|
||||
|
||||
// 기본으로 확장된 노드들 설정
|
||||
const defaultExpanded = Array.from(new Set([
|
||||
@@ -188,7 +187,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
|
||||
image.src = canvas.toDataURL('image/png');
|
||||
return image;
|
||||
};
|
||||
const handleLayerImgClick = (nodeNm, nodeId) => {
|
||||
const handleLayerImgClick = (nodeNm, nodeId, layerNm) => {
|
||||
if(!checked.includes(nodeId)) alert('시설을 선택해주세요')
|
||||
else onLayerIconClick(nodeNm)
|
||||
}
|
||||
@@ -224,7 +223,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
|
||||
<input type="checkbox" checked={checked.includes(node.id)} onChange={() => handleCheck(node.id)} className="cursor-pointer" />
|
||||
{node.icon && <span>{node.icon}</span>}
|
||||
<span className="text-[1.3rem] font-medium text-label">{node.text}</span>
|
||||
{imageVisible ? depth > 0 && <span><img className="cursor-pointer w-5 h-5" src='/images/map/layericon/Layer_Select_BTN.png' onClick={()=>{handleLayerImgClick(node.text, node.id)}} alt={node.text}></img></span> : null}
|
||||
{imageVisible ? depth > 0 && <span><img className="cursor-pointer w-5 h-5" src='/images/map/layericon/Layer_Select_BTN.png' onClick={()=>{handleLayerImgClick(node.text, node.id, node.data.lyrTyNm)}} alt={node.text}></img></span> : null}
|
||||
</div>
|
||||
)}
|
||||
sort={(a, b) => {
|
||||
|
||||
@@ -130,8 +130,6 @@ GisOlLayer.prototype = {
|
||||
strategy: all,
|
||||
});
|
||||
return source;
|
||||
|
||||
return source;
|
||||
},
|
||||
/**
|
||||
* [사용]WFS 레이어 생성
|
||||
@@ -142,7 +140,19 @@ GisOlLayer.prototype = {
|
||||
let returnLayer = this.makeLayer(option);
|
||||
|
||||
//레이어 소스 생성
|
||||
let source = this.getVectorSourceBbox(option);
|
||||
let source;
|
||||
|
||||
let lyrTyNm = option.lyrTyNm;
|
||||
if(lyrTyNm == 'tb_ms_flood_dngr_map'
|
||||
|| lyrTyNm == 'tb_ms_sbmrg_dngr_map'
|
||||
|| lyrTyNm == 'tb_ms_swage_mhl'
|
||||
|| lyrTyNm == 'tb_ms_swage_ppl'
|
||||
) {
|
||||
source = this.getVectorSourceBbox(option);
|
||||
}else {
|
||||
source = this.getVectorTileSource(option);
|
||||
}
|
||||
|
||||
returnLayer.setSource(source);
|
||||
//스타일 추가
|
||||
returnLayer.setStyle(this.gisStyle.getLayerStyleFunction(returnLayer, option));
|
||||
|
||||
@@ -88,7 +88,7 @@ GisOlStyle.prototype = {
|
||||
}
|
||||
|
||||
let baseResolution = 2;
|
||||
let minScale = 0.4;
|
||||
let minScale = 0.8;
|
||||
let maxScale = 1.5;
|
||||
let scale = baseResolution / resolution > maxScale ? maxScale : baseResolution / resolution;
|
||||
scale = Math.max(minScale, Math.min(maxScale, scale));
|
||||
@@ -176,7 +176,7 @@ GisOlStyle.prototype = {
|
||||
|
||||
const properties = feature.getProperties();
|
||||
const overLayId = feature?.get('overLayId');
|
||||
const overLayMinZoom = layer.get('overLayMinZoom') || '12';
|
||||
const overLayMinZoom = layer.get('overLayMinZoom') || '10';
|
||||
const overLayOffset = layer?.get('overLayOffset');
|
||||
let findoOverlay = this.overlays[overLayId];
|
||||
if (findoOverlay) {
|
||||
@@ -193,7 +193,8 @@ GisOlStyle.prototype = {
|
||||
|
||||
if (typeof overlayHtml === 'string') {
|
||||
//const sanitizedHtml = DOMPurify.sanitize(overlayHtml);
|
||||
overlayContainer.innerHTML = sanitizedHtml;
|
||||
//overlayContainer.innerHTML = sanitizedHtml;
|
||||
overlayContainer.innerHTML = overlayHtml;
|
||||
}
|
||||
// React 컴포넌트일 경우 createPortal() 사용
|
||||
else if (React.isValidElement(overlayHtml)) {
|
||||
@@ -205,7 +206,7 @@ GisOlStyle.prototype = {
|
||||
element: overlayContainer,
|
||||
positioning: 'bottom-center',
|
||||
stopEvent: false,
|
||||
offset: overLayOffset ? overLayOffset : [0, 0], // 오프셋 설정 (위치 조정)
|
||||
offset: overLayOffset ? overLayOffset : [80, 0], // 오프셋 설정 (위치 조정)
|
||||
});
|
||||
this.overlays[overLayId] = overlay;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ type SearchBaseType = {
|
||||
rightClassName?: string;
|
||||
leftClassName?: string;
|
||||
leftSelectClassName?: string;
|
||||
buttonOrder?: ("query" | "init" | "excel")[];
|
||||
}
|
||||
export type ReturnType = {
|
||||
partValue: string;
|
||||
@@ -55,7 +56,8 @@ function SearchBaseForm ({
|
||||
isAdmin=false,
|
||||
rightClassName,
|
||||
leftClassName,
|
||||
leftSelectClassName
|
||||
leftSelectClassName,
|
||||
buttonOrder
|
||||
}: SearchBaseType) {
|
||||
const [partValue, setPartValue] = useState<string>("A");
|
||||
const [sidoValue, setSidoValue] = useState<string>("0");
|
||||
@@ -67,6 +69,30 @@ function SearchBaseForm ({
|
||||
const [middleRegionValue, setMiddleRegionValue] = useState<string>("0");
|
||||
const [envPartValue, setEnvPartValue] = useState<string>("0");
|
||||
const [resetTrigger, setResetTrigger] = useState(false);
|
||||
const renderButton = (type: "query" | "init" | "excel") => {
|
||||
switch (type) {
|
||||
case "query":
|
||||
return (
|
||||
<Button className={btnClass} onClick={queryVal} key="query">
|
||||
조회
|
||||
</Button>
|
||||
);
|
||||
case "init":
|
||||
return (
|
||||
<Button className={btnClass} onClick={initVal} key="init">
|
||||
초기화
|
||||
</Button>
|
||||
);
|
||||
case "excel":
|
||||
return (
|
||||
<Button className={btnClass} color="green" onClick={excelDownload} key="excel">
|
||||
{excelName ? excelName : "엑셀다운로드"}
|
||||
</Button>
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const queryVal = () => {
|
||||
console.log("조회버튼 클릭");
|
||||
queryClick({
|
||||
@@ -145,16 +171,8 @@ function SearchBaseForm ({
|
||||
{leftChildren}
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight className={rightClassName}>
|
||||
<Button className={btnClass} color="green" onClick={excelDownload}>
|
||||
{excelName?excelName:"엑셀다운로드"}
|
||||
</Button>
|
||||
<div>
|
||||
<Button className={btnClass} onClick={initVal}>
|
||||
초기화
|
||||
</Button>
|
||||
<Button className={btnClass} onClick={queryVal}>
|
||||
조회
|
||||
</Button>
|
||||
{(buttonOrder ?? ["excel", "init", "query"]).map(renderButton)}
|
||||
</div>
|
||||
{rightChildren}
|
||||
</SearchFormRight>
|
||||
|
||||
@@ -28,6 +28,7 @@ const SelectBox = React.forwardRef<
|
||||
value?: string | number;
|
||||
readOnly?: boolean; // readOnly 속성 추가
|
||||
selectContentClass?: string;
|
||||
labelClass?: string;
|
||||
}
|
||||
>(
|
||||
(
|
||||
@@ -40,6 +41,7 @@ const SelectBox = React.forwardRef<
|
||||
value,
|
||||
readOnly = false,
|
||||
selectContentClass,
|
||||
labelClass = "w-20 whitespace-nowrap text-xl text-gray-600",
|
||||
},
|
||||
ref,
|
||||
) => {
|
||||
@@ -66,7 +68,7 @@ const SelectBox = React.forwardRef<
|
||||
return (
|
||||
<div className={className + " flex items-center"} ref={ref}>
|
||||
{label && (
|
||||
<Label className="w-20 whitespace-nowrap text-xl text-gray-600">
|
||||
<Label className={labelClass}>
|
||||
{label}
|
||||
</Label>
|
||||
)}
|
||||
|
||||
@@ -20,7 +20,7 @@ const UITab = React.forwardRef<
|
||||
return (
|
||||
<Tabs
|
||||
defaultValue={defaultValue || tabList[0]?.value}
|
||||
className={"w-full space-x-1 border-b border-gray-200"}
|
||||
className={"w-full space-x-1 border-gray-200"}
|
||||
onValueChange={onValueChange}
|
||||
ref={ref}
|
||||
{...props}
|
||||
|
||||
@@ -81,6 +81,8 @@ export function UiTable({
|
||||
const handlePageChange = (page: number) => {
|
||||
setCur(page);
|
||||
onPageChange(page);
|
||||
if (index == 0)
|
||||
setIdx(0)
|
||||
};
|
||||
|
||||
const handleCellClick = (index: number, headId: string) => {
|
||||
@@ -90,6 +92,7 @@ export function UiTable({
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
{headName ? (
|
||||
@@ -116,14 +119,13 @@ export function UiTable({
|
||||
head.id.length > 1 &&
|
||||
(boldArray.includes(index) ? (
|
||||
<TableCell
|
||||
className={`${head.align === "right" ? "text-right" : head.align === "center" ? "text-center" : "text-center"} ${
|
||||
cellClick && idx === index
|
||||
className={`${head.align === "right" ? "text-right" : head.align === "center" ? "text-center" : "text-center"} ${cellClick && idx === index
|
||||
? "cursor-pointer !font-[1000]"
|
||||
: cellClick
|
||||
? "cursor-pointer"
|
||||
: ""
|
||||
} sticky top-20 z-40 bg-secondary !font-bold`}
|
||||
style={{ top: `${headerHeight + index * 32-4}px` }}
|
||||
} sticky top-20 z-40 bg-secondary !font-bold`}
|
||||
style={{ top: `${headerHeight + index * 32 - 4}px` }}
|
||||
onClick={() => handleCellClick(index, head.id)}
|
||||
key={`cell-${head.id}-${index}`}
|
||||
>
|
||||
@@ -131,39 +133,38 @@ export function UiTable({
|
||||
? String(el[head.id] ?? "")
|
||||
: String(el[head.id]).includes(".")
|
||||
? String(el[head.id])
|
||||
.split(".")
|
||||
.map((part, index) =>
|
||||
index === 0
|
||||
? part.replace(
|
||||
/\B(?=(\d{3})+(?!\d))/g,
|
||||
",",
|
||||
)
|
||||
: part,
|
||||
)
|
||||
.join(".")
|
||||
.split(".")
|
||||
.map((part, index) =>
|
||||
index === 0
|
||||
? part.replace(
|
||||
/\B(?=(\d{3})+(?!\d))/g,
|
||||
",",
|
||||
)
|
||||
: part,
|
||||
)
|
||||
.join(".")
|
||||
: String(el[head.id] ?? "").replace(
|
||||
/\B(?=(\d{3})+(?!\d))/g,
|
||||
",",
|
||||
)}
|
||||
/\B(?=(\d{3})+(?!\d))/g,
|
||||
",",
|
||||
)}
|
||||
</TableCell>
|
||||
) : (
|
||||
<TableCell
|
||||
className={`${head.align === "right" ? "text-right" : head.align === "center" ? "text-center" : "text-center"} ${
|
||||
cellClick && idx === index
|
||||
className={`${head.align === "right" ? "text-right" : head.align === "center" ? "text-center" : "text-center"} ${cellClick && idx === index
|
||||
? "cursor-pointer !font-[1000]"
|
||||
: cellClick
|
||||
? "cursor-pointer"
|
||||
: ""
|
||||
} mt-[${boldArray.length * 40}px]`}
|
||||
} mt-[${boldArray.length * 40}px]`}
|
||||
onClick={() => handleCellClick(index, head.id)}
|
||||
key={`cell-${head.id}-${index}`}
|
||||
>
|
||||
{
|
||||
//체크박스 유형애서 readOnly가 필요한 경우를 위해서 ChkClass 를 사용해서 readOnly 처리함.
|
||||
typeof el[head.id] === "object" &&
|
||||
el[head.id] !== null &&
|
||||
"chk" in (el[head.id] as object) &&
|
||||
"readonly" in (el[head.id] as object) ? (
|
||||
el[head.id] !== null &&
|
||||
"chk" in (el[head.id] as object) &&
|
||||
"readonly" in (el[head.id] as object) ? (
|
||||
<Checkbox
|
||||
checked={
|
||||
(el[head.id] as ChkClass)?.chk === true
|
||||
@@ -199,9 +200,9 @@ export function UiTable({
|
||||
.map((part, index) =>
|
||||
index === 0
|
||||
? part.replace(
|
||||
/\B(?=(\d{3})+(?!\d))/g,
|
||||
",",
|
||||
)
|
||||
/\B(?=(\d{3})+(?!\d))/g,
|
||||
",",
|
||||
)
|
||||
: part,
|
||||
)
|
||||
.join(".")
|
||||
|
||||
Reference in New Issue
Block a user