From 2e4ce5c265eaa57034189d14f692d2757c0c2428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?junh=5Feee=28=EC=9D=B4=EC=A4=80=ED=9D=AC=29?= Date: Thu, 25 Aug 2022 16:34:59 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=EB=B9=84=ED=96=89=EA=B3=84=ED=9A=8D?= =?UTF-8?q?=EC=84=9C=20-=20=EB=B9=84=ED=96=89=20=EC=8B=9C=EC=9E=91=20?= =?UTF-8?q?=EB=B0=8F=20=EC=A2=85=EB=A3=8C=20=EA=B3=84=ED=9A=8D=EC=84=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B6=88=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basis/flight/plan/FlightPlanForm.js | 189 +++++++++++++----- 1 file changed, 138 insertions(+), 51 deletions(-) diff --git a/src/components/basis/flight/plan/FlightPlanForm.js b/src/components/basis/flight/plan/FlightPlanForm.js index 33c3d051..adbd92ad 100644 --- a/src/components/basis/flight/plan/FlightPlanForm.js +++ b/src/components/basis/flight/plan/FlightPlanForm.js @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import { Card, CardBody, @@ -24,6 +24,34 @@ import { useDispatch, useSelector } from 'react-redux'; const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => { const {areaList, pilotList, arcrftList} = data; + const flightState = useSelector(state => state.flightState); + const { detail } = flightState; + + const [date ,setDate] = useState(); + const [isBigCurrent, setIsBigCurrent] = 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) { + setIsBigCurrent(true); + } else { + setIsBigCurrent(false); + } + } + }, [date]) + return ( @@ -69,6 +97,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele bsSize='sm' placeholder='' + { ...(isBigCurrent ? {readOnly:true} : {}) } /> @@ -84,7 +113,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele id='clncd' name='clncd' // defaultValue={data.clncd} - value={data.clncd || '+81'} + value={data.clncd || '+82'} bsSize='sm' placeholder='+82' onChange={(e) => { @@ -115,6 +144,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele }) }} placeholder='010-0000-0000' + { ...(isBigCurrent ? {readOnly:true} : {}) } /> @@ -140,6 +170,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele }} // innerRef={props.data} placeholder='' + { ...(isBigCurrent ? {readOnly:true} : {}) } /> @@ -157,24 +188,43 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele - { - const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; - handleChange({ - type: 'plan', - name: 'schFltStDt', - value - }) - }} - placeholder='비행 시작일자 선택(클릭)'/> - + { + (isBigCurrent) ? + ( + + ) + : + ( + { + const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; + handleChange({ + type: 'plan', + name: 'schFltStDt', + value + }) + }} + placeholder='비행 시작일자 선택(클릭)' + {...{options:{minDate: "today"}}} + /> + ) + } @@ -182,23 +232,43 @@ 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='비행 종료일자 선택(클릭)'/> - + { + (isBigCurrent) ? + ( + + ) + : + ( + { + const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; + handleChange({ + type: 'plan', + name: 'schFltEndDt', + value + }) + }} + placeholder='비행 종료일자 선택(클릭)' + {...{options:{minDate: "today"}}} + /> + ) + } @@ -207,7 +277,8 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele *비행 목적 {/* TODO CDNOT 코드연동 필요 */} - - - - - - - + { isBigCurrent ? + <> + : + <> + + + + + + + + + } @@ -246,9 +324,10 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele

비행 구역 정보

{ + onClick={(e) => { handleModal({target: 'area', isOpen: true}) - }} + }} + {...(isBigCurrent)? {disabled:true} : {} } > 비행 구역 설정 @@ -268,6 +347,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele onClick={(e) => { handleModal({target: 'pilot', isOpen: true}) }} + {...(isBigCurrent)? {disabled:true} : {} } > 조종사 조회 @@ -278,7 +358,8 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele index={i} data={item} handleChange={handleChange} - handleDeleteArray ={handleDeleteArray}/>) + handleDeleteArray ={handleDeleteArray} + isBigCurrent={isBigCurrent}/>) : } @@ -290,6 +371,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele onClick={(e) => { handleModal({target: 'arcrft', isOpen: true}); }} + {...(isBigCurrent)? {disabled:true} : {} } > 기체 조회 @@ -300,7 +382,8 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele index={i} data={item} handleChange={handleChange} - handleDeleteArray ={handleDeleteArray}/>) + handleDeleteArray ={handleDeleteArray} + isBigCurrent={isBigCurrent}/>) : } @@ -312,6 +395,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele color='primary' size='sm' onClick={handleSave} + {...(isBigCurrent)? {disabled:true} : {} } > 저장 @@ -319,6 +403,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele color='danger' size='sm' onClick={handleDelete} + {...(isBigCurrent)? {disabled:true} : {} } > 삭제 @@ -517,7 +602,7 @@ const AreaForm = ({data, handleChange, index}) => {
) } -const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { +const PilotForm = ({data, handleChange, index, handleDeleteArray, isBigCurrent}) => { return (
@@ -634,6 +719,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { handleDeleteArray({ type: 'pilot', index }) } outline + {...(isBigCurrent)? {disabled:true} : {} } > 삭제 @@ -650,7 +736,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { } -const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { +const ArcrftForm = ({data, handleChange, index, handleDeleteArray, isBigCurrent}) => { return (
@@ -791,6 +877,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { handleDeleteArray({ type: 'arcrft', index }) } outline + {...(isBigCurrent)? {disabled:true} : {} } > 삭제 From c671d07a39afa7435bfdc8e476e77398106f82ee Mon Sep 17 00:00:00 2001 From: geun <1416geun@naver.com> Date: Thu, 25 Aug 2022 16:56:53 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=EB=B9=84=ED=96=89=EA=B3=84=ED=9A=8D?= =?UTF-8?q?=EC=8B=A0=EC=B2=AD=EC=84=9C=20=EC=82=AD=EC=A0=9C=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/css/custom.css | 11 +++- .../basis/flight/plan/FlightPlanForm.js | 57 +++++++++---------- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/assets/css/custom.css b/src/assets/css/custom.css index 7afb0e1e..84834457 100644 --- a/src/assets/css/custom.css +++ b/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: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-name{color:#00cfe8;margin:0 10px 0 0;} \ No newline at end of file +.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; + } +} diff --git a/src/components/basis/flight/plan/FlightPlanForm.js b/src/components/basis/flight/plan/FlightPlanForm.js index 33c3d051..7f612e93 100644 --- a/src/components/basis/flight/plan/FlightPlanForm.js +++ b/src/components/basis/flight/plan/FlightPlanForm.js @@ -158,7 +158,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele *비행시작일자 *비행종료일자 {
- + - {data.groupNm? - ( - - - handleDeleteArray({ type: 'pilot', index }) - } - outline - > - - 삭제 - - - ) - : - ( - <> - ) - } + + {data.groupNm? + ( + + handleDeleteArray({ type: 'pilot', index }) + } + > + + + + ) + : + ( + <> + ) + } +
) } @@ -734,7 +733,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { /> - + @@ -115,6 +143,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele }) }} placeholder='010-0000-0000' + { ...(isFlightDone ? {readOnly:true} : {}) } /> @@ -140,6 +169,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele }} // innerRef={props.data} placeholder='' + { ...(isFlightDone ? {readOnly:true} : {}) } /> @@ -157,23 +187,43 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele - { - const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; - handleChange({ - type: 'plan', - name: 'schFltStDt', - value - }) - }} - placeholder='비행 시작일자 선택(클릭)'/> + { + (isFlightDone) ? + ( + + ) + : + ( + { + const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; + handleChange({ + type: 'plan', + name: 'schFltStDt', + value + }) + }} + placeholder='비행 시작일자 선택(클릭)' + {...{options:{minDate: "today"}}} + /> + ) + } @@ -182,23 +232,43 @@ 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='비행 종료일자 선택(클릭)'/> - + { + (isFlightDone) ? + ( + + ) + : + ( + { + const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; + handleChange({ + type: 'plan', + name: 'schFltEndDt', + value + }) + }} + placeholder='비행 종료일자 선택(클릭)' + {...{options:{minDate: "today"}}} + /> + ) + } @@ -207,7 +277,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele *비행 목적 {/* TODO CDNOT 코드연동 필요 */} - - - - - - - - + { isFlightDone ? + <> + : + <> + + + + + + + + + } + @@ -249,6 +326,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele onClick={(e) => { handleModal({target: 'area', isOpen: true}) }} + {...(isFlightDone)? {disabled:true} : {} } > 비행 구역 설정 @@ -268,6 +346,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele onClick={(e) => { handleModal({target: 'pilot', isOpen: true}) }} + {...(isFlightDone)? {disabled:true} : {} } > 조종사 조회 @@ -278,7 +357,9 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele index={i} data={item} handleChange={handleChange} - handleDeleteArray ={handleDeleteArray}/>) + handleDeleteArray ={handleDeleteArray} + isFlightDone={isFlightDone} + />) : } @@ -290,6 +371,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele onClick={(e) => { handleModal({target: 'arcrft', isOpen: true}); }} + {...(isFlightDone)? {disabled:true} : {} } > 기체 조회 @@ -300,7 +382,9 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele index={i} data={item} handleChange={handleChange} - handleDeleteArray ={handleDeleteArray}/>) + handleDeleteArray ={handleDeleteArray} + isFlightDone={isFlightDone} + />) : } @@ -312,6 +396,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele color='primary' size='sm' onClick={handleSave} + {...(isFlightDone)? {disabled:true} : {} } > 저장 @@ -319,6 +404,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele color='danger' size='sm' onClick={handleDelete} + {...(isFlightDone)? {disabled:true} : {} } > 삭제 @@ -517,7 +603,7 @@ const AreaForm = ({data, handleChange, index}) => { ) } -const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { +const PilotForm = ({data, handleChange, index, handleDeleteArray, isFlightDone}) => { return (
@@ -633,6 +719,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { onClick={() => handleDeleteArray({ type: 'pilot', index }) } + {...(isFlightDone)? {disabled:true} : {} } > @@ -649,7 +736,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { } -const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { +const ArcrftForm = ({data, handleChange, index, handleDeleteArray, isFlightDone}) => { return (
@@ -789,6 +876,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { onClick={() => handleDeleteArray({ type: 'arcrft', index }) } + {...(isFlightDone)? {disabled:true} : {} } >