diff --git a/src/containers/laanc/LaancPlanContainer.js b/src/containers/laanc/LaancPlanContainer.js index 29e9884c..d5132751 100644 --- a/src/containers/laanc/LaancPlanContainer.js +++ b/src/containers/laanc/LaancPlanContainer.js @@ -37,7 +37,6 @@ export default function LaancPlanContainer({ const { user } = useSelector(state => state.authState); const dispatch = useDispatch(); - console.log('user>>>', user); useEffect(() => { setDetailData({ ...detailData, @@ -211,7 +210,7 @@ export default function LaancPlanContainer({ return false; } else if ( - !detailData.arcrftList[0].groupNm && + !detailData.arcrftList[0].idntfNum && (detailData.commercial === 'COMMERCIAL' || detailData.arcrftList[0].arcrftWdth == '9' || detailData.arcrftList[0].arcrftWdth == '10' || @@ -226,8 +225,7 @@ export default function LaancPlanContainer({ return false; } else { //api 호출 부분 - - dispatch(LaancAction.laancFlightApproval.request(detailData)); + dispatch(LaancAction.LAANC_FLIGHT_Approval.request(detailData)); setStep(2); } }; diff --git a/src/modules/laanc/actions/laancActions.ts b/src/modules/laanc/actions/laancActions.ts index 87ec2e6b..0cd2d910 100644 --- a/src/modules/laanc/actions/laancActions.ts +++ b/src/modules/laanc/actions/laancActions.ts @@ -17,6 +17,10 @@ const LAANC_FLIGHT_APPROVAL_REQUEST = 'laanc/approval/REQUEST'; const LAANC_FLIGHT_APPROVAL_SUCCESS = 'laanc/approval/SUCCESS'; const LAANC_FLIGHT_APPROVAL_FAILURE = 'laanc/approval/FAILURE'; +// laanc 비행계쐭서 생성 +const LAANC_FLIGHT_CREATE_REQUEST = 'laanc/create/REQUEST'; +const LAANC_FLIGHT_CREATE_SUCCESS = 'laanc/create/SUCCESS'; +const LAANC_FLIGHT_CREATE_FAILURE = 'laanc/create/FAILURE'; // laanc 공문 pdf 다운로드 export const laancPdfAction = createAsyncAction( LAANC_PDF_REQUEST, @@ -25,14 +29,22 @@ export const laancPdfAction = createAsyncAction( )(); // laanc 비행계획서 승인 -export const laancFlightApproval = createAsyncAction( +export const LAANC_FLIGHT_Approval = createAsyncAction( LAANC_FLIGHT_APPROVAL_REQUEST, LAANC_FLIGHT_APPROVAL_SUCCESS, LAANC_FLIGHT_APPROVAL_FAILURE )(); +// laanc 비행계획서 생성 +export const LAANC_FLIGHT_CREATE = createAsyncAction( + LAANC_FLIGHT_CREATE_REQUEST, + LAANC_FLIGHT_CREATE_SUCCESS, + LAANC_FLIGHT_CREATE_FAILURE +)(); + const actions = { laancPdfAction, - laancFlightApproval + LAANC_FLIGHT_Approval, + LAANC_FLIGHT_CREATE }; export type LaancAction = ActionType; diff --git a/src/modules/laanc/apis/laancApi.ts b/src/modules/laanc/apis/laancApi.ts index 2e992cab..262bc576 100644 --- a/src/modules/laanc/apis/laancApi.ts +++ b/src/modules/laanc/apis/laancApi.ts @@ -10,5 +10,9 @@ export const laancApi = { postApproval: async (data: FlightPlanData) => { const res = await axios.post(`api/bas/laanc/plan/valid`, data); return res; + }, + postCreate: async (data: FlightPlanData) => { + const res = await axios.post(`api/bas/laanc/plan/create`, data); + return res; } }; diff --git a/src/modules/laanc/models/laancModels.ts b/src/modules/laanc/models/laancModels.ts index d6964c5b..cc6a1e51 100644 --- a/src/modules/laanc/models/laancModels.ts +++ b/src/modules/laanc/models/laancModels.ts @@ -1,8 +1,8 @@ import moment from 'moment'; export interface laancState { - laancApproval: LaancApproval | undefined; detail: FlightPlanData | undefined; + laancApply: LaancApproval | undefined; } // laanc계획서 초기값 @@ -209,12 +209,32 @@ export const LaancFlightData = { // laanc 승인 model export interface LaancApproval { - pilotQlfcYn: string; // 자격여부 - acrftInsuranceYn: string; // 항공기보험여부 - acrftDuplicatedYn: string; // 기체 중복여부 - planAreaDuplicatdYn: string; // 비행계획서비행구역 중복여부 - evaluatedTargetAreaYn: string; // 평가대상지역여부 - 공역과 겹칠때만 - flightAreaYn: string; // LAANC 기준 비행가능여부 + validatedRs: { + pilotValidRsList: [ + { + rspCode: string; + rspMessage: string; + pilotcredentialyn: string; // 조종사자격여부 + arcrftinsuranceyn: string; // 항공기보험여부 + arcrftdeclaration: string; // 기체 중복 여부 + corpregyn: string; // 사업자 여부 + rq: { + pilotci: string; + }; + } + ]; + valid: boolean; // laanc 실질적인 true / false + arcrftWeight: boolean; // 25kg 이하 true + report: boolean; // 신고 대상 - 상업적이면서 기체 중량 2kg 이상일 경우 - True + elev: boolean; // 150m 이하 ture + arcrftInsurance: boolean; // 항공기 보험 여부 + flightArea: boolean; // 비행 가능 여부 + pilotQlfc: boolean; // 자격 여부 + arcrftDuplicated: boolean; // 기체 중복 여부 + evaluatedTargetArea: boolean; // 평가대상지역여부 - 공역과 겹칠때만 True + planAreaDuplicatd: boolean; // 비행 구역 중복 여부 + flight: boolean; // laanc 신청 필요 없음 + }; } export interface FlightPlanData { @@ -238,9 +258,8 @@ export interface FlightPlanData { updateUserId: string; updateDt: string; areaList?: FlightPlanAreaDataList | undefined; - pilotList?: FlightPlanPilotDataList | undefined; arcrftList?: FlightPlanArcrftDataList | undefined; - // docState: string + laanc?: LaancApproval | undefined; } export interface FlightPlanAreaData { @@ -255,7 +274,6 @@ export interface FlightPlanAreaData { updateUserId?: string; updateDt?: string; coordList?: FlightPlanAreaCoordDataList | undefined; - bufferCoordList?: FlightPlanAreaCoordDataList | undefined; // docState: string, } @@ -329,7 +347,7 @@ export interface FlightPlanArcrftData { export interface FlightPlanArcrftDataList extends Array {} export const laancControlData = { - laancApproval: undefined, + laancApply: undefined, detail: { planSno: 0, groupId: '', @@ -375,41 +393,9 @@ export const laancControlData = { createUserId: '', createDt: '' } - ], - bufferCoordList: [ - { - planAreaCoordSno: 0, - planAreaSno: 0, - lat: 0, - lon: 0, - createUserId: '', - createDt: '' - } ] } ], - - pilotList: [ - { - planPilotSno: 0, - planSno: 0, - cstmrSno: 0, - groupNm: '', - memberName: '', - email: '', - hpno: '', - clncd: '+82', - addr: '', - addrDtlCn: '', - zip: '', - qlfcNo: '', - carrer: '', - createUserId: '', - createDt: '', - updateUserId: '', - updateDt: '' - } - ], arcrftList: [ { planArcrftSno: 0, @@ -468,25 +454,6 @@ export const initFlightBas = { pilotList: undefined, arcrftList: undefined }, - pilot: { - planPilotSno: 0, - planSno: 0, - cstmrSno: 0, - groupNm: '', - memberName: '', - email: '', - hpno: '', - clncd: '+82', - addr: '', - addrDtlCn: '', - zip: '', - qlfcNo: '', - carrer: '', - createUserId: '', - createDt: '', - updateUserId: '', - updateDt: '' - }, arcrft: { planArcrftSno: 0, planSno: 0, @@ -577,40 +544,9 @@ export const initFlightBas = { createUserId: '', createDt: '' } - ], - bufferCoordList: [ - { - planAreaCoordSno: 0, - planAreaSno: 0, - lat: 0, - lon: 0, - createUserId: '', - createDt: '' - } ] } ], - pilotList: [ - { - planPilotSno: 0, - planSno: 0, - cstmrSno: 0, - groupNm: '', - memberName: '', - email: '', - hpno: '', - clncd: '+82', - addr: '', - addrDtlCn: '', - zip: '', - qlfcNo: '', - carrer: '', - createUserId: '', - createDt: '', - updateUserId: '', - updateDt: '' - } - ], arcrftList: [ { planArcrftSno: 0, diff --git a/src/modules/laanc/reducers/laancReducers.ts b/src/modules/laanc/reducers/laancReducers.ts index 7a1ab9d0..9a4247fd 100644 --- a/src/modules/laanc/reducers/laancReducers.ts +++ b/src/modules/laanc/reducers/laancReducers.ts @@ -16,9 +16,11 @@ import { export const laancReducer = createReducer( laancControlData -).handleAction(Actions.laancFlightApproval.success, (state, action) => +).handleAction(Actions.LAANC_FLIGHT_Approval.success, (state, action) => produce(state, draft => { - draft.detail = initFlightBas.initDetail; + const data = action.payload; + draft.laancApply = data; + // draft.detail = initFlightBas.initDetail; }) ); diff --git a/src/modules/laanc/sagas/laancSagas.ts b/src/modules/laanc/sagas/laancSagas.ts index 0349fa36..7bbeec8c 100644 --- a/src/modules/laanc/sagas/laancSagas.ts +++ b/src/modules/laanc/sagas/laancSagas.ts @@ -11,23 +11,56 @@ function* getLaancPdfsaga( // laanc 승인 여부 function* postApprovalsata( - action: ActionType + action: ActionType ) { try { const detail = action.payload; const res = yield call(Apis.laancApi.postApproval, detail); - const { data } = res; + // const { data } = res; + // yield put( + // MessageActions.IS_MESSAGE({ + // messageCode: SAVE_MESSAGE.code, + // message: SAVE_MESSAGE.message, + // isHistoryBack: true, + // isRefresh: false + // }) + // ); + yield put(Actions.LAANC_FLIGHT_Approval.success(res.data)); + } catch (error) { yield put( - MessageActions.IS_MESSAGE({ - messageCode: SAVE_MESSAGE.code, - message: SAVE_MESSAGE.message, - isHistoryBack: true, + MessageActions.IS_ERROR({ + errorCode: ERROR_MESSAGE.code, + errorMessage: ERROR_MESSAGE.message, + isHistoryBack: false, isRefresh: false }) ); + // yield put(Actions.FLIGHT_PLAN_CREATE.failure(error)); + } +} +// laanc 생성 +function* postCreatesata( + action: ActionType +) { + try { + const detail = action.payload; + + const res = yield call(Apis.laancApi.postCreate, detail); + + // const { data } = res; + + // yield put( + // MessageActions.IS_MESSAGE({ + // messageCode: SAVE_MESSAGE.code, + // message: SAVE_MESSAGE.message, + // isHistoryBack: true, + // isRefresh: false + // }) + // ); + yield put(Actions.LAANC_FLIGHT_CREATE.success(res.data)); } catch (error) { yield put( MessageActions.IS_ERROR({ @@ -40,8 +73,8 @@ function* postApprovalsata( // yield put(Actions.FLIGHT_PLAN_CREATE.failure(error)); } } - export function* laancSaga() { yield takeEvery(Actions.laancPdfAction.request, getLaancPdfsaga); - yield takeEvery(Actions.laancFlightApproval.request, postApprovalsata); + yield takeEvery(Actions.LAANC_FLIGHT_Approval.request, postApprovalsata); + yield takeEvery(Actions.LAANC_FLIGHT_CREATE.request, postCreatesata); } diff --git a/src/views/laanc/FlightArea.js b/src/views/laanc/FlightArea.js index f1704dc0..d951be6b 100644 --- a/src/views/laanc/FlightArea.js +++ b/src/views/laanc/FlightArea.js @@ -58,6 +58,8 @@ export default function FlightArea({ title: '', desc: '' }); + + console.log('>>>'); //날씨 임시 데이터 const [wheather, setWheather] = useState([]); @@ -359,6 +361,11 @@ export default function FlightArea({ name: 'addr', value: address.jibunAddress }); + handleChange({ + type: 'area', + name: 'areaType', + value: mapControl.drawType + }); } ); handleChange({ diff --git a/src/views/laanc/LaacnStep3.js b/src/views/laanc/LaacnStep3.js index e118c371..aef4e17b 100644 --- a/src/views/laanc/LaacnStep3.js +++ b/src/views/laanc/LaacnStep3.js @@ -17,7 +17,8 @@ import { } from 'reactstrap'; import { useHistory } from 'react-router-dom'; import FlightArea from './FlightArea'; -import { AlertCircle, CheckCircle } from 'react-feather'; +import LaancPdf from './LaancPdf'; +import { AlertCircle, CheckCircle, Download } from 'react-feather'; export default function LaacnStep3({ handlerStep, disabledAnimation, @@ -42,7 +43,13 @@ export default function LaacnStep3({ } }; const [centeredModal2, setCenteredModal2] = useState(false); + const [formModal, setFormModal] = useState(false); const { user } = useSelector(state => state.authState); + + const handlerClose = () => { + setFormModal(!formModal); + }; + return ( <> @@ -206,12 +213,25 @@ export default function LaacnStep3({
승인 공문
- + */} + + 공문 다운로드 + - @@ -268,6 +288,21 @@ export default function LaacnStep3({ + + pdf 미리보기 + + + + + + + ); } diff --git a/src/views/laanc/LaancPdf.js b/src/views/laanc/LaancPdf.js new file mode 100644 index 00000000..707264c2 --- /dev/null +++ b/src/views/laanc/LaancPdf.js @@ -0,0 +1,20 @@ +export default function LaancPdf() { + return ( + <> +

fff

+
+
+
+
+
+ pdf + sdffsdfsd +
+ sdfsdfsfd +
+
+
+
+ + ); +} diff --git a/src/views/laanc/LaancStep1.js b/src/views/laanc/LaancStep1.js index f922ec86..1b8c3af6 100644 --- a/src/views/laanc/LaancStep1.js +++ b/src/views/laanc/LaancStep1.js @@ -428,10 +428,10 @@ export default function LaancStep1({ { const { name, value } = e.target; diff --git a/src/views/laanc/LaancStep2.js b/src/views/laanc/LaancStep2.js index fdd4adf3..1aa25404 100644 --- a/src/views/laanc/LaancStep2.js +++ b/src/views/laanc/LaancStep2.js @@ -39,6 +39,7 @@ import { mapTypeChangeAction, sensorClickAction } from '../../modules/control/map/actions/controlMapActions'; +import * as LaancAction from '../../modules/laanc/actions/laancActions'; export default function LaancStep2({ data, @@ -63,24 +64,10 @@ export default function LaancStep2({ } }; const [isterms, setIsterms] = useState(false); - const [detailData, setDetailData] = useState(initFlightBas.initDetail); + const [flightData, setFlightData] = useState({}); const { user } = useSelector(state => state.authState); - - const history = useHistory(); - // 변경감지 - const handleChange = ({ name, value, type, index, pIndex }) => { - setDetailData(prevState => ({ - ...prevState, - [name]: value - })); - }; - const handleClick = value => { - handlerStep(value); - }; - const handlerLaanc = () => { - history.replace('/control'); - }; - + const { laancApply } = useSelector(state => state.laancState); + const dispatch = useDispatch(); // 소수점 6자리에서 반올림 하는 함수 const truncateToSixDecimalPlaces = number => { const decimalPlaces = 6; @@ -88,7 +75,31 @@ export default function LaancStep2({ return Math.round(number * multiplier) / multiplier; }; - console.log('>>>>>>>>>', data); + // 다음 버튼 + const handlerCreate = () => { + // data and laancapply 데이터 합치기 + setFlightData({ + ...data, + terms: [ + { + agreeYn: 'Y', + termsSno: 1 + } + ], + validatedRs: laancApply + }); + console.log('>>>', flightData); + // dispatch(LaancAction.LAANC_FLIGHT_CREATE.request(flightData)); + }; + + useEffect(() => { + if (flightData && Object.keys(flightData).length > 0) { + console.log('>>>', flightData); + + dispatch(LaancAction.LAANC_FLIGHT_CREATE.request(flightData)); + handlerStep(3); + } + }, [flightData]); return ( <> @@ -166,7 +177,6 @@ export default function LaancStep2({ @@ -484,7 +494,7 @@ export default function LaancStep2({