From d0e8bbaef1892c24fef4f4f9326e125708a00b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=83=81=ED=98=84?= Date: Fri, 20 Oct 2023 13:20:11 +0900 Subject: [PATCH] =?UTF-8?q?Laanc=20=EC=8A=B9=EC=9D=B8=20=EC=9D=B8=EC=B2=AD?= =?UTF-8?q?=20=EB=AA=A9=EB=A1=9D=20=EC=83=81=EC=84=B8=EB=B3=B4=EA=B8=B0=20?= =?UTF-8?q?api=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/laanc/LaancGrid.js | 22 +++++- src/modules/laanc/actions/laancActions.ts | 18 ++++- src/modules/laanc/apis/laancApi.ts | 5 ++ src/modules/laanc/models/laancModels.ts | 88 +++++++++++++++++++++ src/modules/laanc/reducers/laancReducers.ts | 6 ++ src/modules/laanc/sagas/laancSagas.ts | 20 +++++ 6 files changed, 155 insertions(+), 4 deletions(-) diff --git a/src/components/laanc/LaancGrid.js b/src/components/laanc/LaancGrid.js index b727a151..a1186267 100644 --- a/src/components/laanc/LaancGrid.js +++ b/src/components/laanc/LaancGrid.js @@ -1,6 +1,8 @@ +import { useSelector, useDispatch } from 'react-redux'; +import { useHistory } from 'react-router-dom'; import { GridDatabase } from '@src/components/crud/grid/GridDatatable'; import { Row, Col, Card, Button, Spinner } from 'reactstrap'; -import { useSelector } from 'react-redux'; +import * as LaancAction from '../../modules/laanc/actions/laancActions'; import moment from 'moment'; const data = [ @@ -31,6 +33,9 @@ const data = [ ]; function LaancGrid() { + const dispatch = useDispatch(); + const history = useHistory(); + const { scheduleList } = useSelector(state => state.flightState); const { laancSearchData } = useSelector(state => state.laancState); const { loading } = useSelector(state => state.loadingReducer); @@ -41,6 +46,13 @@ function LaancGrid() { : new Array(width - str.length + 1).join('0') + str; //남는 길이만큼 0으로 채움 }; + //상세보기 + const handleDetail = planSno => { + dispatch(LaancAction.LAANC_DETAIL.request(planSno)); + // history.push('/basis/flight/plan/create'); + // to={`/basis/flight/plan/detail/${row.planSno}?type=plan`} + }; + const columns = [ { name: '비행계획서 일련 번호', @@ -129,7 +141,13 @@ function LaancGrid() { sortable: true, cell: row => { return ( - {}}> + { + handleDetail(row.planSno); + }} + > 상세보기 ); diff --git a/src/modules/laanc/actions/laancActions.ts b/src/modules/laanc/actions/laancActions.ts index 8f514fa6..39f217ad 100644 --- a/src/modules/laanc/actions/laancActions.ts +++ b/src/modules/laanc/actions/laancActions.ts @@ -9,7 +9,8 @@ import { LaancSunData, LaancSunRq, LaancAprvRq, - LaancAprvData + LaancAprvData, + LaancDetailData } from '../models/laancModels'; // laanc 비행계획서 승인 @@ -32,6 +33,11 @@ const LAANC_APRV_LIST_REQUEST = 'laanc/aprv/list/REQUEST'; const LAANC_APRV_LIST_SUCCESS = 'laanc/aprv/list/SUCCESS'; const LAANC_APRV_LIST_FAILURE = 'laanc/aprv/list/FAILURE'; +//Laanc 신청서 상세보기 +const LAANC_DETAIL_REQUEST = 'laanc/detail/REQUEST'; +const LAANC_DETAIL_SUCCESS = 'laanc/detail/SUCCESS'; +const LAANC_DETAIL_FAILURE = 'laanc/detail/FAILURE'; + // laanc 초기화 const INIT_LAANC = 'laanc/init'; @@ -65,11 +71,19 @@ export const LAANC_APRV_LIST = createAsyncAction( LAANC_APRV_LIST_FAILURE )(); +//laanc 신청서 상세보기 +export const LAANC_DETAIL = createAsyncAction( + LAANC_DETAIL_REQUEST, + LAANC_DETAIL_SUCCESS, + LAANC_DETAIL_FAILURE +)(); + const actions = { LAANC_FLIGHT_Approval, LAANC_FLIGHT_CREATE, LAANC_APPROVAL_INIT, LAANC_SUN_DATA, - LAANC_APRV_LIST + LAANC_APRV_LIST, + LAANC_DETAIL }; export type LaancAction = ActionType; diff --git a/src/modules/laanc/apis/laancApi.ts b/src/modules/laanc/apis/laancApi.ts index b1ce6eb2..d9e97efe 100644 --- a/src/modules/laanc/apis/laancApi.ts +++ b/src/modules/laanc/apis/laancApi.ts @@ -31,5 +31,10 @@ export const laancApi = { params: data }); return res.data; + }, + // 신청서 상세보기 + getDetail: async (data: string) => { + const res = await axios.get(`api/bas/laanc/aprv/detail/${data}`); + return res.data; } }; diff --git a/src/modules/laanc/models/laancModels.ts b/src/modules/laanc/models/laancModels.ts index 99a2c22d..f8901d1e 100644 --- a/src/modules/laanc/models/laancModels.ts +++ b/src/modules/laanc/models/laancModels.ts @@ -6,6 +6,7 @@ export interface laancState { laancPdf: LaancPdf | undefined; laancSun: LaancSunData[] | undefined; laancSearchData: LaancAprvData[] | undefined; + laancDetail: LaancDetailData | undefined; } // laanc계획서 초기값 @@ -364,6 +365,7 @@ export const laancControlData = { laancApply: undefined, laancSun: undefined, laancSearchData: undefined, + laancDetail: undefined, detail: { planSno: 0, groupId: '', @@ -658,3 +660,89 @@ export interface LaancAprvData { ]; }; } + +// laanc 신청서 상세보기 rs +export interface LaancDetailData { + planSno: number; + groupId: string; + cstmrSno: number; + memberName: string; + email: string; + hpno: string; + clncd: string; + schFltStDt: string; + schFltEndDt: string; + fltPurpose: string; + aprvlYn: string; + createUserId: string; + createDt: string; + updateUserId: string; + updateDt: string; + serviceType: string; + areaList: [ + { + planAreaSno: number; + planSno: number; + areaType: string; + fltAreaAddr: string; + bufferZone: number; + fltElev: string; + createUserId: string; + createDt: string; + updateUserId: string; + updateDt: string; + docState: string; + coordList: [ + { + planAreaCoordSno: number; + planAreaSno: number; + lat: number; + lon: number; + createUserId: string; + createDt: string; + docState: string; + } + ]; + } + ]; + arcrftList: [ + { + planArcrftSno: number; + planSno: number; + arcrftSno: number; + idntfNum: string; + arcrftTypeCd: string; + arcrftLngth: number; + arcrftWdth: number; + arcrftHght: number; + arcrftWght: number; + takeoffWght: number; + createUserId: string; + createDt: string; + updateUserId: string; + updateDt: string; + docState: string; + acrftInsuranceYn: string; + arcrftWghtCd: string; + } + ]; + pilotList: [ + { + planPilotSno: number; + planSno: number; + cstmrSno: number; + groupNm: string; + memberName: string; + email: string; + hpno: string; + clncd: string; + createUserId: string; + createDt: string; + updateUserId: string; + updateDt: string; + docState: string; + } + ]; + elev: string; + arcrftWght: string; +} diff --git a/src/modules/laanc/reducers/laancReducers.ts b/src/modules/laanc/reducers/laancReducers.ts index f3744027..f72defca 100644 --- a/src/modules/laanc/reducers/laancReducers.ts +++ b/src/modules/laanc/reducers/laancReducers.ts @@ -44,6 +44,12 @@ export const laancReducer = createReducer( const data = action.payload; draft.laancSearchData = data; }) + ) + .handleAction(Actions.LAANC_DETAIL.success, (state, action) => + produce(state, draft => { + const data = action.payload; + draft.laancDetail = data; + }) ); export default laancReducer; diff --git a/src/modules/laanc/sagas/laancSagas.ts b/src/modules/laanc/sagas/laancSagas.ts index 51de72b9..77992cf2 100644 --- a/src/modules/laanc/sagas/laancSagas.ts +++ b/src/modules/laanc/sagas/laancSagas.ts @@ -112,9 +112,29 @@ function* getAprvListSaga( } } +//laanc 신청서 상세보기 +function* getDetailSaga( + action: ActionType +) { + try { + const deail = action.payload; + const res = yield call(Apis.laancApi.getDetail, deail); + yield put(Actions.LAANC_DETAIL.success(res)); + } catch (error) { + yield put( + MessageActions.IS_ERROR({ + errorCode: ERROR_MESSAGE.code, + errorMessage: ERROR_MESSAGE.message, + isHistoryBack: false, + isRefresh: false + }) + ); + } +} export function* laancSaga() { yield takeEvery(Actions.LAANC_FLIGHT_Approval.request, postApprovalsata); yield takeEvery(Actions.LAANC_FLIGHT_CREATE.request, postCreatesata); yield takeEvery(Actions.LAANC_SUN_DATA.request, getSunDataSaga); yield takeEvery(Actions.LAANC_APRV_LIST.request, getAprvListSaga); + yield takeEvery(Actions.LAANC_DETAIL.request, getDetailSaga); }