비행승인 신청 검토결과 현황
diff --git a/src/components/flight/FlightApprovalsTable.js b/src/components/flight/FlightApprovalsTable.js
index f7679f95..002f738f 100644
--- a/src/components/flight/FlightApprovalsTable.js
+++ b/src/components/flight/FlightApprovalsTable.js
@@ -23,7 +23,6 @@ export default function FlightApprovalsTable(props) {
// 행 토글
const [expandedRows, setExpandedRows] = useState({});
- console.log('>>', expandedRows);
// 승인, 미승인, 비대상 건수 계산
useEffect(() => {
resApprovalCd();
@@ -364,16 +363,12 @@ export default function FlightApprovalsTable(props) {
// 테이블 내부 행 클릭 이벤트
const handleInRowClick = row => {
- console.log('>>', row);
-
handlerOpenModal(row.approvalCd, row.fltElev, row.fltElevMax);
props.handlerDetail(row);
};
// 테이블 행 클릭 이벤트
const handleRowClick = row => {
- console.log('>>', row);
-
handlerOpenModal(
row.areaList[0].approvalCd,
row.areaList[0].fltElev,
diff --git a/src/containers/flight/flightApprovalsContainer.js b/src/containers/flight/flightApprovalsContainer.js
index f618c5b8..1d285189 100644
--- a/src/containers/flight/flightApprovalsContainer.js
+++ b/src/containers/flight/flightApprovalsContainer.js
@@ -25,7 +25,7 @@ import { setLogout } from '@src/redux/features/account/auth/authThunk';
import WebsocketClient from '../../components/websocket/WebsocketClient';
import { clientDispatchTopMenu } from '@src/redux/features/layout/layoutSlice';
-export default function FlightApprovalsContainer() {
+export default function FlightApprovalsContainer({ mode }) {
const dispatch = useDispatch();
const history = useHistory();
@@ -48,6 +48,10 @@ export default function FlightApprovalsContainer() {
const { laancAprvList } = useSelector(state => state.laancState);
const map = useSelector(state => state.mapState.map);
+ // popup
+ const [isPopup, setIsPopup] = useState(false);
+ const [popup, setPopup] = useState(null);
+ const popupRef = useRef(null);
const previewGeo2 = {
type: 'FeatureCollection',
@@ -66,20 +70,113 @@ export default function FlightApprovalsContainer() {
}, []);
useEffect(() => {
- if (areaCoordList.length != 0) {
+ if (areaCoordList.length !== 0) {
handlerPreviewDraw();
}
}, [areaCoordList]);
useEffect(() => {
if (map) {
- setMapObject(map);
+ window._mapbox = map;
+ let mapInstance = mode === 'container' ? map : window.opener._mapbox;
+ setMapObject(mapInstance);
}
}, [map]);
- useEffect(async () => {
- if (areaCoordList.length === 0) return;
- }, [areaCoordList]);
+ useEffect(() => {
+ const childMessage = e => {
+ if (e.data.type) {
+ const { type } = e.data;
+ const { payload } = e.data;
+ console.log(payload);
+ switch (type) {
+ case 'initalState':
+ popupRef.current.postMessage({
+ type: 'initalState',
+ payload: {
+ filter,
+ selected,
+ startDate,
+ endDate
+ }
+ });
+
+ return;
+ case 'search':
+ const { search, searchDate, filterArea } = payload;
+
+ handlerSearch(search, searchDate, filterArea);
+ return;
+ case 'detail':
+ const { area } = payload;
+ handlerDetail(area);
+ return;
+ case 'closedSync':
+ popupRef.current.close();
+ // localStorage.removeItem('popupState');
+ return;
+ default:
+ break;
+ }
+ }
+ };
+ let timer;
+ if (popup) {
+ timer = setInterval(() => {
+ if (popup.closed) {
+ setIsPopup(false);
+ clearInterval(timer);
+ }
+ }, 1000); // 1초마다 체크
+ }
+ window.addEventListener('message', childMessage);
+
+ return () => {
+ clearInterval(timer);
+ window.removeEventListener('message', childMessage);
+ };
+ }, [popup]);
+
+ useEffect(() => {
+ const handleBeforeUnload = e => {
+ localStorage.removeItem('persist:root');
+
+ if (popupRef.current) {
+ popupRef.current.close();
+ }
+ };
+
+ window.addEventListener('beforeunload', handleBeforeUnload);
+
+ return () => {
+ window.removeEventListener('beforeunload', handleBeforeUnload);
+ };
+ }, []);
+
+ const handleDragEnd = e => {
+ setIsPopup(true);
+ const el = document.querySelector('.flight-approval-layer');
+
+ const popupWidth = el.offsetWidth; // 팝업의 너비
+ const popupHeight = el.offsetHeight; // 팝업의 너비
+ // const popupX = window.screenX + window.outerWidth - e.clientX; // 오른쪽 끝에 띄우기
+ // const popupY = Math.round(
+ // window.screenY + window.outerHeight / 2 - popupHeight / 2
+ // );
+
+ const popupX =
+ window.screenX +
+ (window.outerWidth - popupWidth) / 2 +
+ e.clientX -
+ window.innerWidth / 2; // 드래그 끝나는 지점
+ const popupY = Math.round(
+ window.screenY + window.outerHeight / 2 - popupHeight / 2
+ );
+ const option = `width=${popupWidth},height=${popupHeight},left=${popupX},top=${popupY}`;
+ popupRef.current = window.open('/rightMenu', 'NewWindow', option);
+ // setPopupOption(option);
+ setPopup(popupRef.current);
+ };
const handlerSearch = (search, searchDate, filterArea) => {
setStartDate(searchDate.startDate);
@@ -116,7 +213,14 @@ export default function FlightApprovalsContainer() {
);
}
// );
+
setFilter(search);
+ if (popup) {
+ popupRef.current.postMessage({
+ type: 'handlerSearchRs',
+ payload: { search }
+ });
+ }
};
const handlerDetail = area => {
@@ -128,27 +232,30 @@ export default function FlightApprovalsContainer() {
};
const handlerMapInit = () => {
- if (map.getSource('preview')) {
+ let mapInstance = mode === 'container' ? map : window.opener._mapbox;
+
+ if (mapInstance.getSource('preview')) {
} else {
- map.addSource('preview', {
+ mapInstance.addSource('preview', {
type: 'geojson',
data: previewGeo2
});
- map.addLayer(flightlayerWayPoint('preview'));
- map.addLayer(flightlayerBuffer('preview'));
- map.addLayer(flightlayerPolygon('preview'));
- map.addLayer(flightlayerPolyline('preview'));
+ mapInstance.addLayer(flightlayerWayPoint('preview'));
+ mapInstance.addLayer(flightlayerBuffer('preview'));
+ mapInstance.addLayer(flightlayerPolygon('preview'));
+ mapInstance.addLayer(flightlayerPolyline('preview'));
}
dispatch(clientSetIsMapLoading(true));
- const preview = map.getSource('preview');
+ const preview = mapInstance.getSource('preview');
if (preview) setPreviewLayer(preview);
setIsMapLoading(true);
- setMapObject(map);
- dispatch(clientMapInit(map));
+ setMapObject(mapInstance);
+
+ dispatch(clientMapInit(mapInstance));
};
const handlerPreviewDraw = () => {
if (areaCoordList.length > 0) {
@@ -190,53 +297,61 @@ export default function FlightApprovalsContainer() {
return (
<>
-
-
-
- UTM
-
-
- -
-