Browse Source

비행계획서 - 비행 시작 후 수정 불가

pull/2/head
junh_eee(이준희) 2 years ago
parent
commit
b56edf7892
  1. 134
      src/components/basis/flight/plan/FlightPlanAreaDetailForm.js
  2. 11
      src/components/basis/flight/plan/FlightPlanAreaMap.js
  3. 135
      src/components/basis/flight/plan/FlightPlanForm.js
  4. 15
      src/components/map/naver/draw/FlightPlanDraw.js
  5. 88
      src/containers/basis/flight/plan/FlightPlanAreaContainer.js
  6. 53
      src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js
  7. 1033
      src/containers/basis/flight/plan/FlightPlanDetailContainer.js

134
src/components/basis/flight/plan/FlightPlanAreaDetailForm.js

@ -10,8 +10,16 @@ import {
Button Button
} from 'reactstrap'; } from 'reactstrap';
const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handleBufferList, data, mapControl, test }) => { const FlightPlanAreaDetailForm = ({
handleSave,
handleClose,
handleChange,
handleBufferList,
data,
mapControl,
test,
isDone
}) => {
const coordList = data ? data[0].coordList : null; const coordList = data ? data[0].coordList : null;
return ( return (
@ -36,14 +44,23 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
<div className='search-info-box'> <div className='search-info-box'>
<Row> <Row>
{coordList ? {coordList ? (
coordList.map((coord, idx) => { coordList.map((coord, idx) => {
const latlon = coord.lat + ' / ' + coord.lon; const latlon = coord.lat + ' / ' + coord.lon;
return ( return (
<Col key={idx} className='list-input' lg={6} md={6} sm={12}> <Col
key={idx}
className='list-input'
lg={6}
md={6}
sm={12}
>
<FormGroup> <FormGroup>
<Label for='test'><span className='necessary'>*</span> {idx + 1} </Label> <Label for='test'>
<span className='necessary'>*</span>{' '}
{idx + 1}{' '}
</Label>
<Input <Input
type='text' type='text'
name='coord' name='coord'
@ -54,12 +71,14 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
/> />
</FormGroup> </FormGroup>
</Col> </Col>
) );
}) })
: ) : (
<Col className='list-input' lg={6} md={6} sm={12}> <Col className='list-input' lg={6} md={6} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'><span className='necessary'>*</span> 1</Label> <Label for='test'>
<span className='necessary'>*</span> 1
</Label>
<Input <Input
type='text' type='text'
name='coord' name='coord'
@ -69,8 +88,7 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
/> />
</FormGroup> </FormGroup>
</Col> </Col>
} )}
</Row> </Row>
</div> </div>
</dt> </dt>
@ -85,65 +103,88 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
<Col className='list-input' lg={6} md={6} sm={12}> <Col className='list-input' lg={6} md={6} sm={12}>
<FormGroup className='m_ft'> <FormGroup className='m_ft'>
<div className='m_ft_box'> <div className='m_ft_box'>
<Label for='test'><span className='necessary'>*</span>(m)</Label> <Label for='test'>
{test ? <span className='necessary'>*</span>(m)
</Label>
{test || isDone ? (
<Input <Input
type='text' type='text'
id='bufferZone' id='bufferZone'
name='bufferZone' name='bufferZone'
bsSize='sm' bsSize='sm'
readOnly={test} // readOnly={test}
disabled={test || isDone}
placeholder='반경' placeholder='반경'
value={data[0].bufferZone ? data[0].bufferZone : ''} value={
onChange={(e) => { data[0].bufferZone
? data[0].bufferZone
: ''
}
onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
name, name,
value value
}) });
}} }}
/> />
: ) : (
<Input <Input
type='text' type='text'
id='bufferZone' id='bufferZone'
name='bufferZone' name='bufferZone'
bsSize='sm' bsSize='sm'
readOnly={coordList[0].lat && (data[0].areaType && data[0].areaType != ("POLYGON")) ? false : true} readOnly={
coordList[0].lat &&
data[0].areaType &&
data[0].areaType != 'POLYGON'
? false
: true
}
placeholder='반경' placeholder='반경'
value={data[0].bufferZone ? data[0].bufferZone : ''} value={
onChange={(e) => { data[0].bufferZone
? data[0].bufferZone
: ''
}
onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
name, name,
value value
}) });
}} }}
/> />
} )}
</div> </div>
<div className='m_ft_box'> <div className='m_ft_box'>
{test ? {test || isDone ? (
<Button.Ripple <Button.Ripple
className='mr-1' className='mr-1'
color='primary' color='primary'
size='sm' size='sm'
disabled={test} disabled={test || isDone}
onClick={() => handleBufferList()} onClick={() => handleBufferList()}
> >
적용 적용
</Button.Ripple> </Button.Ripple>
: ) : (
<Button.Ripple <Button.Ripple
className='mr-1' className='mr-1'
color='primary' color='primary'
size='sm' size='sm'
disabled={coordList[0].lat && (data[0].areaType && data[0].areaType != ("POLYGON")) ? false : true} disabled={
coordList[0].lat &&
data[0].areaType &&
data[0].areaType != 'POLYGON'
? false
: true
}
onClick={() => handleBufferList()} onClick={() => handleBufferList()}
> >
적용 적용
</Button.Ripple> </Button.Ripple>
} )}
</div> </div>
</FormGroup> </FormGroup>
</Col> </Col>
@ -153,23 +194,26 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
<Row> <Row>
<Col className='list-input' lg={6} md={6} sm={12}> <Col className='list-input' lg={6} md={6} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'><span className='necessary'>*</span>(ft)</Label> <Label for='test'>
<span className='necessary'>*</span>(ft)
</Label>
<Input <Input
readOnly={test} // readOnly={test}
type='text' type='text'
id='fltElev' id='fltElev'
name='fltElev' name='fltElev'
bsSize='sm' bsSize='sm'
placeholder='고도' placeholder='고도'
value={data[0].fltElev ? data[0].fltElev : ''} value={data[0].fltElev ? data[0].fltElev : ''}
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
name, name,
value value
}) });
}} }}
disabled={test || isDone}
/> />
</FormGroup> </FormGroup>
</Col> </Col>
@ -179,22 +223,27 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
<Row> <Row>
<Col className='list-input' lg={6} md={6} sm={12}> <Col className='list-input' lg={6} md={6} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'><span className='necessary'>*</span> </Label> <Label for='test'>
<span className='necessary'>*</span>
</Label>
<Input <Input
readOnly={test} // readOnly={test}
type='text' type='text'
id='fltMethod' id='fltMethod'
name='fltMethod' name='fltMethod'
bsSize='sm' bsSize='sm'
placeholder='비행 방식' placeholder='비행 방식'
value={data[0].fltMethod ? data[0].fltMethod : ''} value={
onChange={(e) => { data[0].fltMethod ? data[0].fltMethod : ''
}
onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
name, name,
value value
}) });
}} }}
disabled={test || isDone}
/> />
</FormGroup> </FormGroup>
</Col> </Col>
@ -205,18 +254,17 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
</div> </div>
<div className='d-flex align-items-center mt-2'> <div className='d-flex align-items-center mt-2'>
{test ? {test || isDone ? (
<Button.Ripple <Button.Ripple
type='submit' type='submit'
className='mr-1' className='mr-1'
color='primary' color='primary'
onClick={e => handleSave()} onClick={e => handleSave()}
disabled={test || isDone}
disabled={test}
> >
등록 등록
</Button.Ripple> </Button.Ripple>
: ) : (
<Button.Ripple <Button.Ripple
type='submit' type='submit'
className='mr-1' className='mr-1'
@ -226,7 +274,7 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
> >
등록 등록
</Button.Ripple> </Button.Ripple>
} )}
<Button.Ripple <Button.Ripple
className='mr-1' className='mr-1'
color='primary' color='primary'
@ -241,7 +289,7 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
</Row> </Row>
</CardBody> </CardBody>
</Card> </Card>
) );
} };
export default FlightPlanAreaDetailForm; export default FlightPlanAreaDetailForm;

11
src/components/basis/flight/plan/FlightPlanAreaMap.js

@ -214,7 +214,8 @@ const FlightPlanAreaMap = props => {
handleCoordinates={handleCoordinates} handleCoordinates={handleCoordinates}
handleInitCoordinates={handleInitCoordinates} handleInitCoordinates={handleInitCoordinates}
handleConfirm={props.handleConfirm} handleConfirm={props.handleConfirm}
isDisabled={props.test} isYour={props.test}
isDone={props.isDone}
/> />
) : null} ) : null}
@ -304,7 +305,7 @@ const FlightPlanAreaMap = props => {
className='mr-1' className='mr-1'
color='primary' color='primary'
onClick={e => handlerDrawType('LINE')} onClick={e => handlerDrawType('LINE')}
disabled={props.test} disabled={props.test || props.isDone}
> >
WayPoint WayPoint
</Button.Ripple> </Button.Ripple>
@ -312,7 +313,7 @@ const FlightPlanAreaMap = props => {
className='mr-1' className='mr-1'
color='primary' color='primary'
onClick={e => handlerDrawType('CIRCLE')} onClick={e => handlerDrawType('CIRCLE')}
disabled={props.test} disabled={props.test || props.isDone}
> >
Circle Circle
</Button.Ripple> </Button.Ripple>
@ -320,7 +321,7 @@ const FlightPlanAreaMap = props => {
className='mr-1' className='mr-1'
color='primary' color='primary'
onClick={e => handlerDrawType('POLYGON')} onClick={e => handlerDrawType('POLYGON')}
disabled={props.test} disabled={props.test || props.isDone}
> >
Polygon Polygon
</Button.Ripple> </Button.Ripple>
@ -332,7 +333,7 @@ const FlightPlanAreaMap = props => {
// ):( // ):(
// {disabled:false} // {disabled:false}
// )} // )}
disabled={props.test} disabled={props.test || props.isDone}
> >
초기화 초기화
</Button.Ripple> </Button.Ripple>

135
src/components/basis/flight/plan/FlightPlanForm.js

@ -34,7 +34,8 @@ const FlightPlanForm = ({
handleSave, handleSave,
handleDelete, handleDelete,
modal, modal,
handleDeleteArray handleDeleteArray,
isDone
}) => { }) => {
const { areaList, pilotList, arcrftList } = data; const { areaList, pilotList, arcrftList } = data;
@ -79,7 +80,7 @@ const FlightPlanForm = ({
<span className='necessary'>*</span> <span className='necessary'>*</span>
</Label> </Label>
<Input <Input
readOnly={test} // readOnly={test}
type='text' type='text'
id='memberName' id='memberName'
name='memberName' name='memberName'
@ -95,6 +96,7 @@ const FlightPlanForm = ({
}} }}
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
disabled={isDone || test}
/> />
</FormGroup> </FormGroup>
</Col> </Col>
@ -126,7 +128,7 @@ const FlightPlanForm = ({
</div> </div>
<div className='m_ft_box'> <div className='m_ft_box'>
<Input <Input
readOnly={test} // readOnly={test}
type='text' type='text'
id='hpno' id='hpno'
name='hpno' name='hpno'
@ -142,6 +144,7 @@ const FlightPlanForm = ({
}); });
}} }}
placeholder='010-0000-0000' placeholder='010-0000-0000'
disabled={isDone || test}
/> />
</div> </div>
</FormGroup> </FormGroup>
@ -152,7 +155,7 @@ const FlightPlanForm = ({
<span className='necessary'>*</span> <span className='necessary'>*</span>
</Label> </Label>
<Input <Input
readOnly={test} // readOnly={test}
type='text' type='text'
id='email' id='email'
name='email' name='email'
@ -169,6 +172,7 @@ const FlightPlanForm = ({
}} }}
// innerRef={props.data} // innerRef={props.data}
placeholder='' placeholder=''
disabled={isDone || test}
/> />
</FormGroup> </FormGroup>
</Col> </Col>
@ -187,45 +191,8 @@ const FlightPlanForm = ({
<span className='necessary'>*</span> <span className='necessary'>*</span>
비행시작일자 비행시작일자
</Label> </Label>
{/* {
(isFlightDone) ?
(
<Input
type='text'
id='groupNm'
name='groupNm'
value={data.schFltStDt}
bsSize='sm'
placeholder=''
readOnly
/>
)
:
(
<Flatpickr
size='sm'
className='form-control calendar-flat'
type='text'
id='schFltStDt'
name='schFltStDt'
data-enable-time
// defaultValue={data.schFltStDt}
value={data.schFltStDt}
onChange={(date) => {
const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || '';
handleChange({
type: 'plan',
name: 'schFltStDt',
value
})
}}
placeholder='비행 시작일자 선택(클릭)'
{...{options:{minDate: "today"}}}
/>
)
} */}
<Flatpickr <Flatpickr
disabled={test} // disabled={test}
className='form-control form-control-sm' className='form-control form-control-sm'
type='text' type='text'
id='schFltStDt' id='schFltStDt'
@ -245,6 +212,7 @@ const FlightPlanForm = ({
}); });
}} }}
placeholder='비행 시작일자 선택(클릭)' placeholder='비행 시작일자 선택(클릭)'
disabled={isDone || test}
// {...{options:{minDate: "today"}}} // {...{options:{minDate: "today"}}}
/> />
</FormGroup> </FormGroup>
@ -255,45 +223,8 @@ const FlightPlanForm = ({
<span className='necessary'>*</span> <span className='necessary'>*</span>
비행종료일자 비행종료일자
</Label> </Label>
{/* {
(isFlightDone) ?
(
<Input
type='text'
id='groupNm'
name='groupNm'
value={data.schFltEndDt}
bsSize='sm'
placeholder=''
readOnly
/>
)
:
(
<Flatpickr
size='sm'
className='form-control calendar-flat'
type='text'
id='schFltEndDt'
name='schFltEndDt'
data-enable-time
// defaultValue={data.schFltEndDt}
value={data.schFltEndDt}
onChange={(date) => {
const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || '';
handleChange({
type: 'plan',
name: 'schFltEndDt',
value
})
}}
placeholder='비행 종료일자 선택(클릭)'
{...{options:{minDate: "today"}}}
/>
)
} */}
<Flatpickr <Flatpickr
disabled={test} // disabled={test}
className='form-control form-control-sm' className='form-control form-control-sm'
type='text' type='text'
id='schFltEndDt' id='schFltEndDt'
@ -313,6 +244,7 @@ const FlightPlanForm = ({
}); });
}} }}
placeholder='비행 종료일자 선택(클릭)' placeholder='비행 종료일자 선택(클릭)'
disabled={isDone || test}
// {...{options:{minDate: "today"}}} // {...{options:{minDate: "today"}}}
/> />
</FormGroup> </FormGroup>
@ -324,7 +256,7 @@ const FlightPlanForm = ({
목적 목적
</Label> </Label>
<Input <Input
disabled={test} // disabled={test}
type='select' type='select'
id='fltPurpose' id='fltPurpose'
name='fltPurpose' name='fltPurpose'
@ -338,6 +270,7 @@ const FlightPlanForm = ({
value value
}); });
}} }}
disabled={isDone || test}
// innerRef={props.data} // innerRef={props.data}
// className={classnames({ // className={classnames({
// 'is-invalid': props.errors.arcrftTypeCd // 'is-invalid': props.errors.arcrftTypeCd
@ -402,7 +335,7 @@ const FlightPlanForm = ({
<div className='search-info-ti d-flex justify-content-between'> <div className='search-info-ti d-flex justify-content-between'>
<h4 className='ti'>조종사 정보</h4> <h4 className='ti'>조종사 정보</h4>
<Button.Ripple <Button.Ripple
disabled={test} disabled={test || isDone}
color='primary' color='primary'
onClick={e => { onClick={e => {
handleModal({ target: 'pilot', isOpen: true }); handleModal({ target: 'pilot', isOpen: true });
@ -419,6 +352,7 @@ const FlightPlanForm = ({
data={item} data={item}
handleChange={handleChange} handleChange={handleChange}
handleDeleteArray={handleDeleteArray} handleDeleteArray={handleDeleteArray}
isDone={isDone}
/> />
)) ))
) : ( ) : (
@ -432,7 +366,7 @@ const FlightPlanForm = ({
<div className='search-info-ti d-flex justify-content-between'> <div className='search-info-ti d-flex justify-content-between'>
<h4 className='ti'>기체 정보</h4> <h4 className='ti'>기체 정보</h4>
<Button.Ripple <Button.Ripple
disabled={test} disabled={test || isDone}
color='primary' color='primary'
onClick={e => { onClick={e => {
handleModal({ target: 'arcrft', isOpen: true }); handleModal({ target: 'arcrft', isOpen: true });
@ -449,6 +383,7 @@ const FlightPlanForm = ({
data={item} data={item}
handleChange={handleChange} handleChange={handleChange}
handleDeleteArray={handleDeleteArray} handleDeleteArray={handleDeleteArray}
isDone={isDone}
/> />
)) ))
) : ( ) : (
@ -461,7 +396,7 @@ const FlightPlanForm = ({
<div className='d-flex align-items-center'> <div className='d-flex align-items-center'>
<Button.Ripple <Button.Ripple
disabled={test} disabled={test || isDone}
className='mr-1' className='mr-1'
color='primary' color='primary'
size='sm' size='sm'
@ -471,7 +406,7 @@ const FlightPlanForm = ({
</Button.Ripple> </Button.Ripple>
{data.planSno ? ( {data.planSno ? (
<Button.Ripple <Button.Ripple
disabled={test} disabled={test || isDone}
color='danger' color='danger'
size='sm' size='sm'
onClick={handleDelete} onClick={handleDelete}
@ -489,14 +424,19 @@ const FlightPlanForm = ({
</CardBody> </CardBody>
</Card> </Card>
</Col> </Col>
<SelectModal modal={modal} handleModal={handleModal} test={test} /> <SelectModal
modal={modal}
handleModal={handleModal}
test={test}
isDone={isDone}
/>
</Row> </Row>
); );
}; };
export default FlightPlanForm; export default FlightPlanForm;
const SelectModal = ({ handleModal, modal, test }) => { const SelectModal = ({ handleModal, modal, test, isDone }) => {
let title = ''; let title = '';
let description = ''; let description = '';
let type = ''; let type = '';
@ -529,6 +469,7 @@ const SelectModal = ({ handleModal, modal, test }) => {
handleModal={handleModal} handleModal={handleModal}
type={type} type={type}
test={test} test={test}
isDone={isDone}
/> />
); );
} }
@ -686,7 +627,13 @@ const AreaForm = ({ data, handleChange, index }) => {
</div> </div>
); );
}; };
const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => { const PilotForm = ({
data,
handleChange,
index,
handleDeleteArray,
isDone
}) => {
const [test, setTest] = useState(); const [test, setTest] = useState();
const { user } = useSelector(state => state.authState, shallowEqual); const { user } = useSelector(state => state.authState, shallowEqual);
const { detail } = useSelector(state => state.flightState); const { detail } = useSelector(state => state.flightState);
@ -806,7 +753,7 @@ const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => {
<Col className='search-info-box-del-btn' lg={1} md={6} sm={12}> <Col className='search-info-box-del-btn' lg={1} md={6} sm={12}>
{data.groupNm ? ( {data.groupNm ? (
<Button.Ripple <Button.Ripple
disabled={test} disabled={test || isDone}
color='danger' color='danger'
className='btn-icon' className='btn-icon'
onClick={() => handleDeleteArray({ type: 'pilot', index })} onClick={() => handleDeleteArray({ type: 'pilot', index })}
@ -822,7 +769,13 @@ const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => {
); );
}; };
const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => { const ArcrftForm = ({
data,
handleChange,
index,
handleDeleteArray,
isDone
}) => {
const [test, setTest] = useState(); const [test, setTest] = useState();
const { user } = useSelector(state => state.authState, shallowEqual); const { user } = useSelector(state => state.authState, shallowEqual);
const { detail } = useSelector(state => state.flightState); const { detail } = useSelector(state => state.flightState);
@ -945,7 +898,7 @@ const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => {
{data.groupNm ? ( {data.groupNm ? (
<Col className='search-info-box-del-btn' lg={1} md={6} sm={12}> <Col className='search-info-box-del-btn' lg={1} md={6} sm={12}>
<Button.Ripple <Button.Ripple
disabled={test} disabled={test || isDone}
color='danger' color='danger'
className='btn-icon' className='btn-icon'
onClick={() => handleDeleteArray({ type: 'arcrft', index })} onClick={() => handleDeleteArray({ type: 'arcrft', index })}

15
src/components/map/naver/draw/FlightPlanDraw.js

@ -7,7 +7,8 @@ import { InfoModal } from '../../../modal/InfoModal';
export const FlightPlanDraw = props => { export const FlightPlanDraw = props => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const mapControl = useSelector(state => state.controlMapReducer); const mapControl = useSelector(state => state.controlMapReducer);
const isDisabled = props.isDisabled; const isYour = props.isYour;
const isDone = props.isDone;
const [pastPolyline, setPolyline] = useState(); const [pastPolyline, setPolyline] = useState();
const [pastBuffer, setBuffer] = useState(); const [pastBuffer, setBuffer] = useState();
@ -590,7 +591,8 @@ export const FlightPlanDraw = props => {
let clickSet; let clickSet;
{ {
isDisabled === true ? (clickSet = false) : (clickSet = true); // isDisabled === true ? (clickSet = false) : (clickSet = true);
(isYour || isDone) === true ? (clickSet = false) : (clickSet = true);
} }
if (areas.areaType && areas.areaType === 'LINE') { if (areas.areaType && areas.areaType === 'LINE') {
@ -629,7 +631,8 @@ export const FlightPlanDraw = props => {
); );
// dragCircleEve.push(naver.maps.Event.addListener(dragCircle[i], 'mousedown', function () { onMouseDownDrag(i) })) // dragCircleEve.push(naver.maps.Event.addListener(dragCircle[i], 'mousedown', function () { onMouseDownDrag(i) }))
{ {
isDisabled // isDisabled
isYour || isDone
? {} ? {}
: dragCircleEve.push( : dragCircleEve.push(
naver.maps.Event.addListener( naver.maps.Event.addListener(
@ -741,7 +744,8 @@ export const FlightPlanDraw = props => {
); );
// dragCircleEve.push(naver.maps.Event.addListener(dragCircle[i], 'mousedown', function () { onMouseDownDrag(i) })) // dragCircleEve.push(naver.maps.Event.addListener(dragCircle[i], 'mousedown', function () { onMouseDownDrag(i) }))
{ {
isDisabled // isDisabled
isYour || isDone
? {} ? {}
: dragCircleEve.push( : dragCircleEve.push(
naver.maps.Event.addListener( naver.maps.Event.addListener(
@ -838,7 +842,8 @@ export const FlightPlanDraw = props => {
}); });
// Eve.mousedownEve = naver.maps.Event.addListener(circle, 'mousedown', function () { onMouseDownDrag(0); }) // Eve.mousedownEve = naver.maps.Event.addListener(circle, 'mousedown', function () { onMouseDownDrag(0); })
{ {
isDisabled // isDisabled
isYour || isDone
? {} ? {}
: (Eve.mousedownEve = naver.maps.Event.addListener( : (Eve.mousedownEve = naver.maps.Event.addListener(
circle, circle,

88
src/containers/basis/flight/plan/FlightPlanAreaContainer.js

@ -1,60 +1,60 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import {Col, Row } from 'reactstrap'; import { Col, Row } from 'reactstrap';
import * as Actions from '../../../../modules/basis/flight/actions/basisFlightAction'; import * as Actions from '../../../../modules/basis/flight/actions/basisFlightAction';
import FlightPlanAreaMap from '../../../../components/basis/flight/plan/FlightPlanAreaMap'; import FlightPlanAreaMap from '../../../../components/basis/flight/plan/FlightPlanAreaMap';
import { drawTypeChangeAction } from '../../../../modules/control/map/actions/controlMapActions'; import { drawTypeChangeAction } from '../../../../modules/control/map/actions/controlMapActions';
import FlightPlanAreaDetailContainer from './FlightPlanAreaDetailContainer'; import FlightPlanAreaDetailContainer from './FlightPlanAreaDetailContainer';
const FlightPlanAreaContainer = ({handleModal, test}) => { const FlightPlanAreaContainer = ({ handleModal, test, isDone }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { publicAreaList} = useSelector(state => state.flightState); const { publicAreaList } = useSelector(state => state.flightState);
const [airArea, setAirArea] = useState(null); const [airArea, setAirArea] = useState(null);
useEffect(() => { useEffect(() => {
dispatch(drawTypeChangeAction('')); dispatch(drawTypeChangeAction(''));
getAirAreaList(); getAirAreaList();
}, []); }, []);
useEffect(() => { useEffect(() => {
setAirArea(publicAreaList); setAirArea(publicAreaList);
}, [publicAreaList]) }, [publicAreaList]);
const getAirAreaList = () => {
dispatch(Actions.PUBLIC_AREA_LIST.request());
};
const getAirAreaList = () => { const handleConfirm = areaList => {
dispatch(Actions.PUBLIC_AREA_LIST.request()); if (areaList === undefined) {
alert('영역을 설정해 주세요.');
return false;
} }
const handleConfirm = (areaList) => { dispatch(Actions.AREA_COORDINATE_LIST_SAVE(areaList));
if(areaList === undefined) { };
alert('영역을 설정해 주세요.')
return false; return (
} <Row>
<Col md={6} lg={6}>
dispatch(Actions.AREA_COORDINATE_LIST_SAVE(areaList)) {airArea != null ? (
} <FlightPlanAreaMap
airArea={airArea}
return ( handleConfirm={handleConfirm}
<Row> test={test}
<Col md={6} lg={6}> isDone={isDone}
{airArea != null ? ( />
<FlightPlanAreaMap ) : null}
airArea={airArea} </Col>
handleConfirm={handleConfirm} <Col md={6} lg={6}>
test={test} <FlightPlanAreaDetailContainer
/> handleModal={handleModal}
) : null} test={test}
</Col> isDone={isDone}
<Col md={6} lg={6}> />
<FlightPlanAreaDetailContainer </Col>
handleModal={handleModal} </Row>
test={test} );
/> };
</Col>
</Row>
)
}
export default FlightPlanAreaContainer; export default FlightPlanAreaContainer;

53
src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js

@ -3,34 +3,35 @@ import { useDispatch, useSelector } from 'react-redux';
import { Col, Row, Form } from 'reactstrap'; import { Col, Row, Form } from 'reactstrap';
import * as Actions from '../../../../modules/basis/flight/actions/basisFlightAction'; import * as Actions from '../../../../modules/basis/flight/actions/basisFlightAction';
import FlightPlanAreaDetailForm from '../../../../components/basis/flight/plan/FlightPlanAreaDetailForm'; import FlightPlanAreaDetailForm from '../../../../components/basis/flight/plan/FlightPlanAreaDetailForm';
import {initFlightBas} from '../../../../modules/basis/flight/models/basisFlightModel'; import { initFlightBas } from '../../../../modules/basis/flight/models/basisFlightModel';
import { InfoModal } from '../../../../components/modal/InfoModal'; import { InfoModal } from '../../../../components/modal/InfoModal';
import axios from '../../../../modules/utils/customAxiosUtil'; import axios from '../../../../modules/utils/customAxiosUtil';
const FlightPlanAreaDetailContainer = ({ handleModal, test, isDone }) => {
const FlightPlanAreaDetailContainer = ({ handleModal,test }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const mapControl = useSelector(state => state.controlMapReducer); const mapControl = useSelector(state => state.controlMapReducer);
const { areaCoordList, detail } = useSelector(state => state.flightState); const { areaCoordList, detail } = useSelector(state => state.flightState);
const [areaDetail, setAreaDetail] = useState(initFlightBas.initDetail.areaList); const [areaDetail, setAreaDetail] = useState(
initFlightBas.initDetail.areaList
);
const [alertModal, setAlertModal] = useState({ const [alertModal, setAlertModal] = useState({
isOpen: false, isOpen: false,
title: '', title: '',
desc: '' desc: ''
}); });
const handleClose = (status) => { const handleClose = status => {
handleModal({ type: 'area', isOpne: false}); handleModal({ type: 'area', isOpne: false });
} };
const handleSave = async () => { const handleSave = async () => {
const resultAreaDetail = areaDetail.map(area => { const resultAreaDetail = areaDetail.map(area => {
return { return {
...area, ...area,
coordList : areaDetail[0].coordList coordList: areaDetail[0].coordList
} };
}) });
// const resultAreaDetail_api = areaDetail.map((area, i) => { // const resultAreaDetail_api = areaDetail.map((area, i) => {
// let polygonCoord = areaDetail[0].coordList.concat(areaDetail[0].coordList[0]); // let polygonCoord = areaDetail[0].coordList.concat(areaDetail[0].coordList[0]);
@ -50,43 +51,44 @@ const FlightPlanAreaDetailContainer = ({ handleModal,test }) => {
const { data } = await axios.post( const { data } = await axios.post(
// `api/bas/flight/airspace/contains`, resultAreaDetail_api // `api/bas/flight/airspace/contains`, resultAreaDetail_api
`api/bas/flight/airspace/contains`, resultAreaDetail `api/bas/flight/airspace/contains`,
) resultAreaDetail
);
if(data.result) { if (data.result) {
setAlertModal({ setAlertModal({
isOpen: true, isOpen: true,
title: '우회 여부 확인', title: '우회 여부 확인',
desc: '경로상에 비행 금지된 구역이 있습니다.\n우회하여 경로 설정해주시기 바랍니다.' desc: '경로상에 비행 금지된 구역이 있습니다.\n우회하여 경로 설정해주시기 바랍니다.'
}) });
return false; return false;
} }
dispatch(Actions.AREA_DETAIL_LIST_SAVE(resultAreaDetail)); dispatch(Actions.AREA_DETAIL_LIST_SAVE(resultAreaDetail));
handleModal({ type: 'area', isOpne: false}); handleModal({ type: 'area', isOpne: false });
} };
const handleChange = ({ name, value }) => { const handleChange = ({ name, value }) => {
setAreaDetail(prevState => { setAreaDetail(prevState => {
const areaList = prevState.map((area, i) => { const areaList = prevState.map((area, i) => {
return { return {
...area, ...area,
[name] : value [name]: value
} };
}); });
return areaList; return areaList;
}) });
} };
const handleBufferList = () => { const handleBufferList = () => {
dispatch(Actions.FLIGHT_PLAN_AREA_BUFFER_LIST.request(areaDetail)); dispatch(Actions.FLIGHT_PLAN_AREA_BUFFER_LIST.request(areaDetail));
} };
useEffect(() => { useEffect(() => {
// 좌표등록 (등록 시 데이터 초기화) // 좌표등록 (등록 시 데이터 초기화)
if(areaCoordList !== undefined) { if (areaCoordList !== undefined) {
setAreaDetail(areaCoordList); // 새로 만든 영역 setAreaDetail(areaCoordList); // 새로 만든 영역
} }
}, [areaCoordList]); }, [areaCoordList]);
@ -103,7 +105,6 @@ const FlightPlanAreaDetailContainer = ({ handleModal,test }) => {
// }, []) // }, [])
return ( return (
<Row> <Row>
<Col> <Col>
@ -116,12 +117,12 @@ const FlightPlanAreaDetailContainer = ({ handleModal,test }) => {
data={areaDetail} data={areaDetail}
mapControl={mapControl} mapControl={mapControl}
test={test} test={test}
isDone={isDone}
/> />
</Col> </Col>
<InfoModal modal={alertModal} setModal={setAlertModal} /> <InfoModal modal={alertModal} setModal={setAlertModal} />
</Row> </Row>
);
) };
}
export default FlightPlanAreaDetailContainer; export default FlightPlanAreaDetailContainer;

1033
src/containers/basis/flight/plan/FlightPlanDetailContainer.js

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save