Merge remote-tracking branch 'origin/iipbs/wr/dev'
This commit is contained in:
+8
-8
@@ -1,12 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { CoSttnMap } from "@/components/ui/map/LayerPopUp/CoSttnMap/CoSttnMap";
|
||||
import { HasuFacility } from "@/components/ui/map/LayerPopUp/HasuFacilty/HasuFacility";
|
||||
import { HtdflFacility } from "@/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty";
|
||||
import { LdrmntCoMap } from "@/components/ui/map/LayerPopUp/LdrmntCoMap/LdrmntCoMap";
|
||||
import { RainFacility } from "@/components/ui/map/LayerPopUp/RainFacility/RainFacility";
|
||||
import { RswtFacility } from "@/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty";
|
||||
import { RuseFacility } from "@/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility";
|
||||
import { CoSttnMap } from "@/components/ui/map/LayerPopUp/CoSttnMap/coSttnMap";
|
||||
import { HasuFacility } from "@/components/ui/map/LayerPopUp/HasuFacilty/hasuFacility";
|
||||
import { HtdflFacility } from "@/components/ui/map/LayerPopUp/HedfFacilty/htdfFacilty";
|
||||
import { LdrmntCoMap } from "@/components/ui/map/LayerPopUp/LdrmntCoMap/ldrmntCoMap";
|
||||
import { RainFacility } from "@/components/ui/map/LayerPopUp/RainFacility/rainFacility";
|
||||
import { RswtFacility } from "@/components/ui/map/LayerPopUp/RswtFacilty/rswtFacilty";
|
||||
import { RuseFacility } from "@/components/ui/map/LayerPopUp/RuseFacilty/ruseFacility";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
|
||||
export default function MapDetailPopUp() {
|
||||
@@ -78,7 +78,7 @@ export default function MapDetailPopUp() {
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<div>{renderConditionalContent()}</div>
|
||||
<div className="h-full overflow-auto">{renderConditionalContent()}</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { PbnstSttnModal } from "@/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal";
|
||||
import { RuseDetailPopup } from "@/components/ui/map/LayerPopUp/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";
|
||||
@@ -11,7 +11,6 @@ export default function MapFeaturePopup() {
|
||||
const [isFeatureCd, setIsFeatureCd] = useState<any>(null);
|
||||
const {
|
||||
pbnMap,
|
||||
ruseMapDetail,
|
||||
rainMapDetile,
|
||||
rswtMapDetile,
|
||||
htdfMapDetile,
|
||||
@@ -46,10 +45,8 @@ export default function MapFeaturePopup() {
|
||||
|
||||
useEffect(() => {
|
||||
if (isFeatureCd && layerNm) {
|
||||
let detail = {};
|
||||
if (layerNm === "하수재이용시설") {
|
||||
detail = ruseMapDetail(isFeatureCd);
|
||||
setIsDetail(detail);
|
||||
setIsDetail(isFeatureCd);
|
||||
} else if (layerNm === "하수처리시설") {
|
||||
pbnMapDetaile(isFeatureCd, isFeatureCd).then((res) => {
|
||||
setIsDetail(res);
|
||||
@@ -78,9 +75,9 @@ export default function MapFeaturePopup() {
|
||||
return (
|
||||
<>
|
||||
{isDetail ? (
|
||||
<div className="fixed inset-0 w-screen h-screen m-0 p-0 overflow-auto bg-white">
|
||||
<div className="fixed inset-0 w-screen h-screen m-0 p-0 bg-white">
|
||||
{layerNm === "하수재이용시설" ? (
|
||||
<PbnstSttnModal data={isDetail} />
|
||||
<RuseDetailPopup bscFctCd={isDetail} />
|
||||
) : layerNm === "하수처리시설" ? (
|
||||
<div style={{ overflowX: "hidden" }}>
|
||||
<div className="flex justify-between items-center mb-4">
|
||||
@@ -125,6 +122,7 @@ export default function MapFeaturePopup() {
|
||||
: "HTB"
|
||||
}
|
||||
formObj={isDetail}
|
||||
isMap={true}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ 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 { getFeatureCd } from "@/components/lib/func/mapUtil";
|
||||
|
||||
const Map = () => {
|
||||
const { comMap } = useWrStore((state) => state);
|
||||
@@ -173,7 +173,6 @@ const Map = () => {
|
||||
setIsSearchModalOpen(false);
|
||||
};
|
||||
|
||||
|
||||
const getSelectedLayers = (isFeature: any) => {
|
||||
const map = gisMaps.current;
|
||||
if (!map) {
|
||||
@@ -206,33 +205,53 @@ const Map = () => {
|
||||
|
||||
const renderDetailView = useCallback(
|
||||
(props: any) => {
|
||||
const isFeature = props.featureData.getProperties();
|
||||
if (
|
||||
Object.keys(isFeature).length === 0 &&
|
||||
isFeature.constructor === Object
|
||||
) {
|
||||
const url = `/mapDetilePopUp?layerNm=${encodeURIComponent(props.seletectedLayerNm)}`;
|
||||
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`;
|
||||
popupRef.current = window.open(url, "지도 레이어 팝업", popupOptions);
|
||||
} else {
|
||||
const layerNm = getSelectedLayers(featureData);
|
||||
const safeProps = featureData.getProperties();
|
||||
const featureCd = getFeatureCd(safeProps, String(layerNm));
|
||||
const url = `/mapFeaturePopup?layerNm=${encodeURIComponent(String(layerNm))}&featureCd=${encodeURIComponent(featureCd)} `;
|
||||
const width = Math.floor(window.innerWidth * 0.4); // 화면 폭의 40%
|
||||
const height = Math.floor(window.innerHeight - 450); // 150px 여백 확보; // calc(100% - 70px)
|
||||
const left = (window.screen.availWidth - width) / 2;
|
||||
const top = (window.screen.availHeight - height) / 2;
|
||||
const popupOptions = `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`;
|
||||
popupDetailRef.current = window.open(
|
||||
url,
|
||||
"지도 시설 상세정보 팝업",
|
||||
popupOptions
|
||||
);
|
||||
const map = gisMaps.current;
|
||||
if (!map) {
|
||||
console.warn("지도가 초기화되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const isFeature = props?.featureData;
|
||||
|
||||
console.log('isFeature 1', isFeature)
|
||||
if( typeof isFeature.getProperties === "function" ){
|
||||
|
||||
if (
|
||||
Object.keys(isFeature?.getProperties()).length === 0 &&
|
||||
isFeature.constructor === Object
|
||||
) {
|
||||
const url = `/mapDetailPopUp?layerNm=${encodeURIComponent(props.seletectedLayerNm)}`;
|
||||
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 {
|
||||
console.log('isFeature 2', isFeature)
|
||||
const layerNm = getSelectedLayers(isFeature);
|
||||
const safeProps = isFeature.getProperties();
|
||||
const featureCd = getFeatureCd(safeProps, String(layerNm));
|
||||
const url = `/mapFeaturePopup?layerNm=${encodeURIComponent(String(layerNm))}&featureCd=${encodeURIComponent(featureCd)} `;
|
||||
const width =
|
||||
String(layerNm) === "하수재이용시설"
|
||||
? Math.floor(window.innerWidth * 0.8)
|
||||
: Math.floor(window.innerWidth * 0.4); // 화면 폭의 40%
|
||||
const height =
|
||||
String(layerNm) === "하수재이용시설"
|
||||
? Math.floor(window.innerHeight - 150)
|
||||
: Math.floor(window.innerHeight - 450); // 150px 여백 확보; // calc(100% - 70px)
|
||||
const left = (window.screen.availWidth - width) / 2;
|
||||
const top = (window.screen.availHeight - height) / 2;
|
||||
const popupOptions = `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`;
|
||||
popupDetailRef.current = window.open(
|
||||
url,
|
||||
"지도 시설 상세정보 팝업",
|
||||
popupOptions
|
||||
);
|
||||
}
|
||||
}else{
|
||||
console.log(' data확인 필요')
|
||||
}
|
||||
},
|
||||
[checkedLayers, checkedLayersData, featureData] // 필요 시 의존성 넣기
|
||||
@@ -255,7 +274,7 @@ const Map = () => {
|
||||
isMiniMap={false}
|
||||
searchView={undefined}
|
||||
detailView={renderDetailView}
|
||||
onFeatureSelect={onFeatureFocus}
|
||||
onFeatureSelect={onFeatureSelect}
|
||||
setIsOpen={setIsOpen}
|
||||
setFeatureData={setFeatureData}
|
||||
featureData={featureData}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
import { cmsPostFectch } from "@/components/lib/api";
|
||||
|
||||
export const isLogin = async () => {
|
||||
const headers = {
|
||||
accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"X-Site-Id": "WR",
|
||||
"Access-Control-Expose-Headers" : ["Authorization","refresh-token","token-id"]
|
||||
};
|
||||
const param = { userId: "tuser10003", password: "test1234!" };
|
||||
await cmsPostFectch("/user-service/login",param,headers);
|
||||
};
|
||||
|
||||
// export type LoginState = {
|
||||
// login: {} as any;
|
||||
// };
|
||||
|
||||
// export type loginType = LoginState & LoginActions;
|
||||
|
||||
// export const loginState: LoginState = {
|
||||
// login: {},
|
||||
// };
|
||||
|
||||
// export type LoginActions = {
|
||||
// isLogin: () => void;
|
||||
// };
|
||||
|
||||
// export const loginActionExport: (set: any) => LoginActions = (set: any) => {
|
||||
// return {
|
||||
// isLogin: async () => {},
|
||||
// };
|
||||
// };
|
||||
@@ -16,6 +16,7 @@ export type ruseMapState = {
|
||||
ruseMapCount: number;
|
||||
isInit: boolean;
|
||||
fclts: string[];
|
||||
ruseDetailList:customPbnst[]
|
||||
ruseMapHeadList: CommonTableProps[];
|
||||
ruseMapNodeList: CommonTableProps[];
|
||||
};
|
||||
@@ -31,6 +32,7 @@ type ruseMapActions = {
|
||||
fclts: string[]
|
||||
) => void;
|
||||
ruseMapDetail: (ruseFcltId: string) => Promise<customPbnst | undefined>;
|
||||
getRuseMaplList :(ruseFcltId: string) => void;
|
||||
};
|
||||
|
||||
export type ruseMapType = ruseMapState & ruseMapActions;
|
||||
@@ -39,6 +41,7 @@ export const ruseMapStateExport: ruseMapState = {
|
||||
ruseMap: {
|
||||
isInit: false,
|
||||
ruseMapRes: [],
|
||||
ruseDetailList:[],
|
||||
fclts: [],
|
||||
ruseMapCount: 1,
|
||||
ruseMapHeadList: pbnSttHeadListExport,
|
||||
@@ -106,6 +109,23 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = (
|
||||
console.log(errorHasu);
|
||||
throw errorHasu; // 호출부에서 catch 가능하도록
|
||||
}
|
||||
},
|
||||
},getRuseMaplList:async(bscFctCd: string) =>{
|
||||
try {
|
||||
const ruseDetailList = await getFetch("wr", `/reuseFc/pubFc/${bscFctCd}`);
|
||||
set((state: ruseMapState) => {
|
||||
return {
|
||||
...state,
|
||||
ruseMap: {
|
||||
...state.ruseMap,
|
||||
ruseDetailList: ruseDetailList,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (errorHasu) {
|
||||
console.log(errorHasu);
|
||||
throw errorHasu; // 호출부에서 catch 가능하도록
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -161,7 +161,6 @@ import {
|
||||
type rswtStatState,
|
||||
type rswtStatType,
|
||||
} from "./stats/rswtStat";
|
||||
//import { isLogin } from "./common/login";
|
||||
import { LoginApi } from "@/src/entities/auth";
|
||||
import {
|
||||
authActionsExport,
|
||||
|
||||
@@ -1,28 +1,39 @@
|
||||
//8880
|
||||
|
||||
import { AUTH_USER_ID, CLAIM_NAME } from "@/src/shared/config";
|
||||
import { DEV_URL_FO, DEV_URL_WR, LOCAL_URL } from "../config/";
|
||||
import { getCookie } from "@common/components/lib/cookie";
|
||||
|
||||
export const fetchType = { COMMON: "common", WR: "wr", LOCAL: "LOCAL" , CS: "CS" };
|
||||
export const fetchType = {
|
||||
COMMON: "common",
|
||||
WR: "wr",
|
||||
LOCAL: "LOCAL",
|
||||
CS: "CS",
|
||||
};
|
||||
|
||||
export const getFetch = async (type: string, url: string) => {
|
||||
const div =
|
||||
type === fetchType.COMMON
|
||||
? DEV_URL_FO
|
||||
: type === fetchType.LOCAL
|
||||
? LOCAL_URL
|
||||
: type === fetchType.CS
|
||||
? ''
|
||||
: DEV_URL_WR;
|
||||
type === fetchType.COMMON
|
||||
? DEV_URL_FO
|
||||
: type === fetchType.LOCAL
|
||||
? LOCAL_URL
|
||||
: type === fetchType.CS
|
||||
? ""
|
||||
: DEV_URL_WR;
|
||||
|
||||
const tokenId = getCookie(AUTH_USER_ID);
|
||||
const Authorization = getCookie(CLAIM_NAME);
|
||||
const response = await fetch(div + url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
accept: "application/json",
|
||||
AUTH_USER_ID: tokenId ?? "",
|
||||
CLAIM_NAME: Authorization ?? "",
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.log(`오류 발생: ${response.status}`);
|
||||
console.log(`오류 발생: ${response.status}`);
|
||||
}
|
||||
const contentType = response.headers.get("content-type") ?? "";
|
||||
|
||||
@@ -41,30 +52,34 @@ export const getFetch = async (type: string, url: string) => {
|
||||
a.download = filename;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(blobUrl);
|
||||
|
||||
|
||||
return null; // 다운로드이므로 반환값 없음
|
||||
}
|
||||
};
|
||||
|
||||
export const getFetchWithCount = async (type: string, url: string) => {
|
||||
const div =
|
||||
type === fetchType.COMMON
|
||||
? DEV_URL_FO
|
||||
: type === fetchType.LOCAL
|
||||
? LOCAL_URL
|
||||
: type === fetchType.CS
|
||||
? ''
|
||||
: DEV_URL_WR;
|
||||
type === fetchType.COMMON
|
||||
? DEV_URL_FO
|
||||
: type === fetchType.LOCAL
|
||||
? LOCAL_URL
|
||||
: type === fetchType.CS
|
||||
? ""
|
||||
: DEV_URL_WR;
|
||||
const tokenId = getCookie(AUTH_USER_ID);
|
||||
const Authorization = getCookie(CLAIM_NAME);
|
||||
|
||||
const response = await fetch(div + url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
accept: "application/json",
|
||||
AUTH_USER_ID: tokenId ?? "",
|
||||
CLAIM_NAME: Authorization ?? "",
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.log(`오류 발생: ${response.status}`);
|
||||
console.log(`오류 발생: ${response.status}`);
|
||||
}
|
||||
|
||||
const contentType = response.headers.get("content-type") ?? "";
|
||||
@@ -73,7 +88,6 @@ export const getFetchWithCount = async (type: string, url: string) => {
|
||||
// JSON 응답 처리
|
||||
const res = await response.json();
|
||||
|
||||
|
||||
return res;
|
||||
} else {
|
||||
// 파일 응답 처리 (ex. PDF, Excel 등)
|
||||
@@ -86,7 +100,7 @@ export const getFetchWithCount = async (type: string, url: string) => {
|
||||
a.download = filename;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(blobUrl);
|
||||
|
||||
|
||||
return null; // 다운로드이므로 반환값 없음
|
||||
}
|
||||
};
|
||||
@@ -94,11 +108,15 @@ export const getFetchWithCount = async (type: string, url: string) => {
|
||||
export const postFectch = async (url: string, params: any, type?: string) => {
|
||||
const div = type === fetchType.COMMON ? DEV_URL_FO : DEV_URL_WR;
|
||||
|
||||
const tokenId = getCookie(AUTH_USER_ID);
|
||||
const Authorization = getCookie(CLAIM_NAME);
|
||||
const response = await fetch(div + url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
AUTH_USER_ID: tokenId ?? "",
|
||||
CLAIM_NAME: Authorization ?? "",
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
});
|
||||
@@ -108,39 +126,25 @@ export const postFectch = async (url: string, params: any, type?: string) => {
|
||||
return await response.json();
|
||||
};
|
||||
|
||||
export const cmsPostFectch = async (url: string, params: any,headers:any) => {
|
||||
const response = fetch(url, {
|
||||
method: "POST",
|
||||
headers:headers ,
|
||||
body: JSON.stringify(params),
|
||||
}).then((res) =>
|
||||
{
|
||||
console.log(' res ' , res)
|
||||
console.log(' access-token ' , res.headers.get('access-token'))
|
||||
console.log(' refresh-token ' , res.headers.get('refresh-token'))
|
||||
console.log(' token-id ' , res.headers.get('token-id'))
|
||||
|
||||
})
|
||||
|
||||
|
||||
return await response;
|
||||
};
|
||||
|
||||
export const putFectch = async (url: string, params: any,type?:string) => {
|
||||
export const putFectch = async (url: string, params: any, type?: string) => {
|
||||
const div =
|
||||
type === fetchType.COMMON
|
||||
? DEV_URL_FO
|
||||
: type === fetchType.LOCAL
|
||||
? LOCAL_URL
|
||||
: type === fetchType.CS
|
||||
? ''
|
||||
: DEV_URL_WR;
|
||||
? ""
|
||||
: DEV_URL_WR;
|
||||
|
||||
const tokenId = getCookie(AUTH_USER_ID);
|
||||
const Authorization = getCookie(CLAIM_NAME);
|
||||
|
||||
const response = await fetch(div + url, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
AUTH_USER_ID: tokenId ?? "",
|
||||
CLAIM_NAME: Authorization ?? "",
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
});
|
||||
@@ -150,25 +154,33 @@ export const putFectch = async (url: string, params: any,type?:string) => {
|
||||
return response;
|
||||
};
|
||||
|
||||
export const deleteFectch = async (url: string, params?: any, type?: string) => {
|
||||
export const deleteFectch = async (
|
||||
url: string,
|
||||
params?: any,
|
||||
type?: string
|
||||
) => {
|
||||
const div =
|
||||
type === fetchType.COMMON
|
||||
? DEV_URL_FO
|
||||
: type === fetchType.LOCAL
|
||||
? LOCAL_URL
|
||||
: type === fetchType.CS
|
||||
? ''
|
||||
: DEV_URL_WR;
|
||||
? ""
|
||||
: DEV_URL_WR;
|
||||
const tokenId = getCookie(AUTH_USER_ID);
|
||||
const Authorization = getCookie(CLAIM_NAME);
|
||||
|
||||
const response = await fetch(div + url, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
AUTH_USER_ID: tokenId ?? "",
|
||||
CLAIM_NAME: Authorization ?? "",
|
||||
},
|
||||
body: params?JSON.stringify(params):undefined,
|
||||
body: params ? JSON.stringify(params) : undefined,
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(`오류 발생: ${response.status}`);
|
||||
}
|
||||
return await response.text();
|
||||
};
|
||||
return await response.text();
|
||||
};
|
||||
|
||||
@@ -34,11 +34,13 @@ export default function HtdflRegForm({
|
||||
isModal,
|
||||
readonly = false,
|
||||
setIsModal,
|
||||
isMap
|
||||
}: {
|
||||
htdflForm: customHtdflBdst;
|
||||
isModal: boolean;
|
||||
readonly?: boolean;
|
||||
setIsModal?: (modal: boolean) => void;
|
||||
isMap?: boolean;
|
||||
}) {
|
||||
const { code, htdflBdstUpdate, htdflBdstReg } = useWrStore((state) => state);
|
||||
const [frontPHdata, setFrontPHdata] = useState("");
|
||||
@@ -140,14 +142,16 @@ export default function HtdflRegForm({
|
||||
|
||||
const [divStyle, setDivStyle] = useState("h-[53vh]");
|
||||
useEffect(() => {
|
||||
if (isModal === true) {
|
||||
setDivStyle("h-[53vh] max-h-[37vh]");
|
||||
if(isMap){
|
||||
setDivStyle("h-[100vh]")
|
||||
}else if (isModal === true) {
|
||||
setDivStyle("h-[53vh] max-h-[37vh]")
|
||||
} else if (readonly === true) {
|
||||
setDivStyle("h-[62vh]");
|
||||
setDivStyle("h-[62vh]")
|
||||
} else {
|
||||
setDivStyle("h-[57vh]")
|
||||
}
|
||||
}, [isModal, readonly]);
|
||||
}, [isModal, readonly ,isMap]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
|
||||
@@ -30,11 +30,13 @@ export default function RainRegForm({
|
||||
isModal,
|
||||
readonly = false,
|
||||
setIsModal,
|
||||
isMap
|
||||
}: {
|
||||
rainForm: customRainBdst;
|
||||
isModal: boolean;
|
||||
setIsModal?: (modal: boolean) => void;
|
||||
readonly?: boolean;
|
||||
isMap?: boolean;
|
||||
}) {
|
||||
const { code, rainBdstReg, rainBdstUpdate } = useWrStore(
|
||||
(state) => state
|
||||
@@ -54,14 +56,16 @@ export default function RainRegForm({
|
||||
|
||||
const [divStyle, setDivStyle] = useState("h-[53vh]");
|
||||
useEffect(() => {
|
||||
if (isModal === true) {
|
||||
if(isMap=== true){
|
||||
setDivStyle("h-[100vh]")
|
||||
}else if (isModal === true) {
|
||||
setDivStyle("h-[53vh] max-h-[37vh]")
|
||||
} else if (readonly === true) {
|
||||
setDivStyle("h-[62vh]")
|
||||
} else {
|
||||
setDivStyle("h-[57vh]")
|
||||
}
|
||||
}, [isModal, readonly]);
|
||||
}, [isModal, readonly ,isMap]);
|
||||
|
||||
const cleanRainData = (raw: any): z.infer<typeof rainZod> => {
|
||||
const buildings =
|
||||
|
||||
@@ -34,25 +34,30 @@ export default function RswtrRegForm({
|
||||
isModal,
|
||||
setIsModal,
|
||||
readonly = false,
|
||||
isMap
|
||||
}: {
|
||||
rswtForm: customRswtBdst;
|
||||
isModal: boolean;
|
||||
setIsModal?: (isModal: boolean) => void;
|
||||
readonly?: boolean;
|
||||
isMap?: boolean;
|
||||
|
||||
}) {
|
||||
const { code, rswtBdstUpdate, rswtBdstReg } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const [divStyle, setDivStyle] = useState("h-[53vh]");
|
||||
useEffect(() => {
|
||||
if (isModal === true) {
|
||||
if(isMap){
|
||||
setDivStyle("h-[100vh]")
|
||||
}else if (isModal === true) {
|
||||
setDivStyle("h-[53vh] max-h-[37vh]")
|
||||
} else if (readonly === true) {
|
||||
setDivStyle("h-[62vh]")
|
||||
} else {
|
||||
setDivStyle("h-[57vh]")
|
||||
}
|
||||
}, [isModal, readonly]);
|
||||
}, [isModal, readonly ,isMap]);
|
||||
// const defaultValues: z.infer<typeof rswtZod> = rswtZod.parse({});
|
||||
|
||||
const form = useForm<z.infer<typeof rswtZod>>({
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
|
||||
import { PbnstSttnModal } from "@/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal";
|
||||
import {
|
||||
Tabs,
|
||||
TabsContent,
|
||||
TabsList,
|
||||
TabsTrigger,
|
||||
} from "@common/components/ui";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
export function RuseDetailPopup({ bscFctCd }: { bscFctCd: string }) {
|
||||
const { ruseMap, getRuseMaplList } = useWrStore((state) => state);
|
||||
const { ruseDetailList } = ruseMap;
|
||||
const [fcltTab, setFcltTab] = useState<string>("");
|
||||
const [isDetail, setIsDetail] = useState<customPbnst>({} as customPbnst);
|
||||
const initRef = useRef<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!initRef.current) {
|
||||
getRuseMaplList(bscFctCd);
|
||||
initRef.current = true;
|
||||
}
|
||||
}, [bscFctCd]);
|
||||
|
||||
useEffect(() => {
|
||||
const detail = ruseDetailList.find(
|
||||
(list) => list.pbnstRuseFcltId === fcltTab
|
||||
);
|
||||
if (detail) setIsDetail(detail);
|
||||
}, [fcltTab, ruseDetailList]);
|
||||
|
||||
useEffect(() => {
|
||||
if (ruseDetailList && ruseDetailList[0]) {
|
||||
setFcltTab(ruseDetailList[0].pbnstRuseFcltId);
|
||||
}
|
||||
}, [ruseDetailList]);
|
||||
|
||||
if (!(ruseDetailList && ruseDetailList[0])) return;
|
||||
return (
|
||||
<div>
|
||||
<Tabs value={fcltTab} onValueChange={setFcltTab}>
|
||||
<TabsList className="mt-4">
|
||||
{ruseDetailList.map((item, index) => {
|
||||
return (
|
||||
<TabsTrigger
|
||||
key={item.pbnstRuseFcltId + index}
|
||||
className="!text-xl"
|
||||
value={item.pbnstRuseFcltId}
|
||||
>
|
||||
{item.ruseUtztnFcltNm}
|
||||
</TabsTrigger>
|
||||
);
|
||||
})}
|
||||
</TabsList>
|
||||
|
||||
<TabsContent className="flex-1 px-4" value={fcltTab}>
|
||||
<PbnstSttnModal data={isDetail} isMap={true} />
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ import { useEffect, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titleVisible?: boolean }) {
|
||||
export function PbnstSttnModal({ data, titleVisible,isMap}: { data: customPbnst; titleVisible?: boolean ,isMap?:boolean}) {
|
||||
const { pbnstSttn, prfmnc, pbnstPrfmncSttn } = useWrStore((state) => state);
|
||||
const [fcltTab, setFcltTab] = useState<string>("fclt");
|
||||
const [ruseTab, setRuseTab] = useState<string>("totalPrf");
|
||||
@@ -252,7 +252,7 @@ export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titl
|
||||
<Title title={"하수재이용 시설 상세정보"} />
|
||||
</>
|
||||
)}
|
||||
<ScrollArea className={"h-[70vh]"}>
|
||||
<ScrollArea className={ isMap==true? "h-[100vh]":"h-[70vh]" }>
|
||||
<PbnstMngForm
|
||||
form={form}
|
||||
formType={"sttn"}
|
||||
|
||||
@@ -15,25 +15,26 @@ import RswtrRegForm from "../../../form/fcltReg/rswtrReg/rswtrRegForm";
|
||||
export default function SttnDetailModal({
|
||||
type,
|
||||
formObj,
|
||||
isMap ,
|
||||
}: {
|
||||
type: string;
|
||||
formObj: any;
|
||||
isMap?: boolean;
|
||||
}) {
|
||||
const { rainSttn, rswtSttn, rainSttnChkSearch } = useWrStore(
|
||||
const { rainSttn, rswtSttn, rainSttnChkSearch } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const [detailData, setDetailData] = useState({
|
||||
head: [] as CommonTableProps[],
|
||||
node:[] as CommonTableProps[],
|
||||
node: [] as CommonTableProps[],
|
||||
data: {} as any,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (type === "RNB" && formObj?.reuseBuilding[0]) {
|
||||
rainSttnChkSearch(formObj.reuseBuilding[0].bdstRuseFcltSn);
|
||||
|
||||
} else if (type === "RST") {
|
||||
// rswtChkPolAndGuide(formObj.reuseBuilding[0].bdstRuseFcltSn)
|
||||
// rswtChkPolAndGuide(formObj.reuseBuilding[0].bdstRuseFcltSn)
|
||||
}
|
||||
}, [type, formObj]);
|
||||
|
||||
@@ -60,61 +61,89 @@ export default function SttnDetailModal({
|
||||
});
|
||||
setDetailData({
|
||||
head: rainSttn.rainSttnDetailHeadList,
|
||||
node:rainSttn.rainSttnDetailNodeList,
|
||||
node: rainSttn.rainSttnDetailNodeList,
|
||||
data: data,
|
||||
});
|
||||
} else if (type === "RST" && rswtSttn.rswtSttnRes) {
|
||||
// const tableTotalData = rswtChkTableData(rswtSttn.rswtSttnRes as unknown as rswtChkZodType[]);
|
||||
|
||||
// setDetailData({
|
||||
// head: rswtSttn.rswtSttHeadList,
|
||||
// node:rswtSttn.rswtSttNodeList,
|
||||
// // data: tableTotalData,
|
||||
// });
|
||||
|
||||
|
||||
// const tableTotalData = rswtChkTableData(rswtSttn.rswtSttnRes as unknown as rswtChkZodType[]);
|
||||
// setDetailData({
|
||||
// head: rswtSttn.rswtSttHeadList,
|
||||
// node:rswtSttn.rswtSttNodeList,
|
||||
// // data: tableTotalData,
|
||||
// });
|
||||
}
|
||||
}, [rainSttn.rainChkRes]);
|
||||
|
||||
useEffect(() =>{
|
||||
setDetailData({data:[] , head:[], node:[]})
|
||||
},[])
|
||||
|
||||
useEffect(() => {
|
||||
setDetailData({ data: [], head: [], node: [] });
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
<div>
|
||||
<Title title={ type === "RNB" ? "빗물이용시설 상세정보"
|
||||
: type === "RST" ? "중수도시설 상세정보"
|
||||
: "온배수시설 상세정보"}></Title>
|
||||
<ScrollArea className={detailData.data.length>0?"h-[80vh]":"h-[70vh]"} >
|
||||
<Title
|
||||
title={
|
||||
type === "RNB"
|
||||
? "빗물이용시설 상세정보"
|
||||
: type === "RST"
|
||||
? "중수도시설 상세정보"
|
||||
: "온배수시설 상세정보"
|
||||
}
|
||||
></Title>
|
||||
<ScrollArea
|
||||
className={isMap ?"h-[100vh]":
|
||||
detailData.data.length > 0
|
||||
? "h-[80vh]"
|
||||
: "h-[70vh]"
|
||||
}
|
||||
>
|
||||
{type === "RNB" ? (
|
||||
<RainRegForm rainForm={formObj as customRainBdst} isModal={false} readonly={true}/>
|
||||
<RainRegForm
|
||||
rainForm={formObj as customRainBdst}
|
||||
isModal={false}
|
||||
readonly={true}
|
||||
isMap={isMap}
|
||||
/>
|
||||
) : type === "RST" ? (
|
||||
<RswtrRegForm rswtForm={formObj as customRswtBdst} isModal={false} readonly={true}/>
|
||||
) : (<HtdflRegForm htdflForm={formObj as customHtdflBdst} isModal={false} readonly={true}/>)}
|
||||
<RswtrRegForm
|
||||
rswtForm={formObj as customRswtBdst}
|
||||
isModal={false}
|
||||
readonly={true}
|
||||
isMap={isMap}
|
||||
/>
|
||||
) : (
|
||||
<HtdflRegForm
|
||||
htdflForm={formObj as customHtdflBdst}
|
||||
isModal={false}
|
||||
readonly={true}
|
||||
isMap={isMap}
|
||||
/>
|
||||
)}
|
||||
|
||||
{detailData.data.length>0?
|
||||
<UiTable
|
||||
headName={
|
||||
type === "RNB" ? "빗물이용시설 상세정보"
|
||||
: type === "RST" ? "중수도시설 상세정보"
|
||||
: "온배수시설 상세정보"
|
||||
}
|
||||
tableData={detailData.data || []}
|
||||
headlist={detailData.head || []}
|
||||
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
onPageChange={function (page: number): void {
|
||||
console.log('page ', page)
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
>
|
||||
<HeadMakeColSpan upHeadList={detailData.node} />
|
||||
</UiTable>:<></>}
|
||||
{detailData.data.length > 0 ? (
|
||||
<UiTable
|
||||
headName={
|
||||
type === "RNB"
|
||||
? "빗물이용시설 상세정보"
|
||||
: type === "RST"
|
||||
? "중수도시설 상세정보"
|
||||
: "온배수시설 상세정보"
|
||||
}
|
||||
tableData={detailData.data || []}
|
||||
headlist={detailData.head || []}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
onPageChange={function (page: number): void {
|
||||
console.log("page ", page);
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
>
|
||||
<HeadMakeColSpan upHeadList={detailData.node} />
|
||||
</UiTable>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</ScrollArea>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user