diff --git a/src/@core/layouts/components/menu/vertical-menu/index.js b/src/@core/layouts/components/menu/vertical-menu/index.js index cf25f001..792aba7b 100644 --- a/src/@core/layouts/components/menu/vertical-menu/index.js +++ b/src/@core/layouts/components/menu/vertical-menu/index.js @@ -23,7 +23,7 @@ const Sidebar = props => { const { topMenuCd } = useSelector(state => state.menuState); useEffect(() => { - console.log('>>>>>>>>>>>>>>', topMenuCd); + // console.log('>>>>>>>>>>>>>>', topMenuCd); navData(); }, [topMenuCd]); diff --git a/src/components/basis/flight/aprv/FlightPlanAprvGrid.js b/src/components/basis/flight/aprv/FlightPlanAprvGrid.js new file mode 100644 index 00000000..510da176 --- /dev/null +++ b/src/components/basis/flight/aprv/FlightPlanAprvGrid.js @@ -0,0 +1,59 @@ +import React from 'react'; +import {Button, Card, Col, Row} from 'reactstrap'; +import {GridDatabase} from '../../../crud/grid/GridDatatable'; + + +const FlightPlanAprvGrid = ({data, columns, handleChangeSelected, handleClickAprv}) => { + + + return ( +
+ + +
+
+

비행계획서 신청 목록

+ 검색결과 총 {!!data ? data.length : 0}건 +
+
+ + 승인 + + + 미승인 + +
+
+
+ +
+ + {/* 검색된 데이터가 없습니다. */} +
+
+
+ +
+
+ ) +} + +export default FlightPlanAprvGrid; diff --git a/src/components/basis/flight/aprv/FlightPlanAprvGroupGrid.js b/src/components/basis/flight/aprv/FlightPlanAprvGroupGrid.js new file mode 100644 index 00000000..fa69122c --- /dev/null +++ b/src/components/basis/flight/aprv/FlightPlanAprvGroupGrid.js @@ -0,0 +1,67 @@ +import React, {} from 'react'; +import { GridDatabase } from "../../../crud/grid/GridDatatable"; +import { + Card, + Button +} from 'reactstrap'; + + +const FlightPlanAprvGroupGrid = ({ data, count, selectGroup, handlerGroupCancel, handleGroupSelect }) => { + + const columns = [ + {id: 'groupNm', name: '그룹 명', minWidth: '102px', cell: row => (
{row.groupNm}
)}, + {id: 'groupId', name: '그룹 코드', minWidth: '102px', sortable: true, cell: row => (
{row.groupId}
)}, + {sortable: true, cell: row => { + return selectGroup?.groupId === row?.groupId ? ( + handlerGroupCancel()} + > + 선택취소 + + ) : ( + { + handleGroupSelect({ + groupId: row?.groupId, + groupNm: row?.groupNm, + groupAuthCd: row?.groupAuthCd + }) + } + } + > + 상세보기 + + ) + }} + ]; + + return ( + <> +
+
+

나의 그룹 목록

+ 검색결과 총 {count}건 +
+
+
+
+ +
+ +
+
+
+ + ) + +} + +export default FlightPlanAprvGroupGrid; diff --git a/src/components/basis/flight/aprv/FlightPlanAprvSearch.js b/src/components/basis/flight/aprv/FlightPlanAprvSearch.js new file mode 100644 index 00000000..0405f32a --- /dev/null +++ b/src/components/basis/flight/aprv/FlightPlanAprvSearch.js @@ -0,0 +1,175 @@ +import React, {useState} from 'react'; +import {Button, Card, CardBody, Col, CustomInput, Row} from 'reactstrap'; +import {Search} from 'react-feather'; +import Flatpickr from 'react-flatpickr'; +import moment from 'moment'; + + +const FlightPlanAprvSearch = ({searchData, handleChangeSearchData, handleSearch}) => { + + const {schFltStDt, schFltEndDt, aprvlYn} = searchData; + const initCheckState = { + 'all': aprvlYn == 'A', + 'yes': (aprvlYn == 'Y' || aprvlYn == 'A'), + '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'); + handleChangeSearchData({schFltStDt, schFltEndDt}) + } + } + const handleChangeCheckbox = (e) => { + const {name, value, checked} = e.target; + let val; + switch (value) { + case 'A': + val = checked ? 'A' : ''; + handleChangeSearchData({[name]: val}) + setCheckState({ + 'all': checked, + 'yes': checked, + 'no': checked + }) + break; + case 'Y': + if (checked && checkState.no) val = 'A' + else if (checked && !checkState.no) val = 'Y' + else if (!checked && checkState.no) val = 'N' + else if (!checked && !checkState.no) val = '' + handleChangeSearchData({[name]: val}) + setCheckState(prevState => ({ + 'all': prevState.no && checked, + 'yes': checked, + 'no': prevState.no + })) + break; + case 'N': + if (checked && checkState.yes) val = 'A' + else if (checked && !checkState.yes) val = 'N' + else if (!checked && checkState.yes) val = 'Y' + else if (!checked && !checkState.yes) val = '' + handleChangeSearchData({[name]: val}) + setCheckState(prevState => ({ + 'all': prevState.yes && checked, + 'yes': prevState.yes, + 'no': checked + })) + break; + default: + break; + } + } + return ( +
+ + +
+
+

검색조건

+
+
+ + + 검색 + +
+
+ + +
+
+
+
+
신청일
+
+
+ + +
+ +
+ +
+
+
+
+
+ +
+
+
승인여부
+
+
+ + + +
+
+
+
+
+
+
+
+ + +
+
+ ) +} + +export default FlightPlanAprvSearch; diff --git a/src/components/crud/grid/GridDatatable.js b/src/components/crud/grid/GridDatatable.js index 0b1b150e..a51c067e 100644 --- a/src/components/crud/grid/GridDatatable.js +++ b/src/components/crud/grid/GridDatatable.js @@ -25,6 +25,8 @@ export const GridDatabase = props => { // paginationDefaultPage={currentPage} // paginationComponent={CustomPagination} data={props.data} + onSelectedRowsChange={props.onSelectedRowsChange ? props.onSelectedRowsChange : null} + selectableRows={props.selectableRows} /> ); }; diff --git a/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js b/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js new file mode 100644 index 00000000..c36bd8c1 --- /dev/null +++ b/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js @@ -0,0 +1,97 @@ +import React, {useEffect, useState} from 'react'; +import {Col, Row} from 'reactstrap'; +import {CustomMainLayout} from '../../../../components/layout/CustomMainLayout'; +import moment from 'moment/moment'; +import FlightPlanAprvSearch from '../../../../components/basis/flight/aprv/FlightPlanAprvSearch'; +import FlightPlanAprvGrid from '../../../../components/basis/flight/aprv/FlightPlanAprvGrid'; +import {useDispatch, useSelector} from 'react-redux'; +import * as FlightAction from '../../../../modules/basis/flight/actions/basisFlightAction'; + +const initSearchData = { + schFltStDt: moment().set({'date': 1, 'h': 0, 'm': 0, 's': 0}).format('YYYY-MM-DD HH:mm:ss'), + schFltEndDt: moment().set({'h': 23, 'm': 59, 's': 59}).format('YYYY-MM-DD HH:mm:ss'), + aprvlYn: 'N', + cstmrSno: 0, +}; + +const columns = [ + {id: 'planSno', name: '번호', cell: (row, i) => (
{i + 1}
)}, + {id: 'fltPurpose', name: '비행목적', cell: row => (
{row.fltPurpose}
)}, + { + id: 'fltMethod', name: '비행방식', cell: row => { + const displayName = row.areaList && row.areaList.length > 0 && row.areaList[0].fltMethod || '-'; + return
{displayName}
+ } + }, + {id: 'schFltStDt', name: '출발일', cell: row => (
{row.schFltStDt}
)}, + {id: 'aprvlYn', name: '승인여부', cell: row => (
{row.aprvlYn}
)} +]; + +const FlightPlanAprvContainer = () => { + const dispatch = useDispatch(); + const [searchData, setSearchData] = useState(initSearchData); + const [selPlanSnoList, setSelPlanSnoList] = useState([]); + const {aprvList, aprvProc} = useSelector(state => state.flightState); + + // 최초 비행계획서 목록 조회 + useEffect(() => { + handleSearch(searchData); + }, []) + useEffect(() => { + if (aprvProc && aprvProc.result > 0) { + handleSearch(searchData); + } + }, [aprvProc]) + + + const handleSearch = (data) => { + dispatch(FlightAction.FLIGHT_APRV_LIST.request(data)); + } + const handleChangeSearchData = (values) => { + setSearchData(prevState => ({ + ...prevState, + ...values + })) + } + const handleChangeSelected = ({selectedRows}) => { + setSelPlanSnoList(selectedRows.map(item => item.planSno)) + } + const handleClickAprv = (type) => (e) => { + // notAprov, aprv + console.log(type, selPlanSnoList, e) + if (!selPlanSnoList || selPlanSnoList.length < 1) { + alert('비행계획서를 선택해주세요.'); + return; + } + ; + const sendData = { + planSnoList: [...selPlanSnoList], + aprvlYn: type === 'aprv' ? 'Y' : 'N' + } + dispatch(FlightAction.FLIGHT_APRV_PROC.request(sendData)); + } + + return ( + +
+ + + + + + +
+
+ ) +} + +export default FlightPlanAprvContainer; diff --git a/src/containers/basis/flight/plan/FlightPlanContainer.js b/src/containers/basis/flight/plan/FlightPlanContainer.js index 033ea4cd..bd93ab38 100644 --- a/src/containers/basis/flight/plan/FlightPlanContainer.js +++ b/src/containers/basis/flight/plan/FlightPlanContainer.js @@ -11,9 +11,8 @@ import { Row, Col } from 'reactstrap'; import { JOIN_LIST } from "../../../../modules/basis/group/actions/basisGroupAction"; import FlightPlanGroupGrid from '../../../../components/basis/flight/plan/FlightPlanGroupGrid'; - const initSearchData = { - schFltStDt: moment().set({'m': 7, 'date': 1, 'h': 0, 'm': 0, 's': 0}).format('YYYY-MM-DD HH:mm:ss'), + schFltStDt: moment().set({'date': 1, 'h': 0, 'm': 0, 's': 0}).format('YYYY-MM-DD HH:mm:ss'), schFltEndDt: moment().set({'h': 23, 'm': 59, 's': 59}).format('YYYY-MM-DD HH:mm:ss'), aprvlYn: 'N', groupId: '', @@ -29,7 +28,7 @@ const FlightPlanContainer = () => { const { user } = useSelector(state => state.authState, shallowEqual); const [ params, setParams ] = useState({}); - + const moveFlightPlanDetailPage = () => { if(planDetailData){ @@ -44,7 +43,7 @@ const FlightPlanContainer = () => { const handleSearch = (data) => { dispatch(FlightAction.FLIGHT_PLAN_LIST.request(data)); } - + const handleChangeSearchData = (values) => { setSerchData(prevState => ({ ...prevState, @@ -75,14 +74,14 @@ const FlightPlanContainer = () => { cstmrSno: user.cstmrSno, groupId: groupId } - }); - + }); + dispatch(FlightAction.FLIGHT_PLAN_LIST.request(param)); } const handlerGroupCancel = () => { dispatch(FlightAction.FLIGHT_PLAN_GROUP_SELECT( {cstmrSno: 0, groupId: '', groupNm: ''} )); - } + } useEffect(() => { if (user?.cstmrSno) { @@ -120,16 +119,16 @@ const FlightPlanContainer = () => { planListData={planListData} columns={columns} handleMoveDetail={handleMoveDetail} - /> + /> ) : (
나의 그룹 목록에서 상세보기를 클릭하세요.
)} - + - + ) diff --git a/src/modules/account/login/apis/authApi.ts b/src/modules/account/login/apis/authApi.ts index 33b1f09d..98771b14 100644 --- a/src/modules/account/login/apis/authApi.ts +++ b/src/modules/account/login/apis/authApi.ts @@ -5,7 +5,7 @@ import qs from 'qs'; export const authAPI = { usersLogin: async (data: UserAccount) => { - console.log('>>>>>>>>>>>>>>>>>>>>>', data); + // console.log('>>>>>>>>>>>>>>>>>>>>>', data); return await axios.post('api/acnt/jwt/login', data); }, getUserProfile: async (id: number) => { diff --git a/src/modules/account/login/sagas/authSaga.ts b/src/modules/account/login/sagas/authSaga.ts index 72ef0ae6..de572a36 100644 --- a/src/modules/account/login/sagas/authSaga.ts +++ b/src/modules/account/login/sagas/authSaga.ts @@ -71,7 +71,7 @@ function* refreshTokenSaga(action: ActionType) { function* checkAuthencationSaga() { try { const accessToken = cookieStorage.getCookie(COOKIE_ACCESS_TOKEN); - console.log('accessToken>>>>>>>>>>>>>', accessToken); + // console.log('accessToken>>>>>>>>>>>>>', accessToken); if (!accessToken) { yield put( Actions.check.success({ @@ -88,7 +88,7 @@ function* checkAuthencationSaga() { //token 셋팅 cookieStorage.setCookie(COOKIE_ACCESS_TOKEN, accessToken); - console.log('>>>>>>>>>>>>>>>>>>>>>', data); + // console.log('>>>>>>>>>>>>>>>>>>>>>', data); // storageService.session.setItem(STORAGE_SESSION_ICT, user.icToken); diff --git a/src/modules/basis/flight/actions/basisFlightAction.ts b/src/modules/basis/flight/actions/basisFlightAction.ts index 32021151..a6136572 100644 --- a/src/modules/basis/flight/actions/basisFlightAction.ts +++ b/src/modules/basis/flight/actions/basisFlightAction.ts @@ -1,13 +1,12 @@ import { AxiosError } from 'axios'; import { createAsyncAction, ActionType, createAction } from 'typesafe-actions'; import { - PublicAreaData, - FlightPlanArcrftData, - FlightPlanArcrftDataList, - FlightPlanAreaDataList, - // FlightPlanArea, - FlightPlanData, - FlightPlanListRqData, FlightPlanPilotDataList, PilotSelectData, SelectGroupData + PublicAreaData, + FlightPlanArcrftData, + FlightPlanArcrftDataList, + FlightPlanAreaDataList, + FlightPlanData, + FlightPlanListRqData, FlightPlanPilotDataList, PilotSelectData, SelectGroupData, BasFlightAprovData } from '../models/basisFlightModel'; @@ -16,11 +15,6 @@ const PUBLIC_AREA_LIST_REQUEST = 'basis/flight/public_area/LIST_REQUEST'; const PUBLIC_AREA_LIST_SUCCESS = 'basis/flight/public_area/LIST_SUCCESS'; const PUBLIC_AREA_LIST_FAILURE = 'basis/flight/public_area/LIST_FAILURE'; -// 비행 구역 설정 -// const FLIGHT_PLAN_AREA_REQUEST = 'basis/flight/plan/area/LIST_REQUEST'; -// const FLIGHT_PLAN_AREA_SUCCESS = 'basis/flight/plan/area/LIST_SUCCESS'; -// const FLIGHT_PLAN_AREA_FAILURE = 'basis/flight/plan/area/LIST_FAILURE'; - // 목록 const FLIGHT_PLAN_LIST_REQUEST = 'basis/flight/plan/list/LIST_REQUEST'; const FLIGHT_PLAN_LIST_SUCCESS = 'basis/flight/plan/list/LIST_SUCCESS'; @@ -83,18 +77,23 @@ const AREA_BUFFER_LIST_REQUEST = 'basis/flight/plan/area/BUFFER_LIST_REQUEST'; const AREA_BUFFER_LIST_SUCCESS = 'basis/flight/plan/area/BUFFER_LIST_SUCCESS'; const AREA_BUFFER_LIST_FAILURE = 'basis/flight/plan/area/BUFFER_LIST_FAILURE'; +// 비행계획서 조회(승인) +const FLIGHT_APRV_LIST_REQUEST = 'basis/flight/aprv/list/FLIGHT_APRV_LIST_REQUEST'; +const FLIGHT_APRV_LIST_SUCCESS = 'basis/flight/aprv/list/FLIGHT_APRV_LIST_SUCCESS'; +const FLIGHT_APRV_LIST_FAILURE = 'basis/flight/aprv/list/FLIGHT_APRV_LIST_FAILURE'; + +// 비행계획서 승인/미승인 처리 +const FLIGHT_APRV_PROC_REQUEST = 'basis/flight/aprv/proc/FLIGHT_APRV_PROC_REQUEST'; +const FLIGHT_APRV_PROC_SUCCESS = 'basis/flight/aprv/proc/FLIGHT_APRV_PROC_SUCCESS'; +const FLIGHT_APRV_PROC_FAILURE = 'basis/flight/aprv/proc/FLIGHT_APRV_PROC_FAILURE'; + + export const PUBLIC_AREA_LIST = createAsyncAction( PUBLIC_AREA_LIST_REQUEST, PUBLIC_AREA_LIST_SUCCESS, PUBLIC_AREA_LIST_FAILURE )(); -// export const FLIGHT_PLAN_AREA = createAsyncAction( -// FLIGHT_PLAN_AREA_REQUEST, -// FLIGHT_PLAN_AREA_SUCCESS, -// FLIGHT_PLAN_AREA_FAILURE -// )(); - // 목록 export const FLIGHT_PLAN_LIST = createAsyncAction( FLIGHT_PLAN_LIST_REQUEST, @@ -173,6 +172,20 @@ export const FLIGHT_PLAN_AREA_BUFFER_LIST = createAsyncAction( AREA_BUFFER_LIST_FAILURE )(); +// 비행계획서 조회(승인) +export const FLIGHT_APRV_LIST = createAsyncAction( + FLIGHT_APRV_LIST_REQUEST, + FLIGHT_APRV_LIST_SUCCESS, + FLIGHT_APRV_LIST_FAILURE +)(); +// 비행계획서 승인/미승인 처리 +export const FLIGHT_APRV_PROC = createAsyncAction( + FLIGHT_APRV_PROC_REQUEST, + FLIGHT_APRV_PROC_SUCCESS, + FLIGHT_APRV_PROC_FAILURE +)(); + + const actions = { PUBLIC_AREA_LIST, // FLIGHT_PLAN_AREA, @@ -191,7 +204,9 @@ const actions = { AREA_DETAIL_LIST_SAVE, FLIGHT_PLAN_GROUP_SELECT, FLIGHT_PLAN_AREA_BUFFER_LIST, - AREA_DETAIL_INIT + AREA_DETAIL_INIT, + FLIGHT_APRV_LIST, + FLIGHT_APRV_PROC }; export type FlightAction = ActionType; diff --git a/src/modules/basis/flight/apis/basisFlightApi.ts b/src/modules/basis/flight/apis/basisFlightApi.ts index 191289a7..5df3bce0 100644 --- a/src/modules/basis/flight/apis/basisFlightApi.ts +++ b/src/modules/basis/flight/apis/basisFlightApi.ts @@ -1,6 +1,12 @@ import axios from '../../../utils/customAxiosUtil'; import qs from 'qs'; -import { FlightPlanAreaData, FlightPlanAreaDataList, FlightPlanData, FlightPlanListRqData } from '../models/basisFlightModel'; +import { + BasFlightAprovData, + FlightPlanAreaData, + FlightPlanAreaDataList, + FlightPlanData, + FlightPlanListRqData +} from '../models/basisFlightModel'; export const flightPlanAPI = { @@ -21,43 +27,44 @@ export const flightPlanAPI = { return res; }, create: async (data: FlightPlanData) => { - console.log('>>> rq : ', data) const res = await axios.post(`api/bas/flight/plan/create`, data); - console.log('>>> rs : ', res); return res; }, update: async (data: FlightPlanData) => { - console.log('>>> rq : ', data) const res = await axios.put(`api/bas/flight/plan/update`, data); - console.log('>>> rs : ', res); return res; }, delete: async (planSno: number) => { - console.log('>>> rq : ', planSno) const res = await axios.get(`api/bas/flight/plan/delete/${planSno}`); - console.log('>>> rs : ', res); return res; }, 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: string) => { - console.log('>>> rq : ', groupId) const res = await axios.get(`api/bas/flight/plan/arcrft/${groupId}`); - console.log('>>> rs : ', res); return res; }, listBuffer: async (data: FlightPlanAreaDataList) => { - console.log('>>> rq : ', data) const queryString = qs.stringify(data, { addQueryPrefix: true, arrayFormat: 'brackets' }); const res = await axios.post(`api/bas/flight/plan/area/buffer`, data); - console.log('>>> rs : ', res); return res; - } + }, + aprvList: async (data: FlightPlanListRqData) => { + const queryString = qs.stringify(data, { + addQueryPrefix: true, + arrayFormat: 'repeat' + }); + const res = await axios.get(`api/bas/flight/aprv/list${queryString}`); + return res; + }, + aprvProc: async (data: BasFlightAprovData) => { + const res = await axios.put(`api/bas/flight/aprv/proc`, data); + return res; + }, } + diff --git a/src/modules/basis/flight/models/basisFlightModel.ts b/src/modules/basis/flight/models/basisFlightModel.ts index b89ba5e0..70b7b38d 100644 --- a/src/modules/basis/flight/models/basisFlightModel.ts +++ b/src/modules/basis/flight/models/basisFlightModel.ts @@ -11,7 +11,9 @@ export interface FlightState { arcrftSelect: FlightPlanArcrftData | undefined areaCoordList: FlightPlanAreaData[] | undefined areaList: FlightPlanAreaData[] | undefined - selectGroup: SelectGroupData | undefined + selectGroup: SelectGroupData | undefined + aprvList: [FlightPlanData] | undefined + aprvProc: any | undefined } export interface SelectGroupData { @@ -168,6 +170,11 @@ export interface PilotSelectData { zip: string } +export interface BasFlightAprovData { + planSnoList: [number] + aprvlYn: string +} + export const initFlight = { selectGroup: { cstmrSno: 0, @@ -277,7 +284,9 @@ export const initFlight = { pilotSelect: undefined, arcrftSelect: undefined, areaCoordList: undefined, - areaList: undefined, + areaList: undefined, + aprvList: undefined, + aprvProc: undefined }; @@ -304,7 +313,7 @@ export const initFlightBas = { updateDt: '', areaList: undefined, pilotList: undefined, - arcrftList: undefined, + arcrftList: undefined, }, pilot: { planPilotSno: 0, diff --git a/src/modules/basis/flight/reducers/basisFlightReducer.ts b/src/modules/basis/flight/reducers/basisFlightReducer.ts index 9f87ac1e..0a5b96ae 100644 --- a/src/modules/basis/flight/reducers/basisFlightReducer.ts +++ b/src/modules/basis/flight/reducers/basisFlightReducer.ts @@ -106,8 +106,22 @@ export const flightReducer = createReducer(in ) // 조종사, 기체 선택 초기화 .handleAction(Actions.AREA_DETAIL_INIT, (state, action) => - produce(state, draft => { - draft.areaList = undefined; - draft.areaCoordList = undefined; + produce(state, draft => { + draft.areaList = undefined; + draft.areaCoordList = undefined; + }) + ) + // 비행계획서 목록(승인) + .handleAction(Actions.FLIGHT_APRV_LIST.success, (state, action) => + produce(state, draft => { + const data = action.payload; + draft.aprvList = data; + }) + ) + // 비행계획서 승인처리 + .handleAction(Actions.FLIGHT_APRV_PROC.success, (state, action) => + produce(state, draft => { + const data = action.payload; + draft.aprvProc = data; }) ) diff --git a/src/modules/basis/flight/sagas/basisFlightSaga.ts b/src/modules/basis/flight/sagas/basisFlightSaga.ts index 4cce3d3d..ee016c8e 100644 --- a/src/modules/basis/flight/sagas/basisFlightSaga.ts +++ b/src/modules/basis/flight/sagas/basisFlightSaga.ts @@ -88,6 +88,7 @@ function* listPlanSaga(action: ActionType) { try { @@ -114,6 +115,7 @@ function* detailPlanSaga(action: ActionType) { try { @@ -121,7 +123,7 @@ function* createPlanSaga(action: ActionType) { try { @@ -165,7 +168,7 @@ function* updatePlanSaga(action: ActionType) { try { const id = action.payload; const res = yield call(Apis.flightPlanAPI.delete, id); - const { data } = res; + const {data} = res; if (data.result) { yield put( @@ -234,6 +238,7 @@ function* deletePlanSaga(action: ActionType) { try { @@ -260,6 +265,7 @@ function* listPilotSaga(action: ActionType) { try { @@ -314,6 +320,83 @@ function* listBuffer(action: ActionType) { + try { + const data = action.payload; + const response = yield call(Apis.flightPlanAPI.aprvList, data); + if (response.errorCode) { + yield put( + MessageActions.IS_ERROR({ + errorCode: response.errorCode, + errorMessage: response.errorMessage, + isHistoryBack: false, + isRefresh: false + }) + ); + return; + } + + yield put( + Actions.FLIGHT_APRV_LIST.success(response.data) + ); + } catch (error: any) { + yield put( + Actions.FLIGHT_APRV_LIST.failure(error) + ); + } +} + +// 비행계획서 승인 +function* aprvProcSaga(action: ActionType) { + try { + + const sendData = action.payload; + + const res = yield call(Apis.flightPlanAPI.aprvProc, sendData); + + const {data} = res; + + if (data.result) { + yield put( + MessageActions.IS_MESSAGE({ + messageCode: SAVE_MESSAGE.code, + message: SAVE_MESSAGE.message, + isHistoryBack: false, + isRefresh: false + }) + ); + yield put( + Actions.FLIGHT_APRV_PROC.success(data) + ) + } 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)); + } +} + export function* flightSaga() { yield takeEvery(Actions.PUBLIC_AREA_LIST.request, listAreaSaga); // yield takeEvery(Actions.FLIGHT_PLAN_AREA.request, createFlightPlanArea); @@ -325,4 +408,6 @@ export function* flightSaga() { yield takeEvery(Actions.FLIGHT_PLAN_PILOT_LIST.request, listPilotSaga) yield takeEvery(Actions.FLIGHT_PLAN_ARCRFT_LIST.request, listArcrftSaga) yield takeEvery(Actions.FLIGHT_PLAN_AREA_BUFFER_LIST.request, listBuffer) + yield takeEvery(Actions.FLIGHT_APRV_LIST.request, listAprvSaga) + yield takeEvery(Actions.FLIGHT_APRV_PROC.request, aprvProcSaga) } diff --git a/src/navigation/basis/index.js b/src/navigation/basis/index.js index 300c5e74..d0ba5a7f 100644 --- a/src/navigation/basis/index.js +++ b/src/navigation/basis/index.js @@ -56,8 +56,14 @@ export default [ type: 'item', title: '비행 계획 목록', navLink: '/basis/flight/plan/index' + }, + { + id: 'basis_001_03_02', + type: 'item', + title: '비행 계획 승인', + navLink: '/basis/flight/aprv/index' } ], navLink: '#' - } + } ]; diff --git a/src/router/Router.js b/src/router/Router.js index f485cc22..b3d58b5a 100644 --- a/src/router/Router.js +++ b/src/router/Router.js @@ -24,7 +24,7 @@ const Router = () => { const dispatch = useDispatch(); useEffect(() => { - console.log('isLogin>>>>>>>>', isLogin); + // console.log('isLogin>>>>>>>>', isLogin); if (!isLogin) { dispatch(Actions.check.request()); } diff --git a/src/router/routes/RouteBasis.js b/src/router/routes/RouteBasis.js index fd48c464..35cef676 100644 --- a/src/router/routes/RouteBasis.js +++ b/src/router/routes/RouteBasis.js @@ -51,6 +51,10 @@ const RouteBasis = [ path: '/basis/flight/plan/detail/:planSno', component: lazy(() => import('../../views/basis/flight/plan/FlightPlanDetail')) }, + { + path: '/basis/flight/aprv/index', + component: lazy(() => import('../../views/basis/flight/aprv/FlightPlanAprv')) + }, ]; export default RouteBasis; diff --git a/src/views/basis/flight/aprv/FlightPlanAprv.js b/src/views/basis/flight/aprv/FlightPlanAprv.js new file mode 100644 index 00000000..f1607e62 --- /dev/null +++ b/src/views/basis/flight/aprv/FlightPlanAprv.js @@ -0,0 +1,9 @@ +import '@styles/react/libs/flatpickr/flatpickr.scss'; +import '@styles/react/libs/tables/react-dataTable-component.scss'; +import '../../../../assets/css/custom.css'; +import React from 'react'; +import FlightPlanAprvContainer from '../../../../containers/basis/flight/aprv/FlightPlanAprvContainer'; + +const FlightPlanAprv = (props) => ; + +export default FlightPlanAprv;