Browse Source

권한정리 - 비행계획 상세

pull/2/head
junh_eee(이준희) 2 years ago
parent
commit
1ca0a4fe2b
  1. 72
      src/components/basis/flight/plan/FlightPlanAreaDetailForm.js
  2. 10
      src/components/basis/flight/plan/FlightPlanAreaMap.js
  3. 106
      src/components/basis/flight/plan/FlightPlanForm.js
  4. 17
      src/components/map/naver/draw/FlightPlanDraw.js
  5. 6
      src/containers/basis/flight/plan/FlightPlanAreaContainer.js
  6. 4
      src/containers/basis/flight/plan/FlightPlanAreaDetailContainer.js
  7. 22
      src/containers/basis/flight/plan/FlightPlanDetailContainer.js

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

@ -17,8 +17,9 @@ const FlightPlanAreaDetailForm = ({
handleBufferList,
data,
mapControl,
test,
isDone
// test,
isDone,
isDisabled
}) => {
const coordList = data ? data[0].coordList : null;
@ -106,14 +107,39 @@ const FlightPlanAreaDetailForm = ({
<Label for='test'>
<span className='necessary'>*</span>(m)
</Label>
{test || isDone ? (
<Input
type='text'
id='bufferZone'
name='bufferZone'
bsSize='sm'
// readOnly={test}
disabled={test || isDone}
disabled={
isDisabled || isDone
? true
: 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;
handleChange({
name,
value
});
}}
/>
{/* {isDisabled || isDone ? (
<Input
type='text'
id='bufferZone'
name='bufferZone'
bsSize='sm'
disabled={isDisabled || isDone}
placeholder='반경'
value={
data[0].bufferZone
@ -155,15 +181,33 @@ const FlightPlanAreaDetailForm = ({
});
}}
/>
)}
)} */}
</div>
<div className='m_ft_box'>
{test || isDone ? (
<Button.Ripple
className='mr-1'
color='primary'
size='sm'
disabled={test || isDone}
// disabled={isDisabled || isDone}
disabled={
isDisabled || isDone
? true
: coordList[0].lat &&
data[0].areaType &&
data[0].areaType !== 'POLYGON'
? false
: true
}
onClick={() => handleBufferList()}
>
적용
</Button.Ripple>
{/* {isDisabled || isDone ? (
<Button.Ripple
className='mr-1'
color='primary'
size='sm'
disabled={isDisabled || isDone}
onClick={() => handleBufferList()}
>
적용
@ -184,7 +228,7 @@ const FlightPlanAreaDetailForm = ({
>
적용
</Button.Ripple>
)}
)} */}
</div>
</FormGroup>
</Col>
@ -199,7 +243,6 @@ const FlightPlanAreaDetailForm = ({
</Label>
<Input
// readOnly={test}
type='text'
id='fltElev'
name='fltElev'
@ -213,7 +256,7 @@ const FlightPlanAreaDetailForm = ({
value
});
}}
disabled={test || isDone}
disabled={isDisabled || isDone}
/>
</FormGroup>
</Col>
@ -227,7 +270,6 @@ const FlightPlanAreaDetailForm = ({
<span className='necessary'>*</span>
</Label>
<Input
// readOnly={test}
type='text'
id='fltMethod'
name='fltMethod'
@ -243,7 +285,7 @@ const FlightPlanAreaDetailForm = ({
value
});
}}
disabled={test || isDone}
disabled={isDisabled || isDone}
/>
</FormGroup>
</Col>
@ -254,13 +296,13 @@ const FlightPlanAreaDetailForm = ({
</div>
<div className='d-flex align-items-center mt-2'>
{test || isDone ? (
{isDisabled || isDone ? (
<Button.Ripple
type='submit'
className='mr-1'
color='primary'
onClick={e => handleSave()}
disabled={test || isDone}
disabled={isDisabled || isDone}
>
등록
</Button.Ripple>

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

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

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

@ -1,5 +1,3 @@
import * as yup from 'yup';
import classnames from 'classnames';
import React, { useEffect, useState } from 'react';
import {
Card,
@ -9,8 +7,7 @@ import {
Input,
Label,
Row,
Button,
FormFeedback
Button
} from 'reactstrap';
import Flatpickr from 'react-flatpickr';
import '@styles/react/libs/flatpickr/flatpickr.scss';
@ -35,24 +32,11 @@ const FlightPlanForm = ({
handleDelete,
modal,
handleDeleteArray,
isDone
isDone,
isDisabled
}) => {
const { areaList, pilotList, arcrftList } = data;
const [test, setTest] = useState();
const { user } = useSelector(state => state.authState, shallowEqual);
const { detail } = useSelector(state => state.flightState);
// const schema = yup.object().shape({});
useEffect(() => {
if (detail?.cstmrSno == user?.cstmrSno || user.authId === 'SUPER') {
setTest(false);
} else {
setTest(true);
}
}, [detail]);
return (
<Row>
<Col sm='12'>
@ -80,7 +64,6 @@ const FlightPlanForm = ({
<span className='necessary'>*</span>
</Label>
<Input
// readOnly={test}
type='text'
id='memberName'
name='memberName'
@ -96,7 +79,7 @@ const FlightPlanForm = ({
}}
bsSize='sm'
placeholder=''
disabled={isDone || test}
disabled={isDone || isDisabled}
/>
</FormGroup>
</Col>
@ -128,7 +111,6 @@ const FlightPlanForm = ({
</div>
<div className='m_ft_box'>
<Input
// readOnly={test}
type='text'
id='hpno'
name='hpno'
@ -144,7 +126,7 @@ const FlightPlanForm = ({
});
}}
placeholder='010-0000-0000'
disabled={isDone || test}
disabled={isDone || isDisabled}
/>
</div>
</FormGroup>
@ -155,7 +137,6 @@ const FlightPlanForm = ({
<span className='necessary'>*</span>
</Label>
<Input
// readOnly={test}
type='text'
id='email'
name='email'
@ -172,7 +153,7 @@ const FlightPlanForm = ({
}}
// innerRef={props.data}
placeholder=''
disabled={isDone || test}
disabled={isDone || isDisabled}
/>
</FormGroup>
</Col>
@ -192,7 +173,6 @@ const FlightPlanForm = ({
비행시작일자
</Label>
<Flatpickr
// disabled={test}
className='form-control form-control-sm'
type='text'
id='schFltStDt'
@ -212,7 +192,7 @@ const FlightPlanForm = ({
});
}}
placeholder='비행 시작일자 선택(클릭)'
disabled={isDone || test}
disabled={isDone || isDisabled}
// {...{options:{minDate: "today"}}}
/>
</FormGroup>
@ -224,7 +204,6 @@ const FlightPlanForm = ({
비행종료일자
</Label>
<Flatpickr
// disabled={test}
className='form-control form-control-sm'
type='text'
id='schFltEndDt'
@ -244,7 +223,7 @@ const FlightPlanForm = ({
});
}}
placeholder='비행 종료일자 선택(클릭)'
disabled={isDone || test}
disabled={isDone || isDisabled}
// {...{options:{minDate: "today"}}}
/>
</FormGroup>
@ -256,7 +235,6 @@ const FlightPlanForm = ({
목적
</Label>
<Input
// disabled={test}
type='select'
id='fltPurpose'
name='fltPurpose'
@ -270,7 +248,7 @@ const FlightPlanForm = ({
value
});
}}
disabled={isDone || test}
disabled={isDone || isDisabled}
// innerRef={props.data}
// className={classnames({
// 'is-invalid': props.errors.arcrftTypeCd
@ -335,7 +313,7 @@ const FlightPlanForm = ({
<div className='search-info-ti d-flex justify-content-between'>
<h4 className='ti'>조종사 정보</h4>
<Button.Ripple
disabled={test || isDone}
disabled={isDone || isDisabled}
color='primary'
onClick={e => {
handleModal({ target: 'pilot', isOpen: true });
@ -353,6 +331,7 @@ const FlightPlanForm = ({
handleChange={handleChange}
handleDeleteArray={handleDeleteArray}
isDone={isDone}
isDisabled={isDisabled}
/>
))
) : (
@ -366,7 +345,7 @@ const FlightPlanForm = ({
<div className='search-info-ti d-flex justify-content-between'>
<h4 className='ti'>기체 정보</h4>
<Button.Ripple
disabled={test || isDone}
disabled={isDone || isDisabled}
color='primary'
onClick={e => {
handleModal({ target: 'arcrft', isOpen: true });
@ -384,6 +363,7 @@ const FlightPlanForm = ({
handleChange={handleChange}
handleDeleteArray={handleDeleteArray}
isDone={isDone}
isDisabled={isDisabled}
/>
))
) : (
@ -396,7 +376,7 @@ const FlightPlanForm = ({
<div className='d-flex align-items-center'>
<Button.Ripple
disabled={test || isDone}
disabled={isDone || isDisabled}
className='mr-1'
color='primary'
size='sm'
@ -406,7 +386,7 @@ const FlightPlanForm = ({
</Button.Ripple>
{data.planSno ? (
<Button.Ripple
disabled={test || isDone}
disabled={isDone || isDisabled}
color='danger'
size='sm'
onClick={handleDelete}
@ -427,8 +407,8 @@ const FlightPlanForm = ({
<SelectModal
modal={modal}
handleModal={handleModal}
test={test}
isDone={isDone}
isDisabled={isDisabled}
/>
</Row>
);
@ -436,7 +416,7 @@ const FlightPlanForm = ({
export default FlightPlanForm;
const SelectModal = ({ handleModal, modal, test, isDone }) => {
const SelectModal = ({ handleModal, modal, isDone, isDisabled }) => {
let title = '';
let description = '';
let type = '';
@ -468,8 +448,8 @@ const SelectModal = ({ handleModal, modal, test, isDone }) => {
<FlightPlanAreaContainer
handleModal={handleModal}
type={type}
test={test}
isDone={isDone}
isDisabled={isDisabled}
/>
);
}
@ -632,19 +612,20 @@ const PilotForm = ({
handleChange,
index,
handleDeleteArray,
isDone
isDone,
isDisabled
}) => {
const [test, setTest] = useState();
const { user } = useSelector(state => state.authState, shallowEqual);
const { detail } = useSelector(state => state.flightState);
// const [test, setTest] = useState();
// const { user } = useSelector(state => state.authState, shallowEqual);
// const { detail } = useSelector(state => state.flightState);
useEffect(() => {
if (detail?.cstmrSno == user?.cstmrSno || user.authId === 'SUPER') {
setTest(false);
} else {
setTest(true);
}
}, [detail]);
// useEffect(() => {
// if (detail?.cstmrSno == user?.cstmrSno || user.authId === 'SUPER') {
// setTest(false);
// } else {
// setTest(true);
// }
// }, [detail]);
return (
<div className='search-info-box'>
@ -753,7 +734,7 @@ const PilotForm = ({
<Col className='search-info-box-del-btn' lg={1} md={6} sm={12}>
{data.groupNm ? (
<Button.Ripple
disabled={test || isDone}
disabled={isDisabled || isDone}
color='danger'
className='btn-icon'
onClick={() => handleDeleteArray({ type: 'pilot', index })}
@ -774,19 +755,20 @@ const ArcrftForm = ({
handleChange,
index,
handleDeleteArray,
isDone
isDone,
isDisabled
}) => {
const [test, setTest] = useState();
const { user } = useSelector(state => state.authState, shallowEqual);
const { detail } = useSelector(state => state.flightState);
// const [test, setTest] = useState();
// const { user } = useSelector(state => state.authState, shallowEqual);
// const { detail } = useSelector(state => state.flightState);
useEffect(() => {
if (detail?.cstmrSno == user?.cstmrSno || user.authId === 'SUPER') {
setTest(false);
} else {
setTest(true);
}
}, [detail]);
// useEffect(() => {
// if (detail?.cstmrSno == user?.cstmrSno || user.authId === 'SUPER') {
// setTest(false);
// } else {
// setTest(true);
// }
// }, [detail]);
return (
<div className='search-info-box'>
@ -898,7 +880,7 @@ const ArcrftForm = ({
{data.groupNm ? (
<Col className='search-info-box-del-btn' lg={1} md={6} sm={12}>
<Button.Ripple
disabled={test || isDone}
disabled={isDisabled || isDone}
color='danger'
className='btn-icon'
onClick={() => handleDeleteArray({ type: 'arcrft', index })}

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

@ -7,8 +7,9 @@ import { InfoModal } from '../../../modal/InfoModal';
export const FlightPlanDraw = props => {
const dispatch = useDispatch();
const mapControl = useSelector(state => state.controlMapReducer);
const isYour = props.isYour;
// const isYour = props.isYour;
const isDone = props.isDone;
const isDisabled = props.isDisabled;
const [pastPolyline, setPolyline] = useState();
const [pastBuffer, setBuffer] = useState();
@ -592,7 +593,10 @@ export const FlightPlanDraw = props => {
let clickSet;
{
// isDisabled === true ? (clickSet = false) : (clickSet = true);
(isYour || isDone) === true ? (clickSet = false) : (clickSet = true);
// (isYour || isDone) === true ? (clickSet = false) : (clickSet = true);
(isDisabled || isDone) === true
? (clickSet = false)
: (clickSet = true);
}
if (areas.areaType && areas.areaType === 'LINE') {
@ -632,7 +636,8 @@ export const FlightPlanDraw = props => {
// dragCircleEve.push(naver.maps.Event.addListener(dragCircle[i], 'mousedown', function () { onMouseDownDrag(i) }))
{
// isDisabled
isYour || isDone
// isYour || isDone
isDisabled || isDone
? {}
: dragCircleEve.push(
naver.maps.Event.addListener(
@ -745,7 +750,8 @@ export const FlightPlanDraw = props => {
// dragCircleEve.push(naver.maps.Event.addListener(dragCircle[i], 'mousedown', function () { onMouseDownDrag(i) }))
{
// isDisabled
isYour || isDone
// isYour || isDone
isDisabled || isDone
? {}
: dragCircleEve.push(
naver.maps.Event.addListener(
@ -843,7 +849,8 @@ export const FlightPlanDraw = props => {
// Eve.mousedownEve = naver.maps.Event.addListener(circle, 'mousedown', function () { onMouseDownDrag(0); })
{
// isDisabled
isYour || isDone
// isYour || isDone
isDisabled || isDone
? {}
: (Eve.mousedownEve = naver.maps.Event.addListener(
circle,

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

@ -6,7 +6,7 @@ import FlightPlanAreaMap from '../../../../components/basis/flight/plan/FlightPl
import { drawTypeChangeAction } from '../../../../modules/control/map/actions/controlMapActions';
import FlightPlanAreaDetailContainer from './FlightPlanAreaDetailContainer';
const FlightPlanAreaContainer = ({ handleModal, test, isDone }) => {
const FlightPlanAreaContainer = ({ handleModal, isDone, isDisabled }) => {
const dispatch = useDispatch();
const { publicAreaList } = useSelector(state => state.flightState);
@ -41,16 +41,16 @@ const FlightPlanAreaContainer = ({ handleModal, test, isDone }) => {
<FlightPlanAreaMap
airArea={airArea}
handleConfirm={handleConfirm}
test={test}
isDone={isDone}
isDisabled={isDisabled}
/>
) : null}
</Col>
<Col md={6} lg={6}>
<FlightPlanAreaDetailContainer
handleModal={handleModal}
test={test}
isDone={isDone}
isDisabled={isDisabled}
/>
</Col>
</Row>

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

@ -7,7 +7,7 @@ import { initFlightBas } from '../../../../modules/basis/flight/models/basisFlig
import { InfoModal } from '../../../../components/modal/InfoModal';
import axios from '../../../../modules/utils/customAxiosUtil';
const FlightPlanAreaDetailContainer = ({ handleModal, test, isDone }) => {
const FlightPlanAreaDetailContainer = ({ handleModal, isDone, isDisabled }) => {
const dispatch = useDispatch();
const mapControl = useSelector(state => state.controlMapReducer);
@ -116,8 +116,8 @@ const FlightPlanAreaDetailContainer = ({ handleModal, test, isDone }) => {
areaCoordList={areaCoordList}
data={areaDetail}
mapControl={mapControl}
test={test}
isDone={isDone}
isDisabled={isDisabled}
/>
</Col>
<InfoModal modal={alertModal} setModal={setAlertModal} />

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

@ -21,6 +21,7 @@ const initModal = {
const FlightPlanDetailContainer = () => {
const dispatch = useDispatch();
const urlParams = useParams();
const { user } = useSelector(state => state.authState);
const flightState = useSelector(state => state.flightState);
const { detail, pilotSelect, arcrftSelect, areaList, selectGroup } =
flightState;
@ -33,25 +34,27 @@ const FlightPlanDetailContainer = () => {
desc: ''
});
//비행시작 후 수정 불가
const [date, setDate] = useState();
const [isDone, setIsDone] = useState();
useEffect(() => {
setDate('');
}, []);
useEffect(() => {
if (date) {
let cTime = new Date();
let pTime = new Date(date);
if (cTime > pTime) {
setIsDone(true);
// setIsDone(true);
} else {
setIsDone(false);
// setIsDone(false);
}
}
}, [date]);
//본인이 등록한 기체가 아니면 true
const [isDisabled, setIsDisabled] = useState(false);
useEffect(() => {
if (Object.keys(urlParams).length === 0 && urlParams.constructor === Object)
return;
@ -67,6 +70,16 @@ const FlightPlanDetailContainer = () => {
cstmrSno: sessionStorage.getItem('cstmrSno'),
groupId: sessionStorage.getItem('groupId')
});
// console.log(detail);
if (user?.authId === 'ADMIN' || user?.authId === 'USER') {
if (detail?.createUserId !== '') {
if (detail?.createUserId != user.userId) {
// console.log(detail.createUserId, user.userId);
setIsDisabled(true);
}
}
}
}, [detail]);
useEffect(() => {
@ -543,6 +556,7 @@ const FlightPlanDetailContainer = () => {
handleAddArray={handleAddArray}
handleDeleteArray={handleDeleteArray}
isDone={isDone}
isDisabled={isDisabled}
// handlerSave={
// pageType === 'create' ? handlerCreate : handlerUpdate
// }

Loading…
Cancel
Save