From 203ca306072eaeb8281216ef30279ce93172bcc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?scnoh=28=EB=85=B8=EC=8A=B9=EC=B2=A0=29?= Date: Mon, 1 Aug 2022 16:21:05 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A1=B0=EC=A2=85=EC=82=AC,=20=EA=B8=B0?= =?UTF-8?q?=EC=B2=B4=20=EC=A1=B0=ED=9A=8C=20=EC=82=AD=EC=A0=9C=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basis/flight/plan/FlightPlanArcrft.js | 28 +------- .../basis/flight/plan/FlightPlanForm.js | 52 ++++++++++++-- .../basis/flight/plan/FlightPlanPilot.js | 71 ++++++------------- .../flight/plan/FlightPlanDetailContainer.js | 24 ++++++- .../flight/plan/FlightPlanPilotContainer.js | 2 +- .../flight/reducers/basisFlightReducer.ts | 2 +- 6 files changed, 91 insertions(+), 88 deletions(-) diff --git a/src/components/basis/flight/plan/FlightPlanArcrft.js b/src/components/basis/flight/plan/FlightPlanArcrft.js index a8de3bbb..36fa21a2 100644 --- a/src/components/basis/flight/plan/FlightPlanArcrft.js +++ b/src/components/basis/flight/plan/FlightPlanArcrft.js @@ -45,31 +45,7 @@ const FlightPlanArcrft = ({ arcrftList, handleSelectArcrft }) => {
-
-
-
그룹 명
-
-
- - - - - - - - -
-
-
+
소유자 명
@@ -83,7 +59,7 @@ const FlightPlanArcrft = ({ arcrftList, handleSelectArcrft }) => { name='ownerNm' // value={props.params.groupNm} // onChange={props.handlerInput} - size='sm' + bsSize='sm' // onKeyPress={props.onKeyPress} placeholder='소유자 명을 입력하세요' /> diff --git a/src/components/basis/flight/plan/FlightPlanForm.js b/src/components/basis/flight/plan/FlightPlanForm.js index 60a04fc5..1ef265e3 100644 --- a/src/components/basis/flight/plan/FlightPlanForm.js +++ b/src/components/basis/flight/plan/FlightPlanForm.js @@ -17,9 +17,10 @@ import FlightPlanPilotContainer from '../../../../containers/basis/flight/plan/F import { FlightPlanModal } from './FlightPlanModal'; import FlightPlanArcrftContainer from '../../../../containers/basis/flight/plan/FlightPlanArcrftContainer'; import FlightPlanAreaContainer from '../../../../containers/basis/flight/plan/FlightPlanAreaContainer'; +import { X } from 'react-feather'; -const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDelete, modal}) => { +const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => { const {areaList, pilotList, arcrftList} = data; return ( @@ -275,7 +276,8 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele ) + handleChange={handleChange} + handleDeleteArray ={handleDeleteArray}/>) : }
@@ -296,7 +298,9 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele ) + handleChange={handleChange} + handleDeleteArray ={handleDeleteArray}/>) + : } @@ -512,13 +516,13 @@ const AreaForm = ({data, handleChange, index}) => {
) } -const PilotForm = ({data, handleChange, index}) => { +const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { return (
{ /> + {index !== 0 ? + + + handleDeleteArray({ type: 'pilot', index }) + } + outline + > + + 삭제 + + + : + null + }
) } -const ArcrftForm = ({data, handleChange, index}) => { +const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { return (
{ /> + {index !== 0 ? + + + handleDeleteArray({ type: 'arcrft', index }) + } + outline + > + + 삭제 + + + : + null + }
) } diff --git a/src/components/basis/flight/plan/FlightPlanPilot.js b/src/components/basis/flight/plan/FlightPlanPilot.js index 9e4f1142..bd389999 100644 --- a/src/components/basis/flight/plan/FlightPlanPilot.js +++ b/src/components/basis/flight/plan/FlightPlanPilot.js @@ -44,31 +44,7 @@ const FlightPlanPilot = ({ pilotList, handleSelectPilot }) => {
-
-
-
그룹 명
-
-
- - - - - - - - -
-
-
+
성명
@@ -82,7 +58,7 @@ const FlightPlanPilot = ({ pilotList, handleSelectPilot }) => { name='memberName' // value={props.params.groupNm} // onChange={props.handlerInput} - size='sm' + bsSize='sm' // onKeyPress={props.onKeyPress} placeholder='성명을 입력하세요' /> @@ -102,31 +78,26 @@ const FlightPlanPilot = ({ pilotList, handleSelectPilot }) => {
-
- - -
-
-

조종사 목록

- 검색결과 총 {!!pilotList ? pilotList.length : 0}건 -
-
-
- -
- - {/* 검색된 데이터가 없습니다. */} -
-
+
+
+
+

조종사 목록

+ 검색결과 총 {!!pilotList ? pilotList.length : 0}건 +
+
+
+
+ +
+
- - +
+
) diff --git a/src/containers/basis/flight/plan/FlightPlanDetailContainer.js b/src/containers/basis/flight/plan/FlightPlanDetailContainer.js index 51e250b0..f27539b8 100644 --- a/src/containers/basis/flight/plan/FlightPlanDetailContainer.js +++ b/src/containers/basis/flight/plan/FlightPlanDetailContainer.js @@ -37,7 +37,7 @@ const FlightPlanDetailContainer = () => { }, [detail]) useEffect(() => { - if(pilotSelect !== undefined) { + if(pilotSelect !== undefined) { const pilotList = detailData.pilotList.concat(); const pilot = Object.assign({}, initFlightBas['pilot']); @@ -291,14 +291,32 @@ const FlightPlanDetailContainer = () => { break; case 'area': case 'pilot': - case 'arcrft': setDetailData(prevState => { - const arr = [...prevState[type]]; + const arr = [...prevState[arrName]]; const deleteData = arr.splice(index, 1); + return { ...prevState, [arrName]: arr + } + }) + case 'arcrft': + setDetailData(prevState => { + const arr = [...prevState[arrName]]; + const deleteData = arr.splice(index, 1); + + if(arr.length > 0) { + return { + ...prevState, + [arrName]: arr + } + } else { + return { + ...prevState, + ['pilotList']: initFlightBas[arrName] + } } + }) default: break; diff --git a/src/containers/basis/flight/plan/FlightPlanPilotContainer.js b/src/containers/basis/flight/plan/FlightPlanPilotContainer.js index 2664463f..fa8725ab 100644 --- a/src/containers/basis/flight/plan/FlightPlanPilotContainer.js +++ b/src/containers/basis/flight/plan/FlightPlanPilotContainer.js @@ -34,7 +34,7 @@ const FlightPlanPilotContainer = ({handleModal, type}) => { + /> ) } diff --git a/src/modules/basis/flight/reducers/basisFlightReducer.ts b/src/modules/basis/flight/reducers/basisFlightReducer.ts index d9c4d968..1f47a098 100644 --- a/src/modules/basis/flight/reducers/basisFlightReducer.ts +++ b/src/modules/basis/flight/reducers/basisFlightReducer.ts @@ -72,7 +72,7 @@ export const flightReducer = createReducer(in draft.arcrftSelect = undefined; draft.pilotSelect = undefined; draft.areaList = undefined; - draft.areaCoordList = undefined; + // draft.areaCoordList = undefined; }) ) // 비행 구역 좌표 저장