diff --git a/src/modules/basis/flight/models/basisFlightModel.ts b/src/modules/basis/flight/models/basisFlightModel.ts index 52a8f947..dbc18103 100644 --- a/src/modules/basis/flight/models/basisFlightModel.ts +++ b/src/modules/basis/flight/models/basisFlightModel.ts @@ -404,12 +404,8 @@ export const initFlightBas = { addr: '', addrDtlCn: '', zip: '', - schFltStDt: moment() - .set({ h: 0, m: 0, s: 0 }) - .format('YYYY-MM-DD HH:mm:ss'), - schFltEndDt: moment() - .set({ h: 0, m: 0, s: 0 }) - .format('YYYY-MM-DD HH:mm:ss'), + schFltStDt: moment().format('YYYY-MM-DD HH:mm:ss'), + schFltEndDt: moment().format('YYYY-MM-DD HH:mm:ss'), fltPurpose: '', aprvlYn: '', delYn: '', @@ -499,12 +495,8 @@ export const initFlightBas = { addr: '', addrDtlCn: '', zip: '', - schFltStDt: moment() - .set({ h: 0, m: 0, s: 0 }) - .format('YYYY-MM-DD HH:mm:ss'), - schFltEndDt: moment() - .set({ h: 0, m: 0, s: 0 }) - .format('YYYY-MM-DD HH:mm:ss'), + schFltStDt: moment().format('YYYY-MM-DD HH:mm:ss'), + schFltEndDt: moment().format('YYYY-MM-DD HH:mm:ss'), fltPurpose: '', aprvlYn: '', delYn: '', diff --git a/src/modules/laanc/actions/laancActions.ts b/src/modules/laanc/actions/laancActions.ts new file mode 100644 index 00000000..21356c02 --- /dev/null +++ b/src/modules/laanc/actions/laancActions.ts @@ -0,0 +1,34 @@ +import { AxiosError } from 'axios'; +import { create } from 'sortablejs'; +import { ActionType, createAction, createAsyncAction } from 'typesafe-actions'; +import { LaancFlightData, LaancApproval } from '../models/laancModels'; + +// laanc 공문 pdf 다운로드 +const LAANC_PDF_REQUEST = 'laanc/pdf/REQUEST'; +const LAANC_PDF_SUCCESS = 'laanc/pdf/SUCCESS'; +const LAANC_PDF_FAILURE = 'laanc/pdf/FAILURE'; + +// laanc 비행계획서 승인 +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 공문 pdf 다운로드 +export const laancPdfAction = createAsyncAction( + LAANC_PDF_REQUEST, + LAANC_PDF_SUCCESS, + LAANC_PDF_FAILURE +)(); + +// laanc 비행계획서 승인 +export const laancFlightApproval = createAsyncAction( + LAANC_FLIGHT_APPROVAL_REQUEST, + LAANC_FLIGHT_APPROVAL_SUCCESS, + LAANC_FLIGHT_APPROVAL_FAILURE +)(); + +const actions = { + laancPdfAction, + laancFlightApproval +}; +export type LaancAction = ActionType; diff --git a/src/modules/laanc/apis/laancApi.ts b/src/modules/laanc/apis/laancApi.ts new file mode 100644 index 00000000..bcdc54f8 --- /dev/null +++ b/src/modules/laanc/apis/laancApi.ts @@ -0,0 +1,13 @@ +import axios from '../../utils/customAxiosUtil'; +import {} from '../models/laancModels'; + +// laanc 승인 +// export const laancApprovalApi = { +// postApproval: async (rq:) => { +// const { data }: ResponseApprovalData = await axios.post( +// `api/ctr/cntrl/history/list/${id}` +// ); + +// return data; +// }, +// } diff --git a/src/modules/laanc/models/laancModels.ts b/src/modules/laanc/models/laancModels.ts new file mode 100644 index 00000000..99f4b679 --- /dev/null +++ b/src/modules/laanc/models/laancModels.ts @@ -0,0 +1,221 @@ +import moment from 'moment'; + +export interface laancState { + laancApproval: LaancApproval | undefined; +} + +// laanc계획서 초기값 +export const LaancFlightData = { + page: 1, + total: 0, + plan: { + planSno: 0, + groupId: '', + cstmrSno: 0, + memberName: '', + email: '', + hpno: '', + clncd: '+82', + addr: '', + addrDtlCn: '', + zip: '', + schFltStDt: moment().format('YYYY-MM-DD HH:mm:ss'), + schFltEndDt: moment().format('YYYY-MM-DD HH:mm:ss'), + fltPurpose: '', + aprvlYn: '', + delYn: '', + createUserId: '', + createDt: '', + updateUserId: '', + updateDt: '', + areaList: undefined, + 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, + arcrftSno: 0, + idntfNum: '', + groupNm: '', + prdctNum: '', + arcrftTypeCd: '', + arcrftModelNm: '', + prdctCmpnNm: '', + prdctDate: '', + arcrftLngth: 0, + arcrftWdth: 0, + arcrftHght: 0, + arcrftWght: 0, + wghtTypeCd: '', + imageUrl: '', + takeoffWght: 0, + useYn: '', + cameraYn: '', + insrncYn: '', + ownerNm: '', + createUserId: '', + createDt: '', + updateUserId: '', + updateDt: '' + }, + area: { + planAreaSno: 0, + planSno: 0, + areaType: '', + fltMethod: '', + bufferZone: 0, + fltElev: '', + createUserId: '', + createDt: '', + updateUserId: '', + updateDt: '', + coordList: undefined + }, + coord: { + planAreaCoordSno: 0, + planAreaSno: 0, + lat: 0, + lon: 0, + createUserId: '', + createDt: '' + }, + initDetail: { + planSno: 0, + groupId: '', + cstmrSno: 0, + memberName: '', + email: '', + hpno: '', + clncd: '+82', + addr: '', + addrDtlCn: '', + zip: '', + schFltStDt: moment().format('YYYY-MM-DD HH:mm:ss'), + schFltEndDt: moment().format('YYYY-MM-DD HH:mm:ss'), + fltPurpose: '', + aprvlYn: '', + delYn: '', + createUserId: '', + createDt: '', + updateUserId: '', + updateDt: '', + areaList: [ + { + planAreaSno: 0, + planSno: 0, + areaType: '', + fltMethod: '', + bufferZone: 0, + fltElev: '', + createUserId: '', + createDt: '', + updateUserId: '', + updateDt: '', + coordList: [ + { + planAreaCoordSno: 0, + planAreaSno: 0, + lat: 0, + lon: 0, + 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, + planSno: 0, + arcrftSno: 0, + idntfNum: '', + groupNm: '', + prdctNum: '', + arcrftTypeCd: '', + arcrftModelNm: '', + prdctCmpnNm: '', + prdctDate: '', + arcrftLngth: 0, + arcrftWdth: 0, + arcrftHght: 0, + arcrftWght: 0, + wghtTypeCd: '', + imageUrl: '', + takeoffWght: 0, + useYn: '', + cameraYn: '', + insrncYn: '', + ownerNm: '', + createUserId: '', + createDt: '', + updateUserId: '', + updateDt: '' + } + ] + } +}; + +// laanc 승인 model +export interface LaancApproval { + pilotQlfcYn: string; // 자격여부 + acrftInsuranceYn: string; // 항공기보험여부 + acrftDuplicatedYn: string; // 기체 중복여부 + planAreaDuplicatdYn: string; // 비행계획서비행구역 중복여부 + evaluatedTargetAreaYn: string; // 평가대상지역여부 - 공역과 겹칠때만 + flightAreaYn: string; // LAANC 기준 비행가능여부 +} + +export const laancControlData = { + laancApproval: undefined +}; diff --git a/src/modules/laanc/reducers/laancReducers.ts b/src/modules/laanc/reducers/laancReducers.ts new file mode 100644 index 00000000..16afadd9 --- /dev/null +++ b/src/modules/laanc/reducers/laancReducers.ts @@ -0,0 +1,26 @@ +// base +import produce from 'immer'; + +import { createReducer } from 'typesafe-actions'; + +import * as Actions from '../actions/laancActions'; +// action +import { laancPdfAction } from '../actions/laancActions'; + +import { + LaancFlightData, + laancState, + laancControlData +} from '../models/laancModels'; + +export const laancReducer = createReducer( + laancControlData +).handleAction(Actions.laancFlightApproval.success, (state, action) => + produce(state, draft => { + // laanc 승인 처리 + const data = action.payload; + draft.laancApproval = data; + }) +); + +export default laancReducer; diff --git a/src/modules/laanc/sagas/laancSagas.ts b/src/modules/laanc/sagas/laancSagas.ts new file mode 100644 index 00000000..9114e26d --- /dev/null +++ b/src/modules/laanc/sagas/laancSagas.ts @@ -0,0 +1,18 @@ +import { call, put, select, takeEvery } from '@redux-saga/core/effects'; +import * as Actions from '../actions/laancActions'; +import { ActionType } from 'typesafe-actions'; + +// pdf 연결 +function* getLaancPdfsaga( + action: ActionType +) {} + +// laanc 승인 여부 +function* postApprovalsata( + action: ActionType +) {} + +export function* laancSaga() { + yield takeEvery(Actions.laancPdfAction.request, getLaancPdfsaga); + yield takeEvery(Actions.laancFlightApproval.request, postApprovalsata); +} diff --git a/src/redux/reducers/rootReducer.ts b/src/redux/reducers/rootReducer.ts index a70db3b6..4b476607 100644 --- a/src/redux/reducers/rootReducer.ts +++ b/src/redux/reducers/rootReducer.ts @@ -44,6 +44,8 @@ import { loadingReducer } from './loading'; import { flightReducer } from '../../modules/basis/flight/reducers/basisFlightReducer'; import { flightSaga } from '../../modules/basis/flight/sagas/basisFlightSaga'; +import { laancSaga } from '../../modules/laanc/sagas/laancSagas'; +import laancReducer from '../../modules/laanc/reducers/laancReducers'; export interface StoreState { controlGpState: ControlGpState; @@ -60,6 +62,7 @@ export function* saga() { yield all([fork(analysisSimulatorSaga)]); yield all([fork(flightSaga)]); yield all([fork(findSaga)]); + yield all([fork(laancSaga)]); } const rootReducer = combineReducers({ @@ -75,6 +78,7 @@ const rootReducer = combineReducers({ authState: authReducer, accountState: accountReducer, UserPageState: mypageReducer, + laancState: laancReducer, UserPwState: userPwReducer, controlGpState: controlGpReducer, controlGpHisState: controlGpHisReducer, diff --git a/src/views/laanc/Apply.js b/src/views/laanc/Apply.js index 45dee4f7..43fc05da 100644 --- a/src/views/laanc/Apply.js +++ b/src/views/laanc/Apply.js @@ -33,7 +33,7 @@ import { sensorClickAction } from '../../modules/control/map/actions/controlMapActions'; -const Apply = props => { +const Apply = ({ data, handlerStep }) => { const [detailData, setDetailData] = useState(initFlightBas.initDetail); const history = useHistory(); @@ -45,7 +45,7 @@ const Apply = props => { })); }; const handleClick = value => { - props.handlerStep(value); + handlerStep(value); }; const handlerLaanc = () => { history.replace('/control'); @@ -134,7 +134,7 @@ const Apply = props => { name='schFltStDt' data-enable-time // defaultValue={data.schFltStDt} - // value={data.schFltStDt} + value={data.schFltStDt} onChange={date => { const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || @@ -145,6 +145,7 @@ const Apply = props => { }); }} placeholder='비행 시작일자 선택(클릭)' + disabled /> @@ -161,7 +162,7 @@ const Apply = props => { name='schFltEndDt' data-enable-time // defaultValue={data.schFltEndDt} - // value={data.schFltEndDt} + value={data.schFltEndDt} onChange={date => { const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || @@ -171,6 +172,7 @@ const Apply = props => { value }); }} + disabled placeholder='비행 종료일자 선택(클릭)' // {...{options:{minDate: "today"}}} /> @@ -185,7 +187,7 @@ const Apply = props => { type='select' id='fltPurpose' name='fltPurpose' - // value={data.fltPurpose} + value={data.fltPurpose} bsSize='sm' onChange={e => { const { name, value } = e.target; @@ -195,6 +197,7 @@ const Apply = props => { value }); }} + disabled // innerRef={props.data} // className={classnames({ // 'is-invalid': props.errors.arcrftTypeCd @@ -226,21 +229,22 @@ const Apply = props => { { const { name, value } = e.target; handleChange({ - type: 'plan', + type: 'area', name, value }); }} - // innerRef={props.data} + // innerRef={data} placeholder='100m' + disabled /> @@ -251,21 +255,22 @@ const Apply = props => { { const { name, value } = e.target; handleChange({ - type: 'plan', + type: 'area', name, value }); }} - // innerRef={props.data} + // innerRef={data} placeholder='100m' + disabled /> @@ -276,21 +281,22 @@ const Apply = props => { { const { name, value } = e.target; handleChange({ - type: 'plan', + type: 'area', name, value }); }} - // innerRef={props.data} + // innerRef={data} placeholder='' + disabled /> diff --git a/src/views/laanc/LeftMenu.js b/src/views/laanc/LeftMenu.js index fa36cebb..237195fa 100644 --- a/src/views/laanc/LeftMenu.js +++ b/src/views/laanc/LeftMenu.js @@ -100,6 +100,7 @@ function LeftMenu() { } }; + console.log('>>>>', detailData); // 스텝 1 다음 버튼 이벤트 const handlerNext = () => { const reg_email = @@ -120,7 +121,6 @@ function LeftMenu() { title: '필수값 입력 오류', desc: '이름을 입력해 주세요.' }); - return false; } else if (!check_num.test(detailData.pilotList[0].hpno)) { setModal2({ @@ -250,7 +250,8 @@ function LeftMenu() { handlerWeather={handlerWeather} /> )} - {step === 2 && } + + {step === 2 && }