Browse Source

비행계획서 신청(수정불가)

feature/auth
sanguu 2 years ago
parent
commit
27c7cbda39
  1. 64
      src/components/basis/flight/plan/FlightPlanAreaDetailForm.js
  2. 14
      src/components/basis/flight/plan/FlightPlanAreaMap.js
  3. 155
      src/components/basis/flight/plan/FlightPlanForm.js
  4. 3
      src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js

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

@ -10,7 +10,7 @@ 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;
@ -43,7 +43,7 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
return (
<Col key={idx} className='list-input' lg={6} md={6} sm={12}>
<FormGroup>
<Label for='test'><span className='necessary'>*</span> {idx+1} </Label>
<Label for='test'><span className='necessary'>*</span> {idx + 1} </Label>
<Input
type='text'
name='coord'
@ -86,34 +86,64 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
<FormGroup className='m_ft'>
<div className='m_ft_box'>
<Label for='test'><span className='necessary'>*</span>(m)</Label>
{test ?
<Input
type='text'
id='bufferZone'
name='bufferZone'
bsSize='sm'
readOnly={coordList[0].lat && (data[0].areaType && data[0].areaType != ("POLYGON")) ? false : true }
readOnly={test}
placeholder='반경'
value={data[0].bufferZone ? data[0].bufferZone : ''}
onChange={(e) => {
const { name, value } = e.target;
handleChange({
name,
value
})
}}
/>
:
<Input
type='text'
id='bufferZone'
name='bufferZone'
bsSize='sm'
readOnly={coordList[0].lat && (data[0].areaType && data[0].areaType != ("POLYGON")) ? false : true}
placeholder='반경'
value={data[0].bufferZone ? data[0].bufferZone : ''}
onChange={(e) => {
const {name, value} = e.target;
const { name, value } = e.target;
handleChange({
name,
value
})
}}
/>
}
</div>
<div className='m_ft_box'>
{test ?
<Button.Ripple
className='mr-1'
color='primary'
size='sm'
disabled={coordList[0].lat && (data[0].areaType && data[0].areaType != ("POLYGON")) ? false : true }
disabled={test}
onClick={() => handleBufferList()}
>
적용
</Button.Ripple>
:
<Button.Ripple
className='mr-1'
color='primary'
size='sm'
disabled={coordList[0].lat && (data[0].areaType && data[0].areaType != ("POLYGON")) ? false : true}
onClick={() => handleBufferList()}
>
적용
</Button.Ripple>
}
</div>
</FormGroup>
</Col>
@ -124,7 +154,9 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
<Col className='list-input' lg={6} md={6} sm={12}>
<FormGroup>
<Label for='test'><span className='necessary'>*</span>(ft)</Label>
<Input
readOnly={test}
type='text'
id='fltElev'
name='fltElev'
@ -132,7 +164,7 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
placeholder='고도'
value={data[0].fltElev ? data[0].fltElev : ''}
onChange={(e) => {
const {name, value} = e.target;
const { name, value } = e.target;
handleChange({
name,
value
@ -149,6 +181,7 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
<FormGroup>
<Label for='test'><span className='necessary'>*</span> </Label>
<Input
readOnly={test}
type='text'
id='fltMethod'
name='fltMethod'
@ -156,7 +189,7 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
placeholder='비행 방식'
value={data[0].fltMethod ? data[0].fltMethod : ''}
onChange={(e) => {
const {name, value} = e.target;
const { name, value } = e.target;
handleChange({
name,
value
@ -172,15 +205,28 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl
</div>
<div className='d-flex align-items-center mt-2'>
{test ?
<Button.Ripple
type='submit'
className='mr-1'
color='primary'
onClick={e => handleSave()}
disabled={!coordList[0].lat ? true : false }
disabled={test}
>
등록
</Button.Ripple>
:
<Button.Ripple
type='submit'
className='mr-1'
color='primary'
onClick={e => handleSave()}
disabled={!coordList[0].lat ? true : false}
>
등록
</Button.Ripple>
}
<Button.Ripple
className='mr-1'
color='primary'

14
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}
>
초기화
</Button.Ripple>
@ -192,6 +193,7 @@ const FlightPlanAreaMap = (props) => {
className='mr-1'
color='primary'
onClick={e => handlerDrawType('LINE')}
disabled={props.test}
>
WayPoint
</Button.Ripple>
@ -199,12 +201,14 @@ const FlightPlanAreaMap = (props) => {
className='mr-1'
color='primary'
onClick={e => handlerDrawType('CIRCLE')}
disabled={props.test}
>
Circle
</Button.Ripple>
<Button.Ripple
color='primary'
onClick={e => handlerDrawType('POLYGON')}
disabled={props.test}
>
Polygon
</Button.Ripple>

155
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,32 +22,30 @@ 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 [date, setDate] = useState();
const [isFlightDone, setIsFlightDone] = useState();
const [test, setTest] = useState();
const { user } = useSelector(state => state.authState, shallowEqual);
const { detail } = useSelector(state => state.flightState);
useEffect(() => {
if(detail.createDt) {
if (detail.createDt) {
setDate(detail.schFltStDt);
}
if(detail?.createUserId == user?.cstmrSno) {
if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) {
// console.log(true)
setTest(true)
setTest(false)
} else {
// console.log(false)
setTest(false)
setTest(true)
}
console.log(detail.createUserId, '생성')
console.log(user.cstmrSno, '로그인')
}, [detail])
useEffect(() => {
@ -55,10 +53,10 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
}, [])
useEffect(() => {
if(date) {
if (date) {
let cTime = new Date();
let pTime = new Date(date)
if(cTime > pTime) {
if (cTime > pTime) {
setIsFlightDone(true);
} else {
setIsFlightDone(false);
@ -95,13 +93,14 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<Label for='test'><span
className='necessary'>*</span></Label>
<Input
readOnly={test}
type='text'
id='memberName'
name='memberName'
// defaultValue={data.memberName}
value={data.memberName || ''}
onChange={(e) => {
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 />
</div>
<div className='m_ft_box'>
<Input
readOnly={test}
type='text'
id='hpno'
name='hpno'
@ -149,7 +148,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
value={data.hpno || ''}
bsSize='sm'
onChange={(e) => {
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
<Label for='test'><span
className='necessary'>*</span></Label>
<Input
readOnly={test}
type='text'
id='email'
name='email'
@ -173,7 +173,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
// value={data.email}
bsSize='sm'
onChange={(e) => {
const {name, value} = e.target;
const { name, value } = e.target;
handleChange({
type: 'plan',
name,
@ -237,6 +237,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
)
} */}
<Flatpickr
disabled={test}
size='sm'
className='form-control calendar-flat'
type='text'
@ -301,6 +302,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
)
} */}
<Flatpickr
disabled={test}
size='sm'
className='form-control calendar-flat'
type='text'
@ -328,13 +330,14 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<span className='necessary'>*</span>
</Label>
<Input
disabled={test}
type='select'
id='fltPurpose'
name='fltPurpose'
value={data.fltPurpose}
bsSize='sm'
onChange={(e) => {
const {name, value} = e.target;
const { name, value } = e.target;
handleChange({
type: 'plan',
name,
@ -367,7 +370,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<Button.Ripple
color="primary"
onClick={(e) => {
handleModal({target: 'area', isOpen: true})
handleModal({ target: 'area', isOpen: true })
}}
>
비행 구역 설정
@ -378,15 +381,16 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<AreaForm key={i} index={i} data={item}
handleChange={handleChange} />)
: <AreaForm data={initFlightBas.area}
handleChange={handleChange}/>}
handleChange={handleChange} />}
</dt>
<dt>
<div className='search-info-ti d-flex justify-content-between'>
<h4 className='ti'>조종사 정보</h4>
<Button.Ripple
disabled={test}
color="primary"
onClick={(e) => {
handleModal({target: 'pilot', isOpen: true})
handleModal({ target: 'pilot', isOpen: true })
}}
>
조종사 조회
@ -398,18 +402,19 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
index={i}
data={item}
handleChange={handleChange}
handleDeleteArray ={handleDeleteArray}
handleDeleteArray={handleDeleteArray}
/>)
: <PilotForm data={initFlightBas.pilot}
handleChange={handleChange}/>}
handleChange={handleChange} />}
</dt>
<dt>
<div className='search-info-ti d-flex justify-content-between'>
<h4 className='ti'>기체 정보</h4>
<Button.Ripple
disabled={test}
color="primary"
onClick={(e) => {
handleModal({target: 'arcrft', isOpen: true});
handleModal({ target: 'arcrft', isOpen: true });
}}
>
기체 조회
@ -421,11 +426,11 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
index={i}
data={item}
handleChange={handleChange}
handleDeleteArray ={handleDeleteArray}
handleDeleteArray={handleDeleteArray}
/>)
: <ArcrftForm data={initFlightBas.arcrft}
handleChange={handleChange}/>}
handleChange={handleChange} />}
</dt>
<div className='d-flex align-items-center'>
@ -467,39 +472,39 @@ 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 = <FlightPlanPilotContainer handleModal={handleModal} type={type} />
}
if(modal.arcrft) {
if (modal.arcrft) {
isOpen = modal.arcrft;
title = '기체 조회';
type = 'arcrft';
description = <FlightPlanArcrftContainer handleModal={handleModal} type={type} />;
}
if(modal.area) {
if (modal.area) {
isOpen = modal.area;
title = '비행 구역 설정';
type = 'area';
description = <FlightPlanAreaContainer handleModal={handleModal} type={type} test={test}/>;
description = <FlightPlanAreaContainer handleModal={handleModal} type={type} test={test} />;
}
return (
<FlightPlanModal
title = {title}
description = {description}
type = {type}
isOpen = {isOpen}
title={title}
description={description}
type={type}
isOpen={isOpen}
handleModal={handleModal}
/>
)
@ -507,7 +512,7 @@ const SelectModal = ({handleModal, modal, test}) => {
}
const AreaForm = ({data, handleChange, index}) => {
const AreaForm = ({ data, handleChange, index }) => {
return (<div className='search-info-box'>
<Row>
@ -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}) => {
</Row>
</div>)
}
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 (<div className='search-info-box'>
<Row>
<Col className='list-input' lg={4} md={6} sm={12}>
@ -649,6 +671,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => {
<span className='necessary'>*</span>
</Label>
<Input
type='text'
id='memberName'
name='memberName'
@ -657,7 +680,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
/>
</FormGroup>
</Col>
@ -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}) => {
</FormGroup>
</Col>
<Col className='search-info-box-del-btn' lg={1} md={6} sm={12}>
{data.groupNm?
{data.groupNm ?
(
<Button.Ripple
disabled={test}
color='danger'
className='btn-icon'
onClick={() =>
@ -772,7 +795,23 @@ 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 (<div className='search-info-box'>
<Row>
<Col className='list-input' lg={3} md={6} sm={12}>
@ -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
/>
</FormGroup>
</Col>
@ -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
/>
</FormGroup>
</Col>
@ -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
/>
</FormGroup>
</Col>
@ -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,15 +915,14 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => {
})
}}
readOnly
/>
</FormGroup>
</Col>
{data.groupNm?
{data.groupNm ?
(
<Col className='search-info-box-del-btn' lg={1} md={6} sm={12}>
<Button.Ripple
disabled={test}
color='danger'
className='btn-icon'
onClick={() =>

3
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}
/>
</Col>
<InfoModal modal={alertModal} setModal={setAlertModal} />

Loading…
Cancel
Save