- {/*
{"비행 계획"} 목록
*/}
- {"비행계획서 신청"} 목록
- 검색결과 총 0건
+ 비행계획서 신청 목록
+ 검색결과 총 {!!planListData ? planListData.length : 0}건
{
+const FlightPlanSearch = ({searchData, handleChangeSearchData, handleSearch}) => {
const {schFltStDt, schFltEndDt, aprvlYn} = searchData;
const initCheckState = {
@@ -14,11 +14,14 @@ const FlightPlanSearch = ({searchData, onChangeSearchData}) => {
'no': (aprvlYn == 'N' || aprvlYn == 'A'),
}
const [checkState, setCheckState] = useState(initCheckState);
+ const handleClickSearch = (e) => {
+ handleSearch(searchData);
+ }
const handleChangeInput = (dates, value, config) => {
if (dates.length === 2) {
const schFltStDt = moment(dates[0]).format('YYYY-MM-DD HH:mm:ss');
const schFltEndDt = moment(dates[1]).set({'h': 23, 'm': 59, 's': 59}).format('YYYY-MM-DD HH:mm:ss');
- onChangeSearchData({schFltStDt, schFltEndDt})
+ handleChangeSearchData({schFltStDt, schFltEndDt})
}
}
const handleChangeCheckbox = (e) => {
@@ -27,7 +30,7 @@ const FlightPlanSearch = ({searchData, onChangeSearchData}) => {
switch (value) {
case 'A':
val = checked ? 'A' : '';
- onChangeSearchData({[name]: val})
+ handleChangeSearchData({[name]: val})
setCheckState({
'all': checked,
'yes': checked,
@@ -39,7 +42,7 @@ const FlightPlanSearch = ({searchData, onChangeSearchData}) => {
else if (checked && !checkState.no) val = 'Y'
else if (!checked && checkState.no) val = 'N'
else if (!checked && !checkState.no) val = ''
- onChangeSearchData({[name]: val})
+ handleChangeSearchData({[name]: val})
setCheckState(prevState => ({
'all': prevState.no && checked,
'yes': checked,
@@ -51,7 +54,7 @@ const FlightPlanSearch = ({searchData, onChangeSearchData}) => {
else if (checked && !checkState.yes) val = 'N'
else if (!checked && checkState.yes) val = 'Y'
else if (!checked && !checkState.yes) val = ''
- onChangeSearchData({[name]: val})
+ handleChangeSearchData({[name]: val})
setCheckState(prevState => ({
'all': prevState.yes && checked,
'yes': prevState.yes,
@@ -75,8 +78,7 @@ const FlightPlanSearch = ({searchData, onChangeSearchData}) => {
{
- }}
+ onClick={handleClickSearch}
>
검색
diff --git a/src/containers/basis/flight/plan/FlightPlanContainer.js b/src/containers/basis/flight/plan/FlightPlanContainer.js
index b5302416..1033d6fa 100644
--- a/src/containers/basis/flight/plan/FlightPlanContainer.js
+++ b/src/containers/basis/flight/plan/FlightPlanContainer.js
@@ -19,18 +19,22 @@ const FlightPlanContainer = () => {
const dispatch = useDispatch();
const history = useHistory();
const [searchData, setSerchData] = useState(initSearchData);
- const planListData = useSelector(state => state.flightState.list);
+ const {list: planListData, detail: planDetailData} = useSelector(state => state.flightState);
const moveFlightPlanDetailPage = () => {
+ if(planDetailData){
+ dispatch(FlightAction.FLIGHT_PLAN_DETAIL_INIT());
+ }
history.push('/basis/flight/plan/create');
};
+ const handleSearch = (data) => {
+ dispatch(FlightAction.FLIGHT_PLAN_LIST.request(data));
+ }
useEffect(() => {
- dispatch(FlightAction.FLIGHT_PLAN_LIST.request(searchData))
+ handleSearch(searchData);
}, [])
- // console.log(history, 'history')
- console.log(searchData)
const handleChangeSearchData = (values) => {
setSerchData(prevState => ({
...prevState,
@@ -38,20 +42,16 @@ const FlightPlanContainer = () => {
}))
}
- // 비행계획서 저장
- const handleClickCreate = () => {
-
- };
const handleMoveDetail = (id) => {
history.push(`/basis/flight/plan/detail/${id}`)
}
return (
- //
{
+const FlightPlanDetailContainer = () => {
const dispatch = useDispatch();
const history = useHistory();
- const [pageType, setPageType] = useState('create');
- const {flightPlanArea} = useSelector(state => state.flightState);
- const [areaInfo, setAreaInfo] = useState();
- const [modal, setModal] = useState({
- isOpen: false,
- title: '',
- });
-
- const {listFlightP, flightCount, isRefreshFlight} = useSelector(
- state => state.flightState
- );
- const [flightPlanData, setFlightPlanData] = useState(initFlightPlanData);
-
- const [params, setParams] = useState({
- schFltStDt: moment().subtract(1, 'day').format('YYYY-MM-DD'),
- schFltEndDt: moment().subtract(-1, 'day').format('YYYY-MM-DD'),
- search1: ''
- });
+ const location = useLocation();
+ const urlParams = useParams();
+ const flightState = useSelector(state => state.flightState);
+ const {detail} = flightState;
+ const [modal, setModal] = useState(initModal);
+ const [detailData, setDetailData] = useState(initFlightBas.initDetail);
useEffect(() => {
- console.log('isRefreshFlight>>>>', isRefreshFlight);
- if (isRefreshFlight) {
- console.log(isRefreshFlight);
- handlerSearch();
- }
- }, [isRefreshFlight]);
+ if (Object.keys(urlParams).length === 0 && urlParams.constructor === Object) return;
+ dispatch(Actions.FLIGHT_PLAN_DETAIL.request(urlParams.planSno));
+ }, [urlParams])
- const [flightPlanDataList, setFlightPlanDataList] = useState([]);
+ useEffect(() => {
+ setDetailData(detail);
+ }, [detail])
+
+ const handleModal = (modal) => {
+ setModal(prevState => ({
+ ...initModal,
+ [modal.target]: modal.isOpen
+ }))
+ }
- /* Form Validation Checking */
- const validSchema = yup.object().shape({});
- const {} = useForm({
- defaultValues: {
- coodinates: [],
- radius: '',
- altitude_m: '',
- altitude_ft: '',
- },
- resolver: yupResolver(validSchema)
- })
+ // 변경감지
+ const handleChange = ({name, value, type, index, pIndex}) => {
+ const arrName = `${type}List`;
+ switch (type) {
+ case 'coord':
+ // TODO 추후 삭제 필요 start
+ if(name == 'lonlat'){
+ const values = value.split("/");
+ let latValue = 1
+ let lonValue = 1
+ if(values.length == 1){
+ latValue = values[0].trim();
+ } else if(values.length == 2){
+ latValue = values[0].trim();
+ lonValue = values[1].trim();
+ } else {
+ return;
+ }
+ setDetailData(prevState => {
+ const areaList = prevState.areaList.map((area, i) => {
+ if(i !== pIndex) return {...area};
+
+ const coordList = area.coordList.map((coord, j) => {
+ if(j !== index) return {...coord};
+ return {
+ ...coord,
+ lat: latValue,
+ lon: lonValue
+ }
+ })
+ return {
+ ...area,
+ coordList
+ }
+ })
+ return {
+ ...prevState,
+ areaList
+ }
+ })
+ return;
+ }
+ // TODO 추후 삭제 필요 end
+
+ setDetailData(prevState => {
+ const areaArr = [...prevState.areaList];
+ const coordArr = areaArr[pIndex].coordList;
+ const updateData = {
+ ...coordArr[index],
+ [name]: value
+ }
+ coordArr[index] = updateData;
+ areaArr[pIndex] = coordArr
+ return {
+ ...prevState,
+ areaList: areaArr
+ }
+ })
+ break;
+ case 'area':
+ case 'pilot':
+ case 'arcrft':
+ setDetailData(prevState => {
+ const arr = [...prevState[arrName]];
+ const updateData = {
+ ...prevState[arrName][index],
+ [name]: value
+ }
+ arr[index] = updateData;
+ return {
+ ...prevState,
+ [arrName]: arr
+ }
+ })
+ break;
+ case 'plan':
+ default:
+ setDetailData(prevState => ({
+ ...prevState,
+ [name]: value
+ }))
+ break;
+ }
+ }
- const saveFlightPlanArea = () => {
- console.log('비행 구역 설정 저장');
+ // 추가
+ const handleAddArray = ({type, pIndex}) => {
+ const arrName = `${type}List`;
+ switch (type) {
+ case 'coord':
+ setDetailData(prevState => {
+ const areaArr = [...prevState.areaList];
+ const coordArr = [...areaArr[pIndex].coordList, initFlightBas[type]];
+ areaArr[pIndex] = coordArr;
+ return {
+ ...prevState,
+ areaList: [...areaArr]
+ }
+ })
+ break;
+ case 'area':
+ case 'pilot':
+ case 'arcrft':
+ setDetailData(prevState => {
+ return {
+ ...prevState,
+ [arrName]: [...prevState[arrName], initFlightBas[type]]
+ }
+ })
+ break;
+ default:
+ break;
+ }
}
- useEffect(() => {
- if (props.id) {
- handlerSearch();
- setPageType('update');
+ // 삭제
+ const handleDeleteArray = ({type, index, pIndex}) => {
+ const arrName = `${type}List`;
+ switch (type) {
+ case 'coord':
+ setDetailData(prevState => {
+ const areaArr = [...prevState.areaList];
+ const coordArr = [...areaArr[pIndex]];
+ const deleteData = coordArr.splice(index, 1);
+ areaArr[pIndex] = coordArr;
+ return {
+ ...prevState,
+ areaList: [...areaArr]
+ }
+ })
+ break;
+ case 'area':
+ case 'pilot':
+ case 'arcrft':
+ setDetailData(prevState => {
+ const arr = [...prevState[type]];
+ const deleteData = arr.splice(index, 1);
+ return {
+ ...prevState,
+ [arrName]: arr
+ }
+ })
+ default:
+ break;
}
- // console.log(selectData);
- }, []);
-
- useEffect(() => {
- let newArr = [];
-
- listFlightP?.map(item => {
- newArr.push({...item});
- });
- setFlightPlanDataList(listFlightP);
- }, [listFlightP]);
-
- const openModal = () => {
- setModal({
- isOpen: true,
- title: '비행 구역 설정',
- });
}
- const handlerCreate = e => {
- // console.log('flightPlanData>>>', {flightPlanData, params});
- // let saveData = {flightPlanData, params};
- const saveData = {...flightPlanData};
- dispatch(
- Actions.FLIGHT_PLAN_CREATE.request(saveData)
- );
- };
-
- // const handlerInput = (val) => {
- // console.log('handler input : ', val)
- // console.log('handler input : ', val[1])
- // console.log('handler input : ', val[0])
- // setParams({
- // ...params,
- // schFltStDt: moment(val[1]).format('YYYY-MM-DD'),
- // schFltEndDt: moment(val[0]).format('YYYY-MM-DD')
- // });
- // };
- // console.log('params >>>>> ', params)
- const onChange = (e) => {
- const {name, value} = e.target;
- setFlightPlanData((prevState) => ({
- ...prevState,
- [name]: value,
- }));
- };
-
- console.log('===> ', flightPlanData);
- const handlerDelete = async data => {
- // dispatch(Actions.IDNTF_DELETE.request(data.arcrftSno));
- };
-
- useEffect(() => {
- setAreaInfo(flightPlanArea);
- }, [flightPlanArea]);
+ // 저장
+ const handleSave = () => {
+ if (!detailData.planSno) {
+ dispatch(Actions.FLIGHT_PLAN_CREATE.request(detailData));
+ } else {
+ dispatch(Actions.FLIGHT_PLAN_UPDATE.request(detailData));
+ }
+ }
+ // 삭제
+ const handleDelete = () => {
+ dispatch(Actions.FLIGHT_PLAN_DELETE.request(urlParams.planSno));
+ }
return (
-
+ {/**/}
)
-
-}
+};
export default FlightPlanDetailContainer;
diff --git a/src/modules/basis/flight/actions/basisFlightAction.ts b/src/modules/basis/flight/actions/basisFlightAction.ts
index 9471feff..e04e7d7c 100644
--- a/src/modules/basis/flight/actions/basisFlightAction.ts
+++ b/src/modules/basis/flight/actions/basisFlightAction.ts
@@ -1,5 +1,5 @@
import { AxiosError } from 'axios';
-import { createAsyncAction, ActionType} from 'typesafe-actions';
+import { createAsyncAction, ActionType, createAction } from 'typesafe-actions';
import {
FlightAreaData,
FlightPlanArcrftDataList,
@@ -28,7 +28,8 @@ const FLIGHT_PLAN_LIST_FAILURE = 'basis/flight/plan/list/LIST_FAILURE';
const FLIGHT_PLAN_DETAIL_REQUEST = 'basis/flight/plan/detail/DETAIL_REQUEST';
const FLIGHT_PLAN_DETAIL_SUCCESS = 'basis/flight/plan/detail/DETAIL_SUCCESS';
const FLIGHT_PLAN_DETAIL_FAILURE = 'basis/flight/plan/detail/DETAIL_FAILURE';
-
+// 상세 초기화
+const FLIGHT_PLAN_DETAIL_INITIAL = 'basis/flight/plan/detail/DETAIL_INIT';
// 생성
const FLIGHT_PLAN_CREATE_REQUEST = 'basis/flight/plan/create/CREATE_REQUEST';
const FLIGHT_PLAN_CREATE_SUCCESS = 'basis/flight/plan/create/CREATE_SUCCESS';
@@ -84,7 +85,8 @@ export const FLIGHT_PLAN_DETAIL = createAsyncAction(
FLIGHT_PLAN_DETAIL_SUCCESS,
FLIGHT_PLAN_DETAIL_FAILURE
)();
-
+// 상세 초기화
+export const FLIGHT_PLAN_DETAIL_INIT = createAction(FLIGHT_PLAN_DETAIL_INITIAL)();
// 생성
export const FLIGHT_PLAN_CREATE = createAsyncAction(
FLIGHT_PLAN_CREATE_REQUEST,
@@ -126,6 +128,7 @@ const actions = {
// FLIGHT_PLAN_AREA,
FLIGHT_PLAN_LIST,
FLIGHT_PLAN_DETAIL,
+ FLIGHT_PLAN_DETAIL_INIT,
FLIGHT_PLAN_CREATE,
FLIGHT_PLAN_UPDATE,
FLIGHT_PLAN_DELETE,
diff --git a/src/modules/basis/flight/apis/basisFlightApi.ts b/src/modules/basis/flight/apis/basisFlightApi.ts
index 8c93f506..d36d78ea 100644
--- a/src/modules/basis/flight/apis/basisFlightApi.ts
+++ b/src/modules/basis/flight/apis/basisFlightApi.ts
@@ -13,20 +13,16 @@ export const flightPlanAPI = {
addQueryPrefix: true,
arrayFormat: 'repeat'
});
- console.log('>>> rq : ', queryString)
const res = await axios.get(`api/bas/flight/plan/list${queryString}`);
- console.log('>>> rs : ', res);
return res;
},
detail: async (planSno: number) => {
- console.log('>>> rq : ', planSno)
const res = await axios.get(`api/bas/flight/plan/detail/${planSno}`);
- console.log('>>> rs : ', res);
return res;
},
create: async (data: FlightPlanData) => {
console.log('>>> rq : ', data)
- const res = await axios.post(`api/bas/flight/paln/create`, data);
+ const res = await axios.post(`api/bas/flight/plan/create`, data);
console.log('>>> rs : ', res);
return res;
},
@@ -42,13 +38,13 @@ export const flightPlanAPI = {
console.log('>>> rs : ', res);
return res;
},
- listPilot: async (groupId: number) => {
+ listPilot: async (groupId: string) => {
console.log('>>> rq : ', groupId)
const res = await axios.get(`api/bas/flight/plan/pilot/${groupId}`);
console.log('>>> rs : ', res);
return res;
},
- listArcrft: async (groupId: number) => {
+ listArcrft: async (groupId: string) => {
console.log('>>> rq : ', groupId)
const res = await axios.get(`api/bas/flight/plan/arcrft/${groupId}`);
console.log('>>> rs : ', res);
diff --git a/src/modules/basis/flight/models/basisFlightModel.ts b/src/modules/basis/flight/models/basisFlightModel.ts
index d25a98cc..cad9f06f 100644
--- a/src/modules/basis/flight/models/basisFlightModel.ts
+++ b/src/modules/basis/flight/models/basisFlightModel.ts
@@ -1,4 +1,4 @@
-import { date } from "yup";
+import moment from "moment";
export interface FlightState {
areaList: FlightAreaData | undefined
@@ -14,92 +14,129 @@ export interface FlightAreaData {
}
export interface FlightPlanArea {
- address: '',
- coordinates: '',
- redius: '',
- altitude_m: '',
- altitude_ft: '',
+ address: string,
+ coordinates: string,
+ redius: string,
+ altitude_m: string,
+ altitude_ft: string,
}
export interface FlightPlanData {
- planArcrftSno: number,
- planSno: number,
- arcrftSno: number,
- idntfNum: string,
- groupNm: string,
- prdctNum: string,
- arcrftTypeCd: string,
- arcrftModelNm: string,
- prdctCmpnNm: string,
- prdctDate: Date;
- arcrftLngth: number,
- arcrftWdth: number,
- arcrftHght: number,
- arcrftWght: number,
- wghtTypeCd: string,
- imageUrl: string,
- takeoffWght: number;
- useYn: string,
- cameraYn: string,
- insrncYn: string,
- ownerNm: string,
+ planSno?: number,
+ groupId: string,
+ cstmrSno: number,
+ memberName: string,
+ email: string,
+ hpno: string,
+ clncd: string,
+ addr: string,
+ addrDtlCn: string,
+ zip: string,
+ schFltStDt: string,
+ schFltEndDt: string,
+ fltPurpose: string,
+ aprvlYn: string,
+ delYn: string,
createUserId: string,
- createDt: Date,
+ createDt: string,
updateUserId: string,
- updateDt: Date,
- areaList: FlightPlanAreaDataList,
- pilotList: FlightPlanPilotDataList,
- arcrftList: FlightPlanArcrftDataList,
- docState: string,
+ updateDt: string,
+ areaList?: FlightPlanAreaDataList | undefined,
+ pilotList?: FlightPlanPilotDataList | undefined,
+ arcrftList?: FlightPlanArcrftDataList | undefined
+ // docState: string
}
export interface FlightPlanAreaData {
- planAreaSno: number,
+ planAreaSno?: number,
planSno: number,
areaType: string,
fltMethod: string,
bufferZone: number,
fltElev: string,
- createUserId: string,
- createDt: Date,
- updateUserId: string,
- updateDt: Date,
- coordList: FlightPlanAreaCoordData
- docState: string,
+ createUserId?: string,
+ createDt?: string,
+ updateUserId?: string,
+ updateDt?: string,
+ coordList?: FlightPlanAreaCoordDataList | undefined
+ // docState: string,
}
export interface FlightPlanAreaDataList extends Array {};
export interface FlightPlanAreaCoordData {
- planAreaCoordSno: number,
- planAreaSno: number,
+ planAreaCoordSno?: number,
+ planAreaSno?: number,
lat: number,
lon: number,
- createUserId: string,
- createDt: Date,
- docState: string
+ createUserId?: string,
+ createDt?: string
+ // docState: string
}
-export interface FlightPlanAreaCoordData extends Array {};
+export interface FlightPlanAreaCoordDataList extends Array {};
export interface FlightPlanPilotData {
-
+ planPilotSno?: number,
+ planSno?: number,
+ cstmrSno?: number,
+ groupNm: string,
+ memberName: string,
+ email: string,
+ hpno: string,
+ clncd: string,
+ addr: string,
+ addrDtlCn: string,
+ zip: string,
+ qlfcNo: string,
+ carrer: string,
+ createUserId: string,
+ createDt: string,
+ updateUserId: string,
+ updateDt: string
+ // docState: string
}
export interface FlightPlanPilotDataList extends Array {};
export interface FlightPlanArcrftData {
-
+ planArcrftSno: number,
+ planSno: number,
+ arcrftSno: number,
+ idntfNum: string,
+ groupNm: string,
+ prdctNum: string,
+ arcrftTypeCd: string,
+ arcrftModelNm: string,
+ prdctCmpnNm: string,
+ prdctDate: string,
+ arcrftLngth: number,
+ arcrftWdth: number,
+ arcrftHght: number,
+ arcrftWght: number,
+ wghtTypeCd: string,
+ imageUrl: string,
+ takeoffWght: number,
+ useYn: string,
+ cameraYn: string,
+ insrncYn: string,
+ ownerNm: string,
+ createUserId: string,
+ createDt: string,
+ updateUserId: string,
+ updateDt: string
+ // docState: string
}
export interface FlightPlanArcrftDataList extends Array {};
// rq
export interface FlightPlanListRqData {
- schFltStDt: Date,
- schFltEndDt: Date,
+ schFltStDt: string,
+ schFltEndDt: string,
aprvlYn: string
}
+
export interface FlightPlanAprovRqData {
planSnoList: [number],
aprvlYn: string
@@ -110,7 +147,275 @@ export const initFlight = {
areaList: undefined,
flightPlanArea: undefined,
list: undefined,
- detail: undefined,
+ detail: {
+ planSno: 0,
+ groupId: '',
+ cstmrSno: 0,
+ memberName: '',
+ email: '',
+ hpno: '',
+ clncd: '+81',
+ 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'),
+ 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: ''
+ }]
+ }],
+ pilotList: [{
+ planPilotSno: 0,
+ planSno: 0,
+ cstmrSno: 0,
+ groupNm: '',
+ memberName: '',
+ email: '',
+ hpno: '',
+ clncd: '+81',
+ 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: ''
+ }]
+ },
pilotList: undefined,
- arcrftList: undefined
+ arcrftList: undefined,
};
+
+
+export const initFlightBas = {
+ plan: {
+ planSno: 0,
+ groupId: '',
+ cstmrSno: 0,
+ memberName: '',
+ email: '',
+ hpno: '',
+ clncd: '+81',
+ 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'),
+ 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: '+81',
+ 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: '+81',
+ 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'),
+ 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: ''
+ }]
+ }],
+ pilotList: [{
+ planPilotSno: 0,
+ planSno: 0,
+ cstmrSno: 0,
+ groupNm: '',
+ memberName: '',
+ email: '',
+ hpno: '',
+ clncd: '+81',
+ 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: ''
+ }]
+ }
+}
diff --git a/src/modules/basis/flight/reducers/basisFlightReducer.ts b/src/modules/basis/flight/reducers/basisFlightReducer.ts
index 10bd0c5d..c44f0324 100644
--- a/src/modules/basis/flight/reducers/basisFlightReducer.ts
+++ b/src/modules/basis/flight/reducers/basisFlightReducer.ts
@@ -2,7 +2,7 @@ import { createReducer } from 'typesafe-actions';
import produce from 'immer';
import * as Actions from '../actions/basisFlightAction';
-import { FlightState, initFlight } from '../models/basisFlightModel';
+import { FlightState, initFlight, initFlightBas } from '../models/basisFlightModel';
import { any } from 'prop-types';
@@ -22,7 +22,6 @@ export const flightReducer = createReducer(in
// 목록
.handleAction(Actions.FLIGHT_PLAN_LIST.success, (state, action) =>
produce(state, draft => {
- console.log('list : ', state, action);
const data = action.payload;
draft.list = data;
})
@@ -30,15 +29,18 @@ export const flightReducer = createReducer(in
// 상세
.handleAction(Actions.FLIGHT_PLAN_DETAIL.success, (state, action) =>
produce(state, draft => {
- console.log('detail : ', state, action);
const data = action.payload;
draft.detail = data;
})
)
+ .handleAction(Actions.FLIGHT_PLAN_DETAIL_INIT, (state, action) =>
+ produce(state, draft => {
+ draft.detail = initFlightBas.initDetail
+ })
+ )
// 조종사 조회
.handleAction(Actions.FLIGHT_PLAN_PILOT_LIST.success, (state, action) =>
produce(state, draft => {
- console.log('pilot : ', state, action);
const data = action.payload;
draft.pilotList = data;
})
@@ -46,7 +48,6 @@ export const flightReducer = createReducer(in
// 기체 조회
.handleAction(Actions.FLIGHT_PLAN_ARCRFT_LIST.success, (state, action) =>
produce(state, draft => {
- console.log('arcrft : ', state, action);
const data = action.payload;
draft.arcrftList = data;
})
diff --git a/src/modules/basis/flight/sagas/basisFlightSaga.ts b/src/modules/basis/flight/sagas/basisFlightSaga.ts
index 7f514388..77c4d1f7 100644
--- a/src/modules/basis/flight/sagas/basisFlightSaga.ts
+++ b/src/modules/basis/flight/sagas/basisFlightSaga.ts
@@ -10,6 +10,12 @@ import * as MessageActions from '../../../comn/message/actions/comnMessageAction
import * as Actions from '../actions/basisFlightAction';
import * as Apis from '../apis/basisFlightApi';
import { FlightPlanData } from "../models/basisFlightModel";
+import {
+ FLIGHT_PLAN_ARCRFT_LIST,
+ FLIGHT_PLAN_CREATE, FLIGHT_PLAN_DELETE,
+ FLIGHT_PLAN_DETAIL,
+ FLIGHT_PLAN_PILOT_LIST, FLIGHT_PLAN_UPDATE
+} from "../actions/basisFlightAction";
function* listAreaSaga(action: ActionType) {
try {
@@ -56,12 +62,11 @@ function* listAreaSaga(action: ActionType) {
// }
// }
+// 비행계획서 목록
function* listPlanSaga(action: ActionType) {
try {
const data = action.payload;
- console.log(`listPlanSaga payload `, data)
const response = yield call(Apis.flightPlanAPI.list, data);
- console.log('rs', response);
if (response.errorCode) {
yield put(
MessageActions.IS_ERROR({
@@ -83,59 +88,213 @@ function* listPlanSaga(action: ActionType) {
+ try {
+ const data = action.payload;
+ const response = yield call(Apis.flightPlanAPI.detail, data);
+ if (response.errorCode) {
+ yield put(
+ MessageActions.IS_ERROR({
+ errorCode: response.errorCode,
+ errorMessage: response.errorMessage,
+ isHistoryBack: false,
+ isRefresh: false
+ })
+ );
+ return;
+ }
-// function* createFlightPlanData(
-// 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));
-// }
-// }
+ yield put(
+ Actions.FLIGHT_PLAN_DETAIL.success(response.data)
+ );
+ } catch (error: any) {
+ yield put(
+ Actions.FLIGHT_PLAN_DETAIL.failure(error)
+ );
+ }
+}
+// 비행계획서 등록
+function* createPlanSaga(action: ActionType) {
+ try {
+ const detail = action.payload;
+
+ const res = yield call(Apis.flightPlanAPI.create, detail);
+
+ const { data } = res;
+
+ if (data.result) {
+ yield put(
+ MessageActions.IS_MESSAGE({
+ messageCode: SAVE_MESSAGE.code,
+ message: SAVE_MESSAGE.message,
+ isHistoryBack: true,
+ isRefresh: false
+ })
+ );
+ } else {
+ 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.FLIGHT_PLAN_CREATE.failure(error));
+ }
+}
+// 비행계획서 수정
+function* updatePlanSaga(action: ActionType) {
+ try {
+ const detail = action.payload;
+
+ const res = yield call(Apis.flightPlanAPI.update, detail);
+
+ const { data } = res;
+
+ if (data.result) {
+ yield put(
+ MessageActions.IS_MESSAGE({
+ messageCode: SAVE_MESSAGE.code,
+ message: SAVE_MESSAGE.message,
+ isHistoryBack: true,
+ isRefresh: false
+ })
+ );
+ } else {
+ 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.FLIGHT_PLAN_UPDATE.failure(error));
+ }
+}
+// 비행계획서 삭제
+function* deletePlanSaga(action: ActionType) {
+ try {
+ const id = action.payload;
+ const res = yield call(Apis.flightPlanAPI.delete, id);
+
+ const { data } = res;
+
+ if (data.result) {
+ yield put(
+ MessageActions.IS_MESSAGE({
+ messageCode: DELETE_MESSAGE.code,
+ message: DELETE_MESSAGE.message,
+ isHistoryBack: true,
+ 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.FLIGHT_PLAN_DELETE.failure(error));
+ }
+}
+// 조종사 목록
+function* listPilotSaga(action: ActionType) {
+ try {
+ const data = action.payload;
+ const response = yield call(Apis.flightPlanAPI.listPilot, data);
+ if (response.errorCode) {
+ yield put(
+ MessageActions.IS_ERROR({
+ errorCode: response.errorCode,
+ errorMessage: response.errorMessage,
+ isHistoryBack: false,
+ isRefresh: false
+ })
+ );
+ return;
+ }
+
+ yield put(
+ Actions.FLIGHT_PLAN_PILOT_LIST.success(response.data)
+ );
+ } catch (error: any) {
+ yield put(
+ Actions.FLIGHT_PLAN_PILOT_LIST.failure(error)
+ );
+ }
+}
+// 기체 목록
+function* listArcrftSaga(action: ActionType) {
+ try {
+ const data = action.payload;
+ const response = yield call(Apis.flightPlanAPI.listArcrft, data);
+ if (response.errorCode) {
+ yield put(
+ MessageActions.IS_ERROR({
+ errorCode: response.errorCode,
+ errorMessage: response.errorMessage,
+ isHistoryBack: false,
+ isRefresh: false
+ })
+ );
+ return;
+ }
+
+ yield put(
+ Actions.FLIGHT_PLAN_ARCRFT_LIST.success(response.data)
+ );
+ } catch (error: any) {
+ yield put(
+ Actions.FLIGHT_PLAN_ARCRFT_LIST.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_LIST.request, listPlanSaga)
- // yield takeEvery(Actions.FLIGHT_PLAN_CREATE.request, createFlightPlanData)
+ yield takeEvery(Actions.FLIGHT_PLAN_DETAIL.request, detailPlanSaga)
+ yield takeEvery(Actions.FLIGHT_PLAN_CREATE.request, createPlanSaga)
+ yield takeEvery(Actions.FLIGHT_PLAN_UPDATE.request, updatePlanSaga)
+ yield takeEvery(Actions.FLIGHT_PLAN_DELETE.request, deletePlanSaga)
+ yield takeEvery(Actions.FLIGHT_PLAN_PILOT_LIST.request, listPilotSaga)
+ yield takeEvery(Actions.FLIGHT_PLAN_ARCRFT_LIST.request, listArcrftSaga)
}
diff --git a/src/router/routes/RouteBasis.js b/src/router/routes/RouteBasis.js
index ce7dd1f4..fd48c464 100644
--- a/src/router/routes/RouteBasis.js
+++ b/src/router/routes/RouteBasis.js
@@ -48,7 +48,7 @@ const RouteBasis = [
component: lazy(() => import('../../views/basis/flight/plan/FlightPlanDetail'))
},
{
- path: '/basis/flight/plan/detail/:id',
+ path: '/basis/flight/plan/detail/:planSno',
component: lazy(() => import('../../views/basis/flight/plan/FlightPlanDetail'))
},
];