Merge remote-tracking branch 'origin/iipbs/wr/dev'
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
"use client";
|
||||
import type { MenuItem } from "@common/components/api";
|
||||
import { NoFooterLayout } from "@common/components/ui";
|
||||
import { usePathname,useRouter } from "next/navigation";
|
||||
import { useWrStore } from "../store";
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const { getMenuAuthrts } = useWrStore((state) => state);
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
|
||||
const changeMenu = (path: MenuItem) => {
|
||||
getMenuAuthrts(path.menuCd);
|
||||
router.push(path.urlPath);
|
||||
};
|
||||
return (
|
||||
<NoFooterLayout currentPath={pathname ?? ""} handleMenuClick={changeMenu}>
|
||||
{children}
|
||||
</NoFooterLayout>
|
||||
);
|
||||
}
|
||||
+17
-3
@@ -2,11 +2,12 @@
|
||||
|
||||
import Gis from "@common/business_components/ui/map/Gis";
|
||||
import { useEffect, useRef, useState, useCallback } from "react";
|
||||
import { mapService } from "../service";
|
||||
import { mapService } from "../../service";
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import { SearchBar } from "@common/business_components/ui/map/searchBar/searchBar";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { getFeatureCd } from "@/components/lib/func/mapUtil";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
|
||||
const Map = () => {
|
||||
const { comMap } = useWrStore((state) => state);
|
||||
@@ -228,7 +229,6 @@ const Map = () => {
|
||||
const popupOptions = `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=no`;
|
||||
popupRef.current = window.open(url, "지도 레이어 팝업", popupOptions);
|
||||
} else {
|
||||
console.log('isFeature 2', isFeature)
|
||||
const layerNm = getSelectedLayers(isFeature);
|
||||
const safeProps = isFeature.getProperties();
|
||||
const featureCd = getFeatureCd(safeProps, String(layerNm));
|
||||
@@ -266,7 +266,20 @@ const Map = () => {
|
||||
};
|
||||
|
||||
const onOpenPopup = (data:any) => {
|
||||
console.log(data)
|
||||
if(data){
|
||||
|
||||
const url = `/mapDetailPopUp?layerNm=${encodeURIComponent(data)}`;
|
||||
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=no`;
|
||||
popupRef.current = window.open(url, "지도 레이어 팝업", popupOptions);
|
||||
}else{
|
||||
toast.error('시설 및 수요처가 선택되지 않았습니다.')
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -307,6 +320,7 @@ const Map = () => {
|
||||
onOpenPopup(data)
|
||||
}}
|
||||
/>
|
||||
<Toaster position="top-center" />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -16,7 +16,7 @@ export default function MapDetailPopUp() {
|
||||
const renderConditionalContent = () => {
|
||||
const layerId = searchParams.get("layerNm");
|
||||
switch (layerId) {
|
||||
case "하수재이용시설":
|
||||
case "tb_wr_bdst_ruse_fclt":
|
||||
return (
|
||||
<RuseFacility
|
||||
rtnFeature={(feature) => {
|
||||
@@ -24,7 +24,7 @@ export default function MapDetailPopUp() {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
case "하수처리시설":
|
||||
case "tb_il_swage_prcs_fclt":
|
||||
return (
|
||||
<HasuFacility
|
||||
rtnFeature={(feature) => {
|
||||
@@ -32,7 +32,7 @@ export default function MapDetailPopUp() {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
case "빗물이용시설":
|
||||
case "tb_wr_rnwtr_utztn_fclt":
|
||||
return (
|
||||
<RainFacility
|
||||
rtnFeature={(feature) => {
|
||||
@@ -40,7 +40,7 @@ export default function MapDetailPopUp() {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
case "중수도시설":
|
||||
case "tb_wr_rswtr_fclt":
|
||||
return (
|
||||
<RswtFacility
|
||||
rtnFeature={(feature) => {
|
||||
@@ -48,7 +48,7 @@ export default function MapDetailPopUp() {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
case "온배수시설":
|
||||
case "tb_wr_htdfl_fclt":
|
||||
return (
|
||||
<HtdflFacility
|
||||
rtnFeature={(feature) => {
|
||||
@@ -56,7 +56,7 @@ export default function MapDetailPopUp() {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
case "수요처":
|
||||
case "tb_wr_ruse_fclt_dmd_co":
|
||||
return (
|
||||
<CoSttnMap
|
||||
rtnFeature={(feature) => {
|
||||
@@ -64,7 +64,7 @@ export default function MapDetailPopUp() {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
case "잠재수요처":
|
||||
case "tb_wr_tmpr_dmd_co":
|
||||
return (
|
||||
<LdrmntCoMap
|
||||
rtnFeature={(feature) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { RuseDetailPopup } from "@/components/ui/map/LayerPopUp/detailPopup/ruseDetailPopup";
|
||||
import { RuseDetailPopup } from "@/components/ui/map/detailPopup/ruseDetailPopup";
|
||||
import CoDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/coDatailModal";
|
||||
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
|
||||
import { Title, UiTable } from "@common/business_components/ui";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { fetchType, getFetch } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
import type { WaterReuseFacility } from "../../ruseFcltMng/fcltSttn/pbnstSttn/type";
|
||||
import {
|
||||
@@ -16,7 +16,7 @@ export type ruseMapState = {
|
||||
ruseMapCount: number;
|
||||
isInit: boolean;
|
||||
fclts: string[];
|
||||
ruseDetailList:customPbnst[]
|
||||
ruseDetailList: customPbnst[];
|
||||
ruseMapHeadList: CommonTableProps[];
|
||||
ruseMapNodeList: CommonTableProps[];
|
||||
};
|
||||
@@ -32,9 +32,10 @@ type ruseMapActions = {
|
||||
fclts: string[]
|
||||
) => void;
|
||||
ruseMapDetail: (ruseFcltId: string) => Promise<customPbnst | undefined>;
|
||||
getRuseMaplList :(ruseFcltId: string) => void;
|
||||
getRuseMaplList: (bscFctCd: string) => void;
|
||||
};
|
||||
|
||||
|
||||
export type ruseMapType = ruseMapState & ruseMapActions;
|
||||
|
||||
export const ruseMapStateExport: ruseMapState = {
|
||||
@@ -109,15 +110,36 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
|
||||
console.log(errorHasu);
|
||||
throw errorHasu; // 호출부에서 catch 가능하도록
|
||||
}
|
||||
},getRuseMaplList:async(bscFctCd: string) =>{
|
||||
},
|
||||
getRuseMaplList: async (bscFctCd: string) => {
|
||||
try {
|
||||
const ruseDetailList = await getFetch("wr", `/reuseFc/pubFc/${bscFctCd}`);
|
||||
const ruseDetailList = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/pubFc/${bscFctCd}`
|
||||
);
|
||||
const year = new Date().getFullYear();
|
||||
const data = [bscFctCd];
|
||||
const rusePrfList = await postFectch(
|
||||
`/reuseFc/pubDetailList/${year}/0/1/10`,
|
||||
data,
|
||||
fetchType.WR
|
||||
);
|
||||
const dataList = ruseDetailList.map((ruse) => {
|
||||
const matchRuse = rusePrfList?.data.find(
|
||||
(prf) => prf.pbnstRuseFcltId === ruse.pbnstRuseFcltId
|
||||
);
|
||||
return {
|
||||
...ruse,
|
||||
prfList: matchRuse.prfList,
|
||||
};
|
||||
});
|
||||
console.log("/dataList ", dataList);
|
||||
set((state: ruseMapState) => {
|
||||
return {
|
||||
...state,
|
||||
ruseMap: {
|
||||
...state.ruseMap,
|
||||
ruseDetailList: ruseDetailList,
|
||||
ruseDetailList: dataList,
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -125,7 +147,6 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
|
||||
console.log(errorHasu);
|
||||
throw errorHasu; // 호출부에서 catch 가능하도록
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -231,6 +231,30 @@ export const fcBizSchema = z.object({
|
||||
mdfr: z.string().nullish(),
|
||||
});
|
||||
|
||||
const PrfSchema = z.object({
|
||||
pbnstRuseFcltId: z.string(),
|
||||
ym: z.string(), // 예: "202310"
|
||||
wshwtr: z.number(),
|
||||
coolUswtr: z.number(),
|
||||
cleanUswtr: z.number(),
|
||||
drwtUswtr: z.number(),
|
||||
dltnUswtr: z.number(),
|
||||
ithlRswtr: z.number(),
|
||||
ithlEtcUswtr: z.number(),
|
||||
cleanToilUswtr: z.number(),
|
||||
resn: z.number(),
|
||||
lndwtr: z.number(),
|
||||
hydUswtr: z.number(),
|
||||
rvrKeepUswtr: z.number(),
|
||||
farmUswtr: z.number(),
|
||||
ugwtChr: z.number(),
|
||||
indstUswtr: z.number(),
|
||||
regDt: z.date().default(new Date()).nullish(),
|
||||
rgtr: z.string().nullish(),
|
||||
mdfcnDt: z.date().default(new Date()).nullish(),
|
||||
mdfr: z.string().nullish(),
|
||||
});
|
||||
|
||||
export const pbnstRegZod = z.object({
|
||||
pbnstRuseFcltId: z.string().default(""),
|
||||
swtrmtFcltId: z.string().default(""),
|
||||
@@ -258,11 +282,14 @@ export const pbnstRegZod = z.object({
|
||||
fcBizs: z.array(fcBizSchema).default([]),
|
||||
fcOpers://z.array(fcOperSchema).default([]),
|
||||
z .array(fcOperSchema)
|
||||
.min(1, { message: "재이용시설의 운영정보를 최소 하나를 등록해주세요" })
|
||||
.min(1, { message: "재이용시설의 운영정보를 최소 하나를 등록해주세요" }),
|
||||
prfList: z.array(PrfSchema).nullish(),
|
||||
});
|
||||
|
||||
export const pbnstRegArrayZod = z.array(pbnstRegZod);
|
||||
|
||||
|
||||
|
||||
export const pbnstRegArrayZod = z.array(pbnstRegZod);
|
||||
export type PbnstRegArrrayType = z.infer<typeof pbnstRegArrayZod>;
|
||||
|
||||
export type fcBizType = z.infer<typeof fcBizSchema>;
|
||||
|
||||
@@ -41,7 +41,10 @@ export const getFetch = async (type: string, url: string) => {
|
||||
// JSON 응답 처리
|
||||
const res = await response.json();
|
||||
return res.data;
|
||||
} else {
|
||||
} else if(contentType.includes('application/octet-stream')) {
|
||||
// 파일 응답 처리 (ex. PDF, Excel 등)
|
||||
|
||||
console.log('contentType ' ,contentType)
|
||||
// 파일 응답 처리 (ex. PDF, Excel 등)
|
||||
const blob = await response.blob();
|
||||
const blobUrl = window.URL.createObjectURL(blob);
|
||||
@@ -54,6 +57,8 @@ export const getFetch = async (type: string, url: string) => {
|
||||
window.URL.revokeObjectURL(blobUrl);
|
||||
|
||||
return null; // 다운로드이므로 반환값 없음
|
||||
}else{
|
||||
throw Error('오류 발생')
|
||||
}
|
||||
};
|
||||
|
||||
@@ -89,8 +94,10 @@ export const getFetchWithCount = async (type: string, url: string) => {
|
||||
const res = await response.json();
|
||||
|
||||
return res;
|
||||
} else {
|
||||
} else if(contentType.includes('application/octet-stream')) {
|
||||
// 파일 응답 처리 (ex. PDF, Excel 등)
|
||||
|
||||
console.log('contentType ' ,contentType)
|
||||
const blob = await response.blob();
|
||||
const blobUrl = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
@@ -102,6 +109,8 @@ export const getFetchWithCount = async (type: string, url: string) => {
|
||||
window.URL.revokeObjectURL(blobUrl);
|
||||
|
||||
return null; // 다운로드이므로 반환값 없음
|
||||
}else{
|
||||
throw Error('오류 발생')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
export default function coSttnDetailPopup(){
|
||||
|
||||
|
||||
return(
|
||||
<>
|
||||
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -223,6 +223,12 @@ export function PbnstSttnModal({ data, titleVisible,isMap}: { data: customPbnst;
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
if(isMap){
|
||||
if(data.prfList &&data.prfList.length>0){
|
||||
getTablePrfData(data.prfList);
|
||||
}
|
||||
}else{
|
||||
|
||||
if (pbnstSttn.pbnstSttnRes && data) {
|
||||
const prfList = pbnstSttn.pbnstSttnRes.find(
|
||||
(item) => item.pbnstRuseFcltId === data.pbnstRuseFcltId
|
||||
@@ -233,7 +239,8 @@ export function PbnstSttnModal({ data, titleVisible,isMap}: { data: customPbnst;
|
||||
getTablePrfData(prfList);
|
||||
}
|
||||
}
|
||||
}, [pbnstSttn.pbnstSttnRes, data]);
|
||||
}
|
||||
}, [pbnstSttn.pbnstSttnRes, data,isMap]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user