From e0bdf0345563c486878ccb8845b7b601c306303d Mon Sep 17 00:00:00 2001 From: junh_eee Date: Fri, 16 Sep 2022 17:35:55 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=84=ED=96=89=EA=B3=84=ED=9A=8D=EC=84=9C?= =?UTF-8?q?=20-=20=EC=A7=80=EB=8F=84=20=EA=B2=80=EC=83=89=20API=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/css/custom.css | 10 ++- .../basis/flight/plan/FlightPlanAreaMap.js | 89 +++++++++++-------- .../basis/flight/actions/basisFlightAction.ts | 12 ++- .../basis/flight/apis/basisFlightApi.ts | 4 + .../basis/flight/sagas/basisFlightSaga.ts | 14 +++ 5 files changed, 88 insertions(+), 41 deletions(-) diff --git a/src/assets/css/custom.css b/src/assets/css/custom.css index e9c9905..72230ff 100644 --- a/src/assets/css/custom.css +++ b/src/assets/css/custom.css @@ -251,15 +251,17 @@ h1.logo span{display:block;color:#f4f4f4;font-weight:bold;letter-spacing:2px;fon .left-menu-nav .test .btn-use{margin-left:20px; width: 35px; height: 35px; display: block; border: 0px solid transparent; box-sizing: content-box !important; background-color: #009cad;} .measure-control{position:absolute; z-index:100;} -.area-button{position:relative; z-index:100; margin-top:10px; margin-left:10px;} -.area-input{position:relative; z-index:100; margin-top:10px; margin-left:10px;width:200px;} + +/* 지도 안에 버튼들 관리 */ +.area-input{margin-top:10px; margin-left:10px;width:200px;} +.area-button{margin-top:10px; margin-left:10px;} +.map-comp{position:relative; z-index:100;display:flex;} + .control-btn{margin-left: 7px; border-bottom: solid 1px #283046; margin-bottom:5px;} .buffer-input{text-align: center; border-radius: 100px; border: 1px solid #283046; width: 70px; margin-left: 5px;} .buffer-btn{text-align: center; border-radius: 100px; border: 1px solid #283046; width: 30px; margin-left: 5px;} - - /*메인-알림*/ .notice{width:650px;height:45px;overflow:hidden;position:absolute;left:50%;top:20px;transform: translate(-50%,0px);background:#283046;display:flex;font-size:0.9375rem;color:#f4f4f4;padding:0px 20px;border-radius:30px;} .notice-icon{padding:10px 0;} diff --git a/src/components/basis/flight/plan/FlightPlanAreaMap.js b/src/components/basis/flight/plan/FlightPlanAreaMap.js index 1bc19de..8eb4208 100644 --- a/src/components/basis/flight/plan/FlightPlanAreaMap.js +++ b/src/components/basis/flight/plan/FlightPlanAreaMap.js @@ -9,6 +9,7 @@ import { import { FlightPlanDraw } from '../../../map/naver/draw/FlightPlanDraw'; import { initFlightBas } from '../../../../modules/basis/flight/models/basisFlightModel'; import { AREA_COORDINATE_LIST_SAVE } from '../../../../modules/basis/flight/actions/basisFlightAction'; +import {flightPlanAPI} from '../../../../modules/basis/flight/apis/basisFlightApi' const FlightPlanAreaMap = props => { const dispatch = useDispatch(); @@ -24,7 +25,7 @@ const FlightPlanAreaMap = props => { initFlightBas.initDetail.areaList ); - const [searchData, setSearchData] = useState(); + const [query, setQuery] = useState(); useEffect(() => { NaverMapInit(); @@ -135,15 +136,16 @@ const FlightPlanAreaMap = props => { setMapAreaCoordList(areaList); }; - const handleSearch = () => { - // console.log(searchData, 'encoding'); - }; + const handleSearch = async() => { + const res = await flightPlanAPI.searchArea({query: query}); + console.log(res.data.items, '<<<') + } const handleChange = e => { const { name, value } = e.target; if (name == 'searchInput') { - setSearchData(encodeURI(value)); + setQuery(value); } }; @@ -173,37 +175,39 @@ const FlightPlanAreaMap = props => { /> ) : null} - handlerDrawType('RESET')} - // {...props.test? ( - // {} - // ):( - // {disabled:false} - // )} - disabled={props.test} - > - 초기화 - - - - 검색 - +
+ + + 검색 + + {/* handlerDrawType('RESET')} + // {...props.test? ( + // {} + // ):( + // {disabled:false} + // )} + disabled={props.test} + size='sm' + > + 초기화 + */} +
@@ -229,12 +233,25 @@ const FlightPlanAreaMap = props => { Circle handlerDrawType('POLYGON')} disabled={props.test} > Polygon + handlerDrawType('RESET')} + // {...props.test? ( + // {} + // ):( + // {disabled:false} + // )} + disabled={props.test} + > + 초기화 + diff --git a/src/modules/basis/flight/actions/basisFlightAction.ts b/src/modules/basis/flight/actions/basisFlightAction.ts index a613657..1d4d406 100644 --- a/src/modules/basis/flight/actions/basisFlightAction.ts +++ b/src/modules/basis/flight/actions/basisFlightAction.ts @@ -87,6 +87,15 @@ const FLIGHT_APRV_PROC_REQUEST = 'basis/flight/aprv/proc/FLIGHT_APRV_PROC_REQUES const FLIGHT_APRV_PROC_SUCCESS = 'basis/flight/aprv/proc/FLIGHT_APRV_PROC_SUCCESS'; const FLIGHT_APRV_PROC_FAILURE = 'basis/flight/aprv/proc/FLIGHT_APRV_PROC_FAILURE'; +//지도 검색 +const FLIGHT_SEARCH_AREA_REQUEST = 'basis/flight/search/area/FLIGHT_SEARCH_AREA_REQUEST'; +const FLIGHT_SEARCH_AREA_SUCCESS = 'basis/flight/search/area/FLIGHT_SEARCH_AREA_SUCCESS'; +const FLIGHT_SEARCH_AREA_FAILURE = 'basis/flight/search/area/FLIGHT_SEARCH_AREA_FAILURE'; +export const SEARCH_AREA = createAsyncAction( + FLIGHT_SEARCH_AREA_REQUEST, + FLIGHT_SEARCH_AREA_SUCCESS, + FLIGHT_SEARCH_AREA_FAILURE +)<{query: string}, string, AxiosError>(); export const PUBLIC_AREA_LIST = createAsyncAction( PUBLIC_AREA_LIST_REQUEST, @@ -206,7 +215,8 @@ const actions = { FLIGHT_PLAN_AREA_BUFFER_LIST, AREA_DETAIL_INIT, FLIGHT_APRV_LIST, - FLIGHT_APRV_PROC + FLIGHT_APRV_PROC, + SEARCH_AREA }; export type FlightAction = ActionType; diff --git a/src/modules/basis/flight/apis/basisFlightApi.ts b/src/modules/basis/flight/apis/basisFlightApi.ts index 2523ec7..7a97abc 100644 --- a/src/modules/basis/flight/apis/basisFlightApi.ts +++ b/src/modules/basis/flight/apis/basisFlightApi.ts @@ -66,5 +66,9 @@ export const flightPlanAPI = { const res = await axios.put(`api/bas/flight/aprv/proc`, data); return res; }, + + searchArea: async(param) => { + return await axios.get(`api/bas/flight/plan/area/search?query=${param.query}`); + } } diff --git a/src/modules/basis/flight/sagas/basisFlightSaga.ts b/src/modules/basis/flight/sagas/basisFlightSaga.ts index 001760e..658573f 100644 --- a/src/modules/basis/flight/sagas/basisFlightSaga.ts +++ b/src/modules/basis/flight/sagas/basisFlightSaga.ts @@ -406,6 +406,19 @@ function* aprvProcSaga(action: ActionType +) { + try{ + const { query } = action.payload; + + const res = yield call(Apis.flightPlanAPI.searchArea, { query }); + yield put(Actions.SEARCH_AREA.success(res)); + } catch (error) { + yield put(Actions.SEARCH_AREA.failure(error)); + } +} + export function* flightSaga() { yield takeEvery(Actions.PUBLIC_AREA_LIST.request, listAreaSaga); // yield takeEvery(Actions.FLIGHT_PLAN_AREA.request, createFlightPlanArea); @@ -419,4 +432,5 @@ export function* flightSaga() { yield takeEvery(Actions.FLIGHT_PLAN_AREA_BUFFER_LIST.request, listBuffer) yield takeEvery(Actions.FLIGHT_APRV_LIST.request, listAprvSaga) yield takeEvery(Actions.FLIGHT_APRV_PROC.request, aprvProcSaga) + yield takeEvery(Actions.SEARCH_AREA.request, searchAreaSaga) }