Browse Source

Merge branch 'master' of http://gitea.palntour.com/pav/pav-home

feature/auth
노승철 2 years ago
parent
commit
f1702ed0e1
  1. 11
      src/assets/css/custom.css
  2. 58
      src/components/basis/flight/plan/FlightPlanAreaMap.js
  3. 239
      src/components/basis/flight/plan/FlightPlanForm.js

11
src/assets/css/custom.css

@ -743,4 +743,13 @@ background-size: 75% auto;
.layer-content-box .history-btn{border-radius:4px;display:block;width:100%;height:45px;line-height:45px;text-align:center;font-size: 0.875rem;color:#ddd;font-weight:500;} .layer-content-box .history-btn{border-radius:4px;display:block;width:100%;height:45px;line-height:45px;text-align:center;font-size: 0.875rem;color:#ddd;font-weight:500;}
.layer-content-box .history-btn:hover{border-radius:4px;background:#00cfe8;border-color:#00cfe8;transition: 0.3s ease;-webkit-transition: 0.3s ease;} .layer-content-box .history-btn:hover{border-radius:4px;background:#00cfe8;border-color:#00cfe8;transition: 0.3s ease;-webkit-transition: 0.3s ease;}
.historyModal .drone-ti span{font-weight:500;margin-top:6px} .historyModal .drone-ti span{font-weight:500;margin-top:6px}
.historyModal .drone-name{color:#00cfe8;margin:0 10px 0 0;} .historyModal .drone-name{color:#00cfe8;margin:0 10px 0 0;}
.search-info-box-del-btn{display: flex; align-items: center;}
.search-info-box-del-btn button{cursor: pointer;margin-top:10px}
@media (max-width: 992px){
.search-info-box-del-btn button {
margin-bottom:1rem;
margin-top:0px;
}
}

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

@ -24,41 +24,63 @@ const FlightPlanAreaMap = (props) => {
const [mapAreaCoordList, setMapAreaCoordList] = useState(initFlightBas.initDetail.areaList); const [mapAreaCoordList, setMapAreaCoordList] = useState(initFlightBas.initDetail.areaList);
useEffect(() => { useEffect(() => {
NaverMapInit(); NaverMapInit();
}, []); }, []);
useEffect(() => { useEffect(() => {
setIsMapLoad(true); setIsMapLoad(true);
}, [airArea]); }, [airArea]);
useEffect(() => { useEffect(() => {
ModeInit(); ModeInit();
}, [mapControl.drawType]); }, [mapControl.drawType]);
useEffect(() => { useEffect(() => {
// NaverMapInit();
setMapAreaCoordList(areaCoordList) setMapAreaCoordList(areaCoordList)
}, [areaCoordList]); }, [areaCoordList]);
const ModeInit = () => { const ModeInit = () => {
setMode(mapControl.drawType) setMode(mapControl.drawType)
} }
const NaverMapInit = () => {
const mapOptions = { const NaverMapInit = () => {
// center: new naver.maps.LatLng(36.56793936069445, 127.85101412107547), const center = {};
center: new naver.maps.LatLng(37.520357, 126.610166), const bufferzoom ={};
// zoom: 10, if(areaCoordList) {
zoom: 15, center.lat = areaCoordList[0].coordList[0].lat === 0 ? 37.520357 : areaCoordList[0].coordList[0].lat;
zoomControl: true, center.lon = areaCoordList[0].coordList[0].lon === 0 ? 126.610166 : areaCoordList[0].coordList[0].lon;
mapTypeId: naver.maps.MapTypeId.NORMAL, if(areaCoordList[0].bufferZone>=0 && areaCoordList[0].bufferZone<2000){
zoomControlOptions: { bufferzoom.bufferzoom =13;
position: naver.maps.Position.LEFT_CENTER, }
style: naver.maps.ZoomControlStyle.SMALL else if(areaCoordList[0].bufferZone>=2000 && areaCoordList[0].bufferZone <5000){
} bufferzoom.bufferzoom =12;
}; }
setMap(new naver.maps.Map('map', mapOptions)); else if(areaCoordList[0].bufferZone>=5000 && areaCoordList[0].bufferZone <=9000){
} bufferzoom.bufferzoom =11;
}
else{
bufferzoom.bufferzoom =10;
}
}
console.log("bufferzoom>>",bufferzoom);
console.log(center);
const mapOptions2 = {
// center: new naver.maps.LatLng(36.56793936069445, 127.85101412107547),
center: new naver.maps.LatLng(center.lat, center.lon),
// zoom: 10,
zoom: bufferzoom.bufferzoom,
zoomControl: true,
mapTypeId: naver.maps.MapTypeId.NORMAL,
zoomControlOptions: {
position: naver.maps.Position.LEFT_CENTER,
style: naver.maps.ZoomControlStyle.SMALL
}
};
setMap(new naver.maps.Map('map', mapOptions2));
}
const handlerDrawType = val => { const handlerDrawType = val => {
dispatch(drawTypeChangeAction(val)); dispatch(drawTypeChangeAction(val));

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

@ -1,4 +1,4 @@
import React, { useEffect } from 'react'; import React, { useEffect, useState } from 'react';
import { import {
Card, Card,
CardBody, CardBody,
@ -18,12 +18,39 @@ import { FlightPlanModal } from './FlightPlanModal';
import FlightPlanArcrftContainer from '../../../../containers/basis/flight/plan/FlightPlanArcrftContainer'; import FlightPlanArcrftContainer from '../../../../containers/basis/flight/plan/FlightPlanArcrftContainer';
import FlightPlanAreaContainer from '../../../../containers/basis/flight/plan/FlightPlanAreaContainer'; import FlightPlanAreaContainer from '../../../../containers/basis/flight/plan/FlightPlanAreaContainer';
import { X } from 'react-feather'; import { X } from 'react-feather';
import { useDispatch, useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => { const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => {
const {areaList, pilotList, arcrftList} = data; const {areaList, pilotList, arcrftList} = data;
const { detail } = useSelector(state => state.flightState);
const [date ,setDate] = useState();
const [isFlightDone, setIsFlightDone] = useState();
useEffect(() => {
if(detail.createDt) {
setDate(detail.schFltStDt);
}
}, [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 ( return (
<Row> <Row>
<Col sm='12'> <Col sm='12'>
@ -69,6 +96,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
{ ...(isFlightDone ? {readOnly:true} : {}) }
/> />
</FormGroup> </FormGroup>
</Col> </Col>
@ -115,6 +143,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
}) })
}} }}
placeholder='010-0000-0000' placeholder='010-0000-0000'
{ ...(isFlightDone ? {readOnly:true} : {}) }
/> />
</div> </div>
</FormGroup> </FormGroup>
@ -140,6 +169,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
}} }}
// innerRef={props.data} // innerRef={props.data}
placeholder='' placeholder=''
{ ...(isFlightDone ? {readOnly:true} : {}) }
/> />
</FormGroup> </FormGroup>
</Col> </Col>
@ -157,23 +187,43 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<Label for='test'> <Label for='test'>
<span className='necessary'>*</span> <span className='necessary'>*</span>
</Label> </Label>
<Flatpickr size='sm' {
className='form-control calendar-flat' (isFlightDone) ?
type='text' (
id='schFltStDt' <Input
name='schFltStDt' type='text'
data-enable-time id='groupNm'
// defaultValue={data.schFltStDt} name='groupNm'
value={data.schFltStDt} value={data.schFltStDt}
onChange={(date) => { bsSize='sm'
const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; placeholder=''
handleChange({ readOnly
type: 'plan', />
name: 'schFltStDt', )
value :
}) (
}} <Flatpickr
placeholder='비행 시작일자 선택(클릭)'/> 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"}}}
/>
)
}
</FormGroup> </FormGroup>
</Col> </Col>
@ -182,23 +232,43 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<Label for='test'> <Label for='test'>
<span className='necessary'>*</span> <span className='necessary'>*</span>
</Label> </Label>
<Flatpickr size='sm' {
className='form-control calendar-flat' (isFlightDone) ?
type='text' (
id='schFltEndDt' <Input
name='schFltEndDt' type='text'
data-enable-time id='groupNm'
value={data.schFltEndDt} name='groupNm'
onChange={(date) => { value={data.schFltEndDt}
const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; bsSize='sm'
handleChange({ placeholder=''
type: 'plan', readOnly
name: 'schFltEndDt', />
value )
}) :
}} (
placeholder='비행 종료일자 선택(클릭)'/> <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"}}}
/>
)
}
</FormGroup> </FormGroup>
</Col> </Col>
<Col className='list-input' lg={4} md={4} sm={12}> <Col className='list-input' lg={4} md={4} sm={12}>
@ -207,7 +277,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<span className='necessary'>*</span> <span className='necessary'>*</span>
</Label> </Label>
<Input <Input
type='select' {...(isFlightDone? {type:'text'} : {type:'select'})}
id='fltPurpose' id='fltPurpose'
name='fltPurpose' name='fltPurpose'
value={data.fltPurpose} value={data.fltPurpose}
@ -220,20 +290,27 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
value, value,
}) })
}} }}
{...(isFlightDone? {readOnly:true} : {})}
// innerRef={props.data} // innerRef={props.data}
// className={classnames({ // className={classnames({
// 'is-invalid': props.errors.arcrftTypeCd // 'is-invalid': props.errors.arcrftTypeCd
// })} // })}
> >
{/* TODO CDNOT 코드연동 필요 */} {/* TODO CDNOT 코드연동 필요 */}
<option value=''>= 선택 =</option> { isFlightDone ?
<option value='시험비행'>= 시험비행 =</option> <></>
<option value='교육비행'>= 교육비행 =</option> :
<option value='사진/영상촬영'>= 사진/영상촬영 =</option> <>
<option value='비행훈련'>= 비행훈련 =</option> <option value=''>= 선택 =</option>
<option value='비행교육'>= 비행교육 =</option> <option value='시험비행'>= 시험비행 =</option>
<option value='비행실기시험'>= 비행실기시험 =</option> <option value='교육비행'>= 교육비행 =</option>
<option value='사진/영상촬영'>= 사진/영상촬영 =</option>
<option value='비행훈련'>= 비행훈련 =</option>
<option value='비행교육'>= 비행교육 =</option>
<option value='비행실기시험'>= 비행실기시험 =</option>
</>
}
</Input> </Input>
</FormGroup> </FormGroup>
</Col> </Col>
@ -249,6 +326,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
onClick={(e) => { onClick={(e) => {
handleModal({target: 'area', isOpen: true}) handleModal({target: 'area', isOpen: true})
}} }}
{...(isFlightDone)? {disabled:true} : {} }
> >
비행 구역 설정 비행 구역 설정
</Button.Ripple> </Button.Ripple>
@ -268,6 +346,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
onClick={(e) => { onClick={(e) => {
handleModal({target: 'pilot', isOpen: true}) handleModal({target: 'pilot', isOpen: true})
}} }}
{...(isFlightDone)? {disabled:true} : {} }
> >
조종사 조회 조종사 조회
</Button.Ripple> </Button.Ripple>
@ -278,7 +357,9 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
index={i} index={i}
data={item} data={item}
handleChange={handleChange} handleChange={handleChange}
handleDeleteArray ={handleDeleteArray}/>) handleDeleteArray ={handleDeleteArray}
isFlightDone={isFlightDone}
/>)
: <PilotForm data={initFlightBas.pilot} : <PilotForm data={initFlightBas.pilot}
handleChange={handleChange}/>} handleChange={handleChange}/>}
</dt> </dt>
@ -290,6 +371,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
onClick={(e) => { onClick={(e) => {
handleModal({target: 'arcrft', isOpen: true}); handleModal({target: 'arcrft', isOpen: true});
}} }}
{...(isFlightDone)? {disabled:true} : {} }
> >
기체 조회 기체 조회
</Button.Ripple> </Button.Ripple>
@ -300,7 +382,9 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
index={i} index={i}
data={item} data={item}
handleChange={handleChange} handleChange={handleChange}
handleDeleteArray ={handleDeleteArray}/>) handleDeleteArray ={handleDeleteArray}
isFlightDone={isFlightDone}
/>)
: <ArcrftForm data={initFlightBas.arcrft} : <ArcrftForm data={initFlightBas.arcrft}
handleChange={handleChange}/>} handleChange={handleChange}/>}
@ -312,6 +396,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
color='primary' color='primary'
size='sm' size='sm'
onClick={handleSave} onClick={handleSave}
{...(isFlightDone)? {disabled:true} : {} }
> >
저장 저장
</Button.Ripple> </Button.Ripple>
@ -319,6 +404,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
color='danger' color='danger'
size='sm' size='sm'
onClick={handleDelete} onClick={handleDelete}
{...(isFlightDone)? {disabled:true} : {} }
> >
삭제 삭제
</Button.Ripple> </Button.Ripple>
@ -517,7 +603,7 @@ const AreaForm = ({data, handleChange, index}) => {
</Row> </Row>
</div>) </div>)
} }
const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { const PilotForm = ({data, handleChange, index, handleDeleteArray, isFlightDone}) => {
return (<div className='search-info-box'> return (<div className='search-info-box'>
<Row> <Row>
<Col className='list-input' lg={4} md={6} sm={12}> <Col className='list-input' lg={4} md={6} sm={12}>
@ -597,7 +683,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => {
</div> </div>
</FormGroup> </FormGroup>
</Col> </Col>
<Col className='list-input' lg={4} md={6} sm={12}> <Col className='list-input' lg={3} md={6} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'> <Label for='test'>
<span className='necessary'>*</span> <span className='necessary'>*</span>
@ -624,33 +710,33 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => {
/> />
</FormGroup> </FormGroup>
</Col> </Col>
{data.groupNm? <Col className='search-info-box-del-btn' lg={1} md={6} sm={12}>
( {data.groupNm?
<Col className='pilot-del-btn' xs={12} md={2} xl={2} > (
<Button.Ripple <Button.Ripple
color='danger' color='danger'
className='text-nowrap px-2' className='btn-icon'
onClick={() => onClick={() =>
handleDeleteArray({ type: 'pilot', index }) handleDeleteArray({ type: 'pilot', index })
} }
outline {...(isFlightDone)? {disabled:true} : {} }
> >
<X size={14} className='mr-50' /> <X size={14} />
<span>삭제</span> </Button.Ripple>
</Button.Ripple>
</Col> )
) :
: (
( <></>
<></> )
) }
} </Col>
</Row> </Row>
</div>) </div>)
} }
const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { const ArcrftForm = ({data, handleChange, index, handleDeleteArray, isFlightDone}) => {
return (<div className='search-info-box'> return (<div className='search-info-box'>
<Row> <Row>
<Col className='list-input' lg={3} md={6} sm={12}> <Col className='list-input' lg={3} md={6} sm={12}>
@ -734,7 +820,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => {
/> />
</FormGroup> </FormGroup>
</Col> </Col>
<Col className='list-input' lg={3} md={6} sm={12}> <Col className='list-input' lg={2} md={6} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'> <Label for='test'>
<span className='necessary'>*</span> <span className='necessary'>*</span>
@ -783,17 +869,16 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => {
} */} } */}
{data.groupNm? {data.groupNm?
( (
<Col className='arcrft-del-btn' xs={12} md={2} xl={2} > <Col className='search-info-box-del-btn' lg={1} md={6} sm={12}>
<Button.Ripple <Button.Ripple
color='danger' color='danger'
className='text-nowrap px-1' className='btn-icon'
onClick={() => onClick={() =>
handleDeleteArray({ type: 'arcrft', index }) handleDeleteArray({ type: 'arcrft', index })
} }
outline {...(isFlightDone)? {disabled:true} : {} }
> >
<X size={14} className='mr-50' /> <X size={14} />
<span>삭제</span>
</Button.Ripple> </Button.Ripple>
</Col> </Col>
) )

Loading…
Cancel
Save