diff --git a/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js b/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js index 78b632a..6b1b483 100644 --- a/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js +++ b/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js @@ -10,11 +10,11 @@ import { Button } from 'reactstrap'; -const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handleBufferList, data, mapControl}) => { +const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handleBufferList, data, mapControl, test }) => { - const coordList = data ? data[0].coordList : null; + const coordList = data ? data[0].coordList : null; - return ( + return ( @@ -25,7 +25,7 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl

비행 구역 상세 정보

-
+
@@ -36,16 +36,16 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
- {coordList ? + {coordList ? coordList.map((coord, idx) => { const latlon = coord.lat + ' / ' + coord.lon; return ( - + ) }) - : + : - } - + } + -
+
@@ -83,62 +83,94 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
- +
- - { - const {name, value} = e.target; - handleChange({ - name, - value - }) - }} - /> + + {test ? + { + const { name, value } = e.target; + handleChange({ + name, + value + }) + }} + /> + : + { + const { name, value } = e.target; + handleChange({ + name, + value + }) + }} + /> + }
- handleBufferList()} - > - 적용 - -
-
- + {test ? + handleBufferList()} + > + 적용 + + : + handleBufferList()} + > + 적용 + + } +
+ +
- - + + + { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ name, value }) }} - /> + /> @@ -149,14 +181,15 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ name, value @@ -172,15 +205,28 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
- handleSave()} - disabled={!coordList[0].lat ? true : false } - > - 등록 - + {test ? + handleSave()} + + disabled={test} + > + 등록 + + : + handleSave()} + disabled={!coordList[0].lat ? true : false} + > + 등록 + + } - + ) } diff --git a/src/components/basis/flight/plan/FlightPlanAreaMap.js b/src/components/basis/flight/plan/FlightPlanAreaMap.js index 9444bf7..836760e 100644 --- a/src/components/basis/flight/plan/FlightPlanAreaMap.js +++ b/src/components/basis/flight/plan/FlightPlanAreaMap.js @@ -171,11 +171,12 @@ const FlightPlanAreaMap = (props) => { color='primary' className='area-button' onClick={e => handlerDrawType('RESET')} - {...props.test? ( - {} - ):( - {disabled:true} - )} + // {...props.test? ( + // {} + // ):( + // {disabled:false} + // )} + disabled={props.test} > 초기화 @@ -192,6 +193,7 @@ const FlightPlanAreaMap = (props) => { className='mr-1' color='primary' onClick={e => handlerDrawType('LINE')} + disabled={props.test} > WayPoint @@ -199,12 +201,14 @@ const FlightPlanAreaMap = (props) => { className='mr-1' color='primary' onClick={e => handlerDrawType('CIRCLE')} + disabled={props.test} > Circle handlerDrawType('POLYGON')} + disabled={props.test} > Polygon diff --git a/src/components/basis/flight/plan/FlightPlanForm.js b/src/components/basis/flight/plan/FlightPlanForm.js index 7ddf9bc..3a230d3 100644 --- a/src/components/basis/flight/plan/FlightPlanForm.js +++ b/src/components/basis/flight/plan/FlightPlanForm.js @@ -12,7 +12,7 @@ import { import Flatpickr from 'react-flatpickr'; import '@styles/react/libs/flatpickr/flatpickr.scss'; import moment from 'moment'; -import {initFlight, initFlightBas} from '../../../../modules/basis/flight/models/basisFlightModel'; +import { initFlight, initFlightBas } from '../../../../modules/basis/flight/models/basisFlightModel'; import FlightPlanPilotContainer from '../../../../containers/basis/flight/plan/FlightPlanPilotContainer'; import { FlightPlanModal } from './FlightPlanModal'; import FlightPlanArcrftContainer from '../../../../containers/basis/flight/plan/FlightPlanArcrftContainer'; @@ -22,49 +22,47 @@ import { useSelector } from 'react-redux'; import { shallowEqual } from 'react-redux'; -const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => { - const {areaList, pilotList, arcrftList} = data; +const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => { + const { areaList, pilotList, arcrftList } = data; - const { detail } = useSelector(state => state.flightState); - const [date ,setDate] = useState(); - const [isFlightDone, setIsFlightDone] = useState(); + const [date, setDate] = useState(); + const [isFlightDone, setIsFlightDone] = useState(); - const [test, setTest] = useState(); - const { user } = useSelector(state => state.authState, shallowEqual); + const [test, setTest] = useState(); + const { user } = useSelector(state => state.authState, shallowEqual); + const { detail } = useSelector(state => state.flightState); - useEffect(() => { - if(detail.createDt) { - setDate(detail.schFltStDt); - } + useEffect(() => { + if (detail.createDt) { + setDate(detail.schFltStDt); + } - if(detail?.createUserId == user?.cstmrSno) { - // console.log(true) - setTest(true) - } else { - // console.log(false) - setTest(false) - } - console.log(detail.createUserId, '생성') - console.log(user.cstmrSno, '로그인') - }, [detail]) - - useEffect(() => { - setDate(''); - }, []) - - useEffect(() => { - if(date) { - let cTime = new Date(); - let pTime = new Date(date) - if(cTime > pTime) { - setIsFlightDone(true); - } else { - setIsFlightDone(false); - } - } - }, [date]) + if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { + // console.log(true) + setTest(false) + } else { + // console.log(false) + setTest(true) + } + }, [detail]) + + useEffect(() => { + setDate(''); + }, []) + + useEffect(() => { + if (date) { + let cTime = new Date(); + let pTime = new Date(date) + if (cTime > pTime) { + setIsFlightDone(true); + } else { + setIsFlightDone(false); + } + } + }, [date]) return ( @@ -95,13 +93,14 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'plan', name, @@ -130,18 +129,18 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele bsSize='sm' placeholder='+82' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'plan', name, value, }) }} - readOnly - /> + readOnly />
{ - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'plan', name, @@ -166,6 +165,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'plan', name, @@ -236,7 +236,8 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele /> ) } */} - { const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; handleChange({ - type: 'plan', + type: 'plan', name: 'schFltStDt', value }) - }} + }} placeholder='비행 시작일자 선택(클릭)' - // {...{options:{minDate: "today"}}} - /> + // {...{options:{minDate: "today"}}} + /> @@ -300,26 +301,27 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele /> ) } */} - { - const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; - handleChange({ - type: 'plan', - name: 'schFltEndDt', - value - }) - }} - placeholder='비행 종료일자 선택(클릭)' - // {...{options:{minDate: "today"}}} - /> + { + const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; + handleChange({ + type: 'plan', + name: 'schFltEndDt', + value + }) + }} + placeholder='비행 종료일자 선택(클릭)' + // {...{options:{minDate: "today"}}} + /> @@ -328,23 +330,24 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele *비행 목적 { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'plan', name, value, }) }} - // innerRef={props.data} - // className={classnames({ - // 'is-invalid': props.errors.arcrftTypeCd - // })} + // innerRef={props.data} + // className={classnames({ + // 'is-invalid': props.errors.arcrftTypeCd + // })} > {/* TODO CDNOT 코드연동 필요 */} @@ -367,7 +370,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele { - handleModal({target: 'area', isOpen: true}) + handleModal({ target: 'area', isOpen: true }) }} > 비행 구역 설정 @@ -376,17 +379,18 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele {areaList ? areaList.map((item, i) => ) + handleChange={handleChange} />) : } + handleChange={handleChange} />}

조종사 정보

{ - handleModal({target: 'pilot', isOpen: true}) + handleModal({ target: 'pilot', isOpen: true }) }} > 조종사 조회 @@ -395,21 +399,22 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele {pilotList ? pilotList.map((item, i) => ) + index={i} + data={item} + handleChange={handleChange} + handleDeleteArray={handleDeleteArray} + />) : } + handleChange={handleChange} />}

기체 정보

{ - handleModal({target: 'arcrft', isOpen: true}); + handleModal({ target: 'arcrft', isOpen: true }); }} > 기체 조회 @@ -418,14 +423,14 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele {arcrftList ? arcrftList.map((item, i) => ) - + index={i} + data={item} + handleChange={handleChange} + handleDeleteArray={handleDeleteArray} + />) + : } + handleChange={handleChange} />}
@@ -456,9 +461,9 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele - @@ -467,47 +472,47 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele export default FlightPlanForm; -const SelectModal = ({handleModal, modal, test}) => { +const SelectModal = ({ handleModal, modal, test }) => { let title = ''; let description = ''; let type = ''; let isOpen = false; - if(modal.pilot) { + if (modal.pilot) { isOpen = modal.pilot; title = '조종사 조회'; type = 'pilot'; description = } - if(modal.arcrft) { + if (modal.arcrft) { isOpen = modal.arcrft; title = '기체 조회'; type = 'arcrft'; description = ; } - if(modal.area) { + if (modal.area) { isOpen = modal.area; title = '비행 구역 설정'; type = 'area'; - description = ; + description = ; } return ( - ) } -const AreaForm = ({data, handleChange, index}) => { +const AreaForm = ({ data, handleChange, index }) => { return (
@@ -547,7 +552,7 @@ const AreaForm = ({data, handleChange, index}) => { bsSize='sm' placeholder='-!!' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'coord', name, @@ -577,7 +582,7 @@ const AreaForm = ({data, handleChange, index}) => { bsSize='sm' placeholder='반경' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'area', name, @@ -598,7 +603,7 @@ const AreaForm = ({data, handleChange, index}) => { bsSize='sm' placeholder='고도' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'area', name, @@ -625,7 +630,7 @@ const AreaForm = ({data, handleChange, index}) => { bsSize='sm' placeholder='' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'area', name, @@ -640,7 +645,24 @@ const AreaForm = ({data, handleChange, index}) => {
) } -const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { +const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => { + const [test, setTest] = useState(); + const { user } = useSelector(state => state.authState, shallowEqual); + const { detail } = useSelector(state => state.flightState); + + useEffect(() => { + + if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { + // console.log(true) + setTest(false) + } else { + // console.log(false) + setTest(true) + } + + + }, [detail]) + return (
@@ -649,6 +671,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { *성명 { bsSize='sm' placeholder='' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'pilot', name, @@ -666,7 +689,6 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { }) }} readOnly - /> @@ -685,7 +707,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { bsSize='sm' placeholder='+82' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'pilot', name, @@ -706,7 +728,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { bsSize='sm' placeholder='010-0000-0000' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'pilot', name, @@ -734,7 +756,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { bsSize='sm' placeholder='' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'pilot', name, @@ -748,9 +770,10 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { - {data.groupNm? + {data.groupNm ? ( @@ -765,14 +788,30 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { ( <> ) - } - + } +
) } -const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { +const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => { + const [test, setTest] = useState(); + const { user } = useSelector(state => state.authState, shallowEqual); + const { detail } = useSelector(state => state.flightState); + + useEffect(() => { + + if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { + // console.log(true) + setTest(false) + } else { + // console.log(false) + setTest(true) + } + + }, [detail]) + return (
@@ -789,7 +828,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { bsSize='sm' placeholder='' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'arcrft', name, @@ -798,7 +837,6 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { }) }} readOnly - /> @@ -816,7 +854,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { bsSize='sm' placeholder='' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'arcrft', name, @@ -825,7 +863,6 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { }) }} readOnly - /> @@ -843,7 +880,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { bsSize='sm' placeholder='' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'arcrft', name, @@ -852,7 +889,6 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { }) }} readOnly - /> @@ -870,7 +906,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { bsSize='sm' placeholder='' onChange={(e) => { - const {name, value} = e.target; + const { name, value } = e.target; handleChange({ type: 'arcrft', name, @@ -879,29 +915,28 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { }) }} readOnly - /> - - {data.groupNm? - ( - - - handleDeleteArray({ type: 'arcrft', index }) - } - > - - - - ) - : - ( - <> - ) + {data.groupNm ? + ( + + + handleDeleteArray({ type: 'arcrft', index }) + } + > + + + + ) + : + ( + <> + ) }
) diff --git a/src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js b/src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js index a3713f5..f5cd10c 100644 --- a/src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js +++ b/src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js @@ -8,7 +8,7 @@ import { InfoModal } from '../../../../components/modal/InfoModal'; import axios from '../../../../modules/utils/customAxiosUtil'; -const FlightPlanAreaDetailContainer = ({ handleModal }) => { +const FlightPlanAreaDetailContainer = ({ handleModal,test }) => { const dispatch = useDispatch(); const mapControl = useSelector(state => state.controlMapReducer); @@ -115,6 +115,7 @@ const FlightPlanAreaDetailContainer = ({ handleModal }) => { areaCoordList={areaCoordList} data={areaDetail} mapControl={mapControl} + test={test} />