diff --git a/src/components/basis/flight/plan/FlightPlanForm.js b/src/components/basis/flight/plan/FlightPlanForm.js
index 77ad37c0..540e3897 100644
--- a/src/components/basis/flight/plan/FlightPlanForm.js
+++ b/src/components/basis/flight/plan/FlightPlanForm.js
@@ -11,6 +11,8 @@ import {
} from 'reactstrap';
import Flatpickr from 'react-flatpickr';
import '@styles/react/libs/flatpickr/flatpickr.scss';
+import moment from 'moment';
+
const FlightPlanForm = (props) => {
@@ -48,12 +50,10 @@ const FlightPlanForm = (props) => {
@@ -69,7 +69,9 @@ const FlightPlanForm = (props) => {
id='clncd'
name='clncd'
size='sm'
- placeholder='+82'
+ placeholder='+82'
+ value='+82'
+
readOnly
/>
@@ -79,6 +81,7 @@ const FlightPlanForm = (props) => {
id='hpno'
name='hpno'
size='sm'
+ onChange={props.onChange}
placeholder='010-0000-0000'
@@ -94,6 +97,7 @@ const FlightPlanForm = (props) => {
id='email'
name='email'
size='sm'
+ onChange={props.onChange}
// innerRef={props.data}
placeholder=''
/>
@@ -151,6 +155,10 @@ const FlightPlanForm = (props) => {
type='text'
id='schFltStDt'
name='schFltStDt'
+ value={props.schFltStDt}
+ onChange={val =>
+ props.handlerInput(val)
+ }
// innerRef={props.data}
placeholder='비행 시작일자 선택(클릭)'/>
@@ -159,13 +167,17 @@ const FlightPlanForm = (props) => {
+ props.handlerInput(val)
+ }
// innerRef={props.data}
placeholder='비행 종료일자 선택(클릭)'/>
@@ -181,12 +193,19 @@ const FlightPlanForm = (props) => {
name='fltPurpose'
id='fltPurpose'
size='sm'
+ onChange={props.onChange}
// innerRef={props.data}
// className={classnames({
// 'is-invalid': props.errors.arcrftTypeCd
// })}
>
+
+
+
+
+
+
{/* CDNOT 코드연동 필요 */}
{/* {ARCTFT_TYPE_CD.map(item => {
return (
@@ -289,11 +308,12 @@ const FlightPlanForm = (props) => {
@@ -308,18 +328,20 @@ const FlightPlanForm = (props) => {
id='fltElev'
name='fltElev'
size='sm'
- placeholder='반경'
- readOnly
+ placeholder='반경'
+ onChange={props.onChange}
+
/>
@@ -335,11 +357,12 @@ const FlightPlanForm = (props) => {
@@ -354,7 +377,8 @@ const FlightPlanForm = (props) => {
name='fltMethod'
size='sm'
placeholder=''
- readOnly
+ onChange={props.onChange}
+
/>
@@ -365,11 +389,12 @@ const FlightPlanForm = (props) => {
@@ -399,8 +424,9 @@ const FlightPlanForm = (props) => {
id='groupNm'
name='groupNm'
size='sm'
- placeholder=''
- readOnly
+ placeholder=''
+ onChange={props.onChange}
+
/>
@@ -411,11 +437,12 @@ const FlightPlanForm = (props) => {
@@ -434,18 +461,20 @@ const FlightPlanForm = (props) => {
id='clncd'
name='clncd'
size='sm'
- placeholder='+82'
- readOnly
+ placeholder='+82'
+ onChange={props.onChange}
+
/>
@@ -458,11 +487,12 @@ const FlightPlanForm = (props) => {
@@ -488,11 +518,12 @@ const FlightPlanForm = (props) => {
@@ -507,7 +538,8 @@ const FlightPlanForm = (props) => {
name='arcrftModelNm'
size='sm'
placeholder=''
- readOnly
+ onChange={props.onChange}
+
/>
@@ -526,7 +558,8 @@ const FlightPlanForm = (props) => {
name='arcrftTypeCd'
size='sm'
placeholder=''
- readOnly
+ onChange={props.onChange}
+
/>
@@ -541,7 +574,8 @@ const FlightPlanForm = (props) => {
name='ownerNm'
size='sm'
placeholder=''
- readOnly
+ onChange={props.onChange}
+
/>
diff --git a/src/containers/basis/flight/plan/FlightPlanDetailContainer.js b/src/containers/basis/flight/plan/FlightPlanDetailContainer.js
index 24e4be22..3eb53db4 100644
--- a/src/containers/basis/flight/plan/FlightPlanDetailContainer.js
+++ b/src/containers/basis/flight/plan/FlightPlanDetailContainer.js
@@ -9,6 +9,8 @@ import * as yup from 'yup';
import { yupResolver } from '@hookform/resolvers/yup';
import * as Actions from '../../../../modules/basis/flight/actions/basisFlightAction';
import { useForm } from 'react-hook-form';
+import moment from 'moment';
+import { Save } from 'react-feather';
const FlightPlanDetailContainer = props => {
const dispatch = useDispatch();
@@ -20,20 +22,38 @@ const FlightPlanDetailContainer = props => {
isOpen: false,
title: '',
});
+
const { listFlightP, flightCount, isRefreshFlight } = useSelector(
state => state.flightState
);
const [flightPlanData, setFlightPlanData] = useState({
- id: '',
- memberName: '',
- clncd: '',
- hpno: '',
+ id:'',
+ memberName:'',
+ clncd: '+82',
+ hpno:'',
email:'',
- createDt: '',
- createUserId: '',
- updateUserId: '',
- updateDt: ''
+ lonlat:'',
+ lonlat2:'',
+ lonlat3:'',
+ fltElev:'',
+ fltHight:'',
+ fltMethod:'',
+ groupNm:'',
+ pilotName:'',
+ pilotHpno:'',
+ pilotEmail:'',
+ aGroupNm:'',
+ arcrftModelNm:'',
+ arcrftTypeCd:'',
+ ownerNm:'',
+ createUserId:'',
+ updateUserId:''
});
+ const [params, setParams] = useState({
+ schFltStDt: moment().subtract(1, 'day').format('YYYY-MM-DD'),
+ schFltEndDt: moment().subtract(-1, 'day').format('YYYY-MM-DD'),
+ search1: ''
+ });
useEffect(() => {
console.log('isRefreshFlight>>>>', isRefreshFlight);
if (isRefreshFlight) {
@@ -81,21 +101,30 @@ const FlightPlanDetailContainer = props => {
}
const handlerCreate = async data => {
console.log('data>>>>>', data);
- console.log('flightPlanData>>>',flightPlanData);
- let saveArr = flightPlanData;
+ console.log('flightPlanData>>>',{flightPlanData, params});
+ let saveArr = {flightPlanData, params};
dispatch(
Actions.FLIGHT_PLAN_CREATE.request({
data: saveArr
})
);
};
+ const handlerInput = (val) => {
+ setParams({
+ ...params,
+ schFltStDt: moment(val[1]).format('YYYY-MM-DD'),
+ schFltEndDt: moment(val[0]).format('YYYY-MM-DD')
+ });
+ };
const onChange = (e) => {
+
setFlightPlanData({
...flightPlanData,
[e.target.name]: e.target.value,
});
};
-
+
+
const handlerDelete = async data => {
// dispatch(Actions.IDNTF_DELETE.request(data.arcrftSno));
};
@@ -109,11 +138,13 @@ const FlightPlanDetailContainer = props => {
data={flightPlanData}
openModal={openModal}
areaInfo={areaInfo}
+ params={params}
handlerSave={
pageType === 'create' ? handlerCreate : handlerUpdate
}
onChange={onChange}
handlerDelete={handlerDelete}
+ handlerInput={handlerInput}
/>
{
return await axios.get(`api/bas/flight/area`);
- }
+ },
+ Create: async (data: FlightPlanData) => {
+ console.log(data);
+
+ const res = await axios.post('api/bas/flight/create', data);
+ console.log('res>>>>', res);
+
+ return res;
+ }
}
\ No newline at end of file
diff --git a/src/modules/basis/flight/models/basisFlightModel.ts b/src/modules/basis/flight/models/basisFlightModel.ts
index e0800537..6afe7a4c 100644
--- a/src/modules/basis/flight/models/basisFlightModel.ts
+++ b/src/modules/basis/flight/models/basisFlightModel.ts
@@ -1,6 +1,7 @@
export interface FlightState {
areaList: FlightAreaData | undefined
flightPlanArea: FlightPlanArea | undefined
+ flightPlanData: FlightPlanData | undefined
}
export interface FlightAreaData {
@@ -16,15 +17,29 @@ export interface FlightPlanArea {
}
export interface FlightPlanData {
- id: '',
- memberName: '',
- clncd: '',
- hpno: '',
- email:'',
- createDt: '',
- createUserId: '',
- updateUserId: '',
- updateDt: ''
+ id:string;
+ memberName:string;
+ clncd:string;
+ hpno:string;
+ email:string;
+ lonlat:string;
+ lonlat2:string;
+ lonlat3:string;
+ fltElev:string;
+ fltHight:string;
+ fltMethod:string;
+ groupNm:string;
+ pilotName:string;
+ pilotHpno:string;
+ pilotEmail:string;
+ aGroupNm:string;
+ arcrftModelNm:string;
+ arcrftTypeCd:string;
+ ownerNm:string;
+ createUserId:string;
+ updateUserId:string;
+ schFltStDt:Date;
+ schFltEndDt:Date;
}
export const initFlight = {
diff --git a/src/modules/basis/flight/reducers/basisFlightReducer.ts b/src/modules/basis/flight/reducers/basisFlightReducer.ts
index 708445ad..bfaa0e7a 100644
--- a/src/modules/basis/flight/reducers/basisFlightReducer.ts
+++ b/src/modules/basis/flight/reducers/basisFlightReducer.ts
@@ -18,4 +18,10 @@ export const flightReducer = createReducer (
const data = action.payload;
draft.flightPlanArea = data;
})
+)
+.handleAction(Actions.FLIGHT_PLAN_CREATE.request, (state, action) =>
+ produce(state, draft => {
+ const data = action.payload;
+ draft.flightPlanData = data;
+ })
)
\ No newline at end of file
diff --git a/src/modules/basis/flight/sagas/basisFlightSaga.ts b/src/modules/basis/flight/sagas/basisFlightSaga.ts
index 82362ef7..07ee9985 100644
--- a/src/modules/basis/flight/sagas/basisFlightSaga.ts
+++ b/src/modules/basis/flight/sagas/basisFlightSaga.ts
@@ -54,8 +54,56 @@ function* createFlightPlanArea(action: ActionType
+ ) {
+ try {
+ const detail = action.payload;
+
+ console.log('detail>>>:', detail);
+ const res = yield call(Apis.flightPlanAPI.Create, detail);
+ console.log(res);
+ const { data } = res;
+ console.log('data:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', data.result);
+ if (data.result) {
+ yield put(
+ MessageActions.IS_MESSAGE({
+ messageCode: SAVE_MESSAGE.code,
+ message: SAVE_MESSAGE.message,
+ isHistoryBack: false,
+ isRefresh: false
+ })
+ );
+ yield put(Actions.FLIGHT_PLAN_CREATE.success(data));
+ } else {
+ console.log('errorCode >>> ', data.errorCode);
+ if (data.errorCode === 'DT002') {
+ yield put(
+ MessageActions.IS_ERROR({
+ errorCode: DUPLATE_MESSAGE.code,
+ errorMessage: '식별번호가 ' + DUPLATE_MESSAGE.message,
+ isHistoryBack: false,
+ isRefresh: false
+ })
+ );
+ } else {
+ throw Error;
+ }
+ }
+ } catch (error) {
+ yield put(
+ MessageActions.IS_ERROR({
+ errorCode: ERROR_MESSAGE.code,
+ errorMessage: ERROR_MESSAGE.message,
+ isHistoryBack: false,
+ isRefresh: false
+ })
+ );
+ // yield put(Actions.GROUP_CREATE.failure(error));
+ }
+ }
export function* flightSaga() {
yield takeEvery(Actions.AREA_LIST.request, listAreaSaga);
yield takeEvery(Actions.FLIGHT_PLAN_AREA.request, createFlightPlanArea);
+ yield takeEvery(Actions.FLIGHT_PLAN_CREATE.request, createFlightPlanData)
}
\ No newline at end of file