diff --git a/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js b/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js
index 61b0c4c..d01f468 100644
--- a/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js
+++ b/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js
@@ -1,11 +1,6 @@
import React, { useEffect, useState } from 'react';
-import {
- TodayWeather,
- TomorrowWeahter,
- AfterTomorrowWeahter,
- LastwWeahter
-} from '../../../basis/flight/plan/TodayWeather';
-import { FlightweatherAction } from '../../../../modules/basis/flight/actions/basisFlightAction';
+import { useDispatch, useSelector } from 'react-redux';
+import { object } from 'prop-types';
import {
Card,
CardBody,
@@ -19,22 +14,6 @@ import {
Input,
Table
} from 'reactstrap';
-import dfsxyconv from '../../../../utility/dfsxyconv';
-import { useDispatch, useSelector } from 'react-redux';
-import moment from 'moment';
-
-import {
- Search,
- Compass,
- Sun,
- CloudLightning,
- Cloud,
- CloudRain,
- CloudDrizzle,
- CloudSnow,
- Navigation2
-} from 'react-feather';
-import { object } from 'prop-types';
const FlightPlanAreaDetailForm = ({
handleSave,
handleClose,
@@ -45,131 +24,10 @@ const FlightPlanAreaDetailForm = ({
isDone,
isDisabled
}) => {
- const [dayData, setdayData] = useState({});
-
const coordList = data ? data[0].coordList : null;
const dispatch = useDispatch();
- const { weather } = useSelector(state => state.flightState);
- let now = moment();
- let date = moment().format('YYYYMMDD');
- let time = moment().format('HHmm');
- let plus_day1 = moment().add(1, 'day').format('YYYYMMDD');
- let plus_day2 = moment().add(2, 'day').format('YYYYMMDD');
- useEffect(() => {
- if (weather?.response.body.items) {
- let wheatherobj = {};
- const weatherData = weather.response.body.items?.item;
- //오늘 날씨 필터링
- const todayres = weatherData.filter(
- weatherData => weatherData.fcstDate == date
- );
- const todayData = todayres.filter(todayres => {
- switch (todayres.category) {
- case 'TMP':
- case 'SKY':
- case 'VEC':
- case 'WSD':
- case 'PTY':
- return { ...todayres };
- }
- });
- //내일 날씨 필터링todayres.category == ("TMP" || "SKY" || "VEC" || "WSD" || "PTY")
- const tomorrowres = weatherData.filter(
- weatherData => weatherData.fcstDate == plus_day1
- );
- const tomorrowData = tomorrowres.filter(tomorrowres => {
- switch (tomorrowres.category) {
- case 'TMP':
- case 'SKY':
- case 'VEC':
- case 'WSD':
- case 'PTY':
- return { ...todayres };
- }
- });
- //모레 날씨 필터링
- const afterres = weatherData.filter(
- weatherData => weatherData.fcstDate == plus_day2
- );
- const afterData = afterres.filter(afterres => {
- switch (afterres.category) {
- case 'TMP':
- case 'SKY':
- case 'VEC':
- case 'WSD':
- case 'PTY':
- return { ...todayres };
- }
- });
- wheatherobj = {
- todayData,
- tomorrowData,
- afterData
- };
- setdayData({ ...wheatherobj });
- }
- }, [weather]);
- useEffect(() => {
- if (data[0]?.coordList[0].lat != 0 || data[0]?.coordList[0].lon != 0) {
- let nx = data[0]?.coordList[0].lat;
- let ny = data[0]?.coordList[0].lon;
- const rs = dfsxyconv('toXY', nx, ny);
-
- let now = new Date();
- let hours = now.getHours();
- let minutes = now.getMinutes();
- let basetime = '2300';
- if (hours >= 2 && minutes > 9 && hours <= 5) {
- basetime = '0200';
- } else if (hours >= 5 && minutes > 9 && hours < 8) {
- basetime = '0500';
- } else if (hours <= 8 && minutes < 10) {
- basetime = '0500';
- } else if (hours >= 8 && minutes > 9 && hours < 11) {
- basetime = '0800';
- } else if (hours <= 11 && minutes < 10) {
- basetime = '0800';
- } else if (hours >= 11 && minutes > 9 && hours < 14) {
- basetime = '1100';
- } else if (hours <= 14 && minutes < 10) {
- basetime = '1100';
- } else if (hours >= 14 && minutes > 9 && hours < 17) {
- basetime = '1400';
- } else if (hours <= 17 && minutes < 10) {
- basetime = '1400';
- } else if (hours >= 17 && minutes > 9 && hours < 20) {
- basetime = '1700';
- } else if (hours <= 20 && minutes < 10) {
- basetime = '1700';
- } else if (hours >= 20 && minutes > 9 && hours < 23) {
- basetime = '2000';
- } else if (hours <= 23 && minutes < 10) {
- basetime = '2000';
- } else basetime = '2300';
- const apidata = {
- serviceKey:
- 'r6RMUsk3Vtama7D6uq7MiWV9dTC9MwfIIr4%2F45y0uVNw6BaYbgpKmL%2BLUDFVTfIYUmEe4K%2FaniEjdV9mg5t82Q%3D%3D',
- numOfRows: 1000,
- pageNo: 1,
- dataType: 'JSON',
- base_date: date,
- base_time: basetime,
- nx: rs.x,
- ny: rs.y,
- nx2: nx,
- ny2: ny
- };
- dispatch(FlightweatherAction.request(apidata));
- }
- }, [data]);
-
- const [active, setActive] = useState('active');
- const [activeTab, setActiveTab] = useState('1');
- const toggle = tab => {
- return setActiveTab(tab);
- };
return (
@@ -396,72 +254,6 @@ const FlightPlanAreaDetailForm = ({
닫기
-
- {Object.keys(dayData).length != 0 &&
- data[0]?.coordList[0].lat != 0 ? (
-
-
-
-
-
- 검색하신 지역의 날씨 정보입니다.
-
- {weather.area1 != undefined ?
- `${weather.area1} ${weather.area2} ${weather.area3} ${weather.landNum}` : `선택하신 좌표는 없는 주소입니다.`}
-
-
-
-
- - toggle('1')}
- >
- 오늘
-
- - toggle('2')}
- >
- 내일
-
- - toggle('3')}
- >
- 모레
-
-
-
- {activeTab == 1 ? (
-
-
-
- ) : (
- <>>
- )}
- {activeTab == 2 ? (
-
-
-
- ) : (
- <>>
- )}
- {activeTab == 3 ? (
-
- ) : (
- <>>
- )}
-
-
-
-
- ) : null}
@@ -469,6 +261,6 @@ const FlightPlanAreaDetailForm = ({
);
-};
+}
export default FlightPlanAreaDetailForm;
diff --git a/src/components/basis/flight/plan/FlightPlanAreaMap.js b/src/components/basis/flight/plan/FlightPlanAreaMap.js
index 33a0a06..858954d 100644
--- a/src/components/basis/flight/plan/FlightPlanAreaMap.js
+++ b/src/components/basis/flight/plan/FlightPlanAreaMap.js
@@ -6,7 +6,11 @@ import {
Input,
InputGroup,
InputGroupAddon,
- InputGroupText
+ InputGroupText,
+ Modal,
+ ModalHeader,
+ ModalBody,
+ ModalFooter
} from 'reactstrap';
import { Search } from 'react-feather';
import { useDispatch, useSelector } from 'react-redux';
@@ -19,6 +23,7 @@ import {
AREA_DETAIL_INIT
} from '../../../../modules/basis/flight/actions/basisFlightAction';
import { flightPlanAPI } from '../../../../modules/basis/flight/apis/basisFlightApi';
+import { WeatherContainer } from '../../../../containers/basis/flight/plan/WeatherContainer';
const FlightPlanAreaMap = props => {
const dispatch = useDispatch();
@@ -43,6 +48,7 @@ const FlightPlanAreaMap = props => {
const [number, setNumber] = useState(0);
+ const [formModal, setFormModal] = useState(false);
useEffect(() => {
NaverMapInit();
return () => {
@@ -62,6 +68,7 @@ const FlightPlanAreaMap = props => {
ModeInit();
}, [mapControl.drawType]);
+
useEffect(() => {
if (areaCoordList) {
if (
@@ -209,7 +216,9 @@ const FlightPlanAreaMap = props => {
handleSearch();
}
};
-
+ const handler = () => {
+ setFormModal(!formModal);
+ };
return (
@@ -329,6 +338,7 @@ const FlightPlanAreaMap = props => {
handlerDrawType('RESET')}
// {...props.test? (
// {}
@@ -339,7 +349,35 @@ const FlightPlanAreaMap = props => {
>
초기화
+ {areaCoordList ?
+ areaCoordList[0].coordList[0].lat ? (
+ 날씨
+ ) : null
+ : <>>}
+
+
+ 날씨 정보
+
+
+ 오늘 날짜 기준으로 3일 이내 날짜만 조회 가능합니다.
+
+
+
+
+
+
);
diff --git a/src/components/basis/flight/plan/TodayWeather.js b/src/components/basis/flight/plan/TodayWeather.js
index 0292cda..beb2aad 100644
--- a/src/components/basis/flight/plan/TodayWeather.js
+++ b/src/components/basis/flight/plan/TodayWeather.js
@@ -1,14 +1,4 @@
import {
- Card,
- CardBody,
- Col,
- FormGroup,
- Label,
- Row,
- Button,
- InputGroupAddon,
- InputGroup,
- Input,
Table
} from 'reactstrap';
import {
@@ -22,7 +12,8 @@ import {
CloudSnow,
Navigation2
} from 'react-feather';
-import { mapTypeChangeAction } from '../../../../modules/control/map/actions/controlMapActions';
+
+
export function TodayWeather({ todayData }) {
todayData?.fcstTime?.sort([compareFunction]);
const dayres = todayData?.filter(dayData => {
@@ -39,8 +30,6 @@ export function TodayWeather({ todayData }) {
return { ...dayData?.todayData }
}
});
-
-
// 배열.reduce((누적값, 현잿값, 인덱스, 요소) => { return 결과 }, 초깃값);
const groupValues = dayres.reduce((acc, current) => {
acc[current.fcstTime] = acc[current.fcstTime] || [];
diff --git a/src/containers/basis/flight/plan/WeatherContainer.js b/src/containers/basis/flight/plan/WeatherContainer.js
new file mode 100644
index 0000000..131ef83
--- /dev/null
+++ b/src/containers/basis/flight/plan/WeatherContainer.js
@@ -0,0 +1,215 @@
+import {
+ TodayWeather,
+ TomorrowWeahter,
+ AfterTomorrowWeahter,
+ LastwWeahter
+} from "../../../../components/basis/flight/plan/TodayWeather"
+import React, { useEffect, useState } from 'react';
+import { useDispatch, useSelector } from 'react-redux';
+import dfsxyconv from '../../../../utility/dfsxyconv';
+import moment from 'moment';
+import {
+ Compass
+} from 'react-feather';
+import { FlightweatherAction } from '../../../../modules/basis/flight/actions/basisFlightAction';
+
+export function WeatherContainer({ mapAreaCoordList }) {
+
+ const [dayData, setdayData] = useState({});
+
+ const dispatch = useDispatch();
+ const { weather } = useSelector(state => state.flightState);
+ let now = moment();
+ let date = moment().format('YYYYMMDD');
+ let time = moment().format('HHmm');
+ let plus_day1 = moment().add(1, 'day').format('YYYYMMDD');
+ let plus_day2 = moment().add(2, 'day').format('YYYYMMDD');
+ useEffect(() => {
+ if (weather?.response.body.items) {
+ let wheatherobj = {};
+ const weatherData = weather.response.body.items?.item;
+ //오늘 날씨 필터링
+ const todayres = weatherData.filter(
+ weatherData => weatherData.fcstDate == date
+ );
+ const todayData = todayres.filter(todayres => {
+ switch (todayres.category) {
+ case 'TMP':
+ case 'SKY':
+ case 'VEC':
+ case 'WSD':
+ case 'PTY':
+ return { ...todayres };
+ }
+ });
+ //내일 날씨 필터링todayres.category == ("TMP" || "SKY" || "VEC" || "WSD" || "PTY")
+ const tomorrowres = weatherData.filter(
+ weatherData => weatherData.fcstDate == plus_day1
+ );
+ const tomorrowData = tomorrowres.filter(tomorrowres => {
+ switch (tomorrowres.category) {
+ case 'TMP':
+ case 'SKY':
+ case 'VEC':
+ case 'WSD':
+ case 'PTY':
+ return { ...todayres };
+ }
+ });
+ //모레 날씨 필터링
+ const afterres = weatherData.filter(
+ weatherData => weatherData.fcstDate == plus_day2
+ );
+ const afterData = afterres.filter(afterres => {
+ switch (afterres.category) {
+ case 'TMP':
+ case 'SKY':
+ case 'VEC':
+ case 'WSD':
+ case 'PTY':
+ return { ...todayres };
+ }
+ });
+ wheatherobj = {
+ todayData,
+ tomorrowData,
+ afterData
+ };
+ setdayData({ ...wheatherobj });
+ }
+ }, [weather]);
+ useEffect(() => {
+ if (mapAreaCoordList[0]?.coordList[0].lat != 0 || mapAreaCoordList[0]?.coordList[0].lon != 0) {
+ let nx = mapAreaCoordList[0]?.coordList[0].lat;
+ let ny = mapAreaCoordList[0]?.coordList[0].lon;
+ const rs = dfsxyconv('toXY', nx, ny);
+
+ let now = new Date();
+ let hours = now.getHours();
+ let minutes = now.getMinutes();
+ let basetime = '2300';
+
+ if (hours >= 2 && minutes > 9 && hours <= 5) {
+ basetime = '0200';
+ } else if (hours >= 5 && minutes > 9 && hours < 8) {
+ basetime = '0500';
+ } else if (hours <= 8 && minutes < 10) {
+ basetime = '0500';
+ } else if (hours >= 8 && minutes > 9 && hours < 11) {
+ basetime = '0800';
+ } else if (hours <= 11 && minutes < 10) {
+ basetime = '0800';
+ } else if (hours >= 11 && minutes > 9 && hours < 14) {
+ basetime = '1100';
+ } else if (hours <= 14 && minutes < 10) {
+ basetime = '1100';
+ } else if (hours >= 14 && minutes > 9 && hours < 17) {
+ basetime = '1400';
+ } else if (hours <= 17 && minutes < 10) {
+ basetime = '1400';
+ } else if (hours >= 17 && minutes > 9 && hours < 20) {
+ basetime = '1700';
+ } else if (hours <= 20 && minutes < 10) {
+ basetime = '1700';
+ } else if (hours >= 20 && minutes > 9 && hours < 23) {
+ basetime = '2000';
+ } else if (hours <= 23 && minutes < 10) {
+ basetime = '2000';
+ } else basetime = '2300';
+
+ const apidata = {
+ serviceKey:
+ 'r6RMUsk3Vtama7D6uq7MiWV9dTC9MwfIIr4%2F45y0uVNw6BaYbgpKmL%2BLUDFVTfIYUmEe4K%2FaniEjdV9mg5t82Q%3D%3D',
+ numOfRows: 1000,
+ pageNo: 1,
+ dataType: 'JSON',
+ base_date: date,
+ base_time: basetime,
+ nx: rs.x,
+ ny: rs.y,
+ nx2: nx,
+ ny2: ny
+ };
+ dispatch(FlightweatherAction.request(apidata));
+ }
+ }, [mapAreaCoordList]);
+
+
+ const [active, setActive] = useState('active');
+ const [activeTab, setActiveTab] = useState('1');
+ const toggle = tab => {
+ return setActiveTab(tab);
+ };
+
+ return (
+
+
+
+ {Object.keys(dayData).length != 0 &&
+ mapAreaCoordList[0]?.coordList[0].lat != 0 ? (
+
+
+
+
+ 검색하신 지역의 날씨 정보입니다.
+
+ {weather.area1 != undefined ?
+ `${weather.area1} ${weather.area2} ${weather.area3} ${weather.landNum}` : `선택하신 좌표는 없는 주소입니다.`}
+
+
+
+
+ - toggle('1')}
+ >
+ 오늘
+
+ - toggle('2')}
+ >
+ 내일
+
+ - toggle('3')}
+ >
+ 모레
+
+
+
+ {activeTab == 1 ? (
+
+
+
+ ) : (
+ <>>
+ )}
+ {activeTab == 2 ? (
+
+
+
+ ) : (
+ <>>
+ )}
+ {activeTab == 3 ? (
+
+ ) : (
+ <>>
+ )}
+
+
+
+ ) : null}
+
+
+ )
+}
+export default WeatherContainer;