diff --git a/src/_redux/features/analysis/history/historySlice.ts b/src/_redux/features/analysis/history/historySlice.ts index f9b3f101..1cf829ce 100644 --- a/src/_redux/features/analysis/history/historySlice.ts +++ b/src/_redux/features/analysis/history/historySlice.ts @@ -1,7 +1,40 @@ import { createSlice } from '@reduxjs/toolkit'; -import { initHistory } from './historyState'; +import { + IGetHstryDetailRs, + IGetHstryListRs, + IGetHstryLogRs, + IHistoryState +} from './historyState'; import { getHstryList, getHstryLog, getHstryDetail } from './historyThunk'; +export const initHistory: IHistoryState = { + data: [], + detail: { + cntrlId: '', + idntfNum: '', + statusCd: '', + objectTypeCd: '', + cntrlStDt: '', + cntrlEndDt: '', + ttlTime: 0, + ttlDstnc: 0, + ttlDstncType: '', + avrgSpped: 0, + bttrCnsmptn: 0, + endTypeCd: '', + createDt: '', + updateDt: '' + }, + log: [], + count: 0, + searchParams: '', + arrSpeed: [], + arrElev: [], + page: 1, + total: 0, + id: '' +}; + const historySlice = createSlice({ name: 'historySlice', initialState: initHistory, @@ -11,9 +44,9 @@ const historySlice = createSlice({ state.searchParams = searchParams; }, clientSelectHstryGroup: (state, action) => { - state.data = initHistory.data; - state.count = initHistory.count; - state.total = initHistory.total; + state.data = initHistory.data as IGetHstryListRs[]; + state.count = initHistory.count as number; + state.total = initHistory.total as number; } }, extraReducers: builder => { @@ -24,15 +57,15 @@ const historySlice = createSlice({ // } // ); builder.addCase(getHstryList.fulfilled, (state, action) => { - state.data = action.payload.items; - state.count = action.payload.page; - state.total = action.payload.total; + state.data = action.payload.items as IGetHstryListRs[]; + state.count = action.payload.page as number; + state.total = action.payload.total as number; }); builder.addCase(getHstryLog.fulfilled, (state, action) => { - state.log = action.payload; + state.log = action.payload as IGetHstryLogRs[]; }); builder.addCase(getHstryDetail.fulfilled, (state, action) => { - state.detail = action.payload; + state.detail = action.payload as IGetHstryDetailRs; }); } }); diff --git a/src/_redux/features/analysis/history/historyState.ts b/src/_redux/features/analysis/history/historyState.ts index 6122f0bd..0c8ece5d 100644 --- a/src/_redux/features/analysis/history/historyState.ts +++ b/src/_redux/features/analysis/history/historyState.ts @@ -1,27 +1,14 @@ -export const initHistory: IHistoryState = { - data: undefined, - detail: undefined, - log: undefined, - count: 0, - searchParams: '', - arrSpeed: undefined, - arrElev: undefined, - page: 1, - total: 0, - id: undefined -}; - export interface IHistoryState { - data: IGetHstryListRs[] | undefined; - detail: IGetHstryDetailRs | undefined; - log: IGetHstryLogRs[] | undefined; + data: IGetHstryListRs[]; + detail: IGetHstryDetailRs; + log: IGetHstryLogRs[]; count: number | 0; searchParams: string; - arrSpeed: number[] | undefined; - arrElev: number[] | undefined; + arrSpeed: number[]; + arrElev: number[]; page: number | 1; total: number | 0; - id: string | undefined; + id: string; } export interface IGetHstryListRs { @@ -46,16 +33,16 @@ export interface IGetHstryDetailRs { idntfNum: string; statusCd: string; objectTypeCd: string; - cntrlStDt: Date; - cntrlEndDt: Date; + cntrlStDt: string; + cntrlEndDt: string; ttlTime: number; ttlDstnc: number; ttlDstncType: string; avrgSpped: number; bttrCnsmptn: number; endTypeCd: string; - createDt: Date; - updateDt: Date; + createDt: string; + updateDt: string; } export interface IGetHstryLogRs { diff --git a/src/_redux/features/analysis/simulation/simulationSlice.ts b/src/_redux/features/analysis/simulation/simulationSlice.ts index 16436692..10ddf846 100644 --- a/src/_redux/features/analysis/simulation/simulationSlice.ts +++ b/src/_redux/features/analysis/simulation/simulationSlice.ts @@ -1,5 +1,10 @@ import { createSlice } from '@reduxjs/toolkit'; -import { initSimulation } from './simulationState'; +import { + AnalysisSimulatorState, + IAnalysisSimulatorLogRs, + IAnalysisSimulatorRs, + IAnalysisSimulatorStcsRs +} from './simulationState'; import { getSmltList, getSmltDetail, @@ -7,6 +12,38 @@ import { getSmltLog } from './simulationThunk'; +export const initSimulation: AnalysisSimulatorState = { + list: [], + detail: { + cntrlId: '', + idntfNum: '', + flghtStDt: '', + flghtEndDt: '', + cntrlStDt: '', + cntrlEndDt: '', + ttlTime: 0, + ttlTimeType: '', + ttlDstnc: 0, + ttlDstncType: '', + avrgSpeed: 0, + avrgSpeedType: '', + bttrCnsmptn: 0, + stArea: '', + endArea: '', + arcrftTypeCd: '', + prdctNum: '', + arcrftModelNm: '', + imageUrl: '' + }, + count: 0, + log: [], + searchParams: '', + stcsList: [], + stcsCount: 0, + page: 1, + total: 0 +}; + const simulationSlice = createSlice({ name: 'simulationSlice', initialState: initSimulation, @@ -28,16 +65,16 @@ const simulationSlice = createSlice({ } state.list = state.list?.concat(items); } - state.page = page; - state.count = count; - state.total = total; + state.page = page as number; + state.count = count as number; + state.total = total as number; }); builder.addCase(getSmltDetail.fulfilled, (state, action) => { - state.detail = action.payload; + state.detail = action.payload as IAnalysisSimulatorRs; }); builder.addCase(getSmltStcs.fulfilled, (state, action) => { - state.stcsList = action.payload; - state.stcsCount = action.payload.length; + state.stcsList = action.payload as IAnalysisSimulatorStcsRs[]; + state.stcsCount = action.payload.length as number; }); builder.addCase(getSmltLog.fulfilled, (state, action) => { const data = action.payload.sort((p: any, n: any): any => { @@ -45,7 +82,7 @@ const simulationSlice = createSlice({ const b = n.srvrRcvDt.replace(/[^0-9\.]+/g, ''); return a - b; }); - state.log = data; + state.log = data as IAnalysisSimulatorLogRs[]; }); } }); diff --git a/src/_redux/features/analysis/simulation/simulationState.ts b/src/_redux/features/analysis/simulation/simulationState.ts index c005b9aa..07cc4042 100644 --- a/src/_redux/features/analysis/simulation/simulationState.ts +++ b/src/_redux/features/analysis/simulation/simulationState.ts @@ -1,10 +1,10 @@ export interface AnalysisSimulatorState { - list: IAnalysisSimulatorRs[] | undefined; - detail: IAnalysisSimulatorRs | undefined; + list: IAnalysisSimulatorRs[]; + detail: IAnalysisSimulatorRs; count: number | 0; - log: IAnalysisSimulatorLogRs[] | undefined; + log: IAnalysisSimulatorLogRs[]; searchParams: string; - stcsList: IAnalysisSimulatorStcsRs[] | undefined; + stcsList: IAnalysisSimulatorStcsRs[]; stcsCount: number | 0; page: number | 1; total: number | 0; @@ -13,10 +13,10 @@ export interface AnalysisSimulatorState { export interface IAnalysisSimulatorRs { cntrlId: string; idntfNum: string; - flghtStDt: Date; - flghtEndDt: Date; - cntrlStDt: Date; - cntrlEndDt: Date; + flghtStDt: string; + flghtEndDt: string; + cntrlStDt: string; + cntrlEndDt: string; ttlTime: number; ttlTimeType: string; ttlDstnc: number; @@ -65,14 +65,11 @@ export interface IAnalysisSimulatorStcsRs { maxBttrLvl: number; } -export const initSimulation: AnalysisSimulatorState = { - list: undefined, - detail: undefined, - count: 0, - log: undefined, - searchParams: '', - stcsList: undefined, - stcsCount: 0, - page: 1, - total: 0 -}; +export interface IAnalysisSimulatorListRq { + searchParams: { + endDate: string; + search1: string; + page: number; + }; + page: number; +} diff --git a/src/_redux/features/analysis/simulation/simulationThunk.ts b/src/_redux/features/analysis/simulation/simulationThunk.ts index 88e67da7..a3373aab 100644 --- a/src/_redux/features/analysis/simulation/simulationThunk.ts +++ b/src/_redux/features/analysis/simulation/simulationThunk.ts @@ -8,18 +8,12 @@ import { SAVE_MESSAGE, DELETE_MESSAGE } from '@src/configs/constants'; +import { IAnalysisSimulatorListRq } from './simulationState'; // 비행 현황 목록 export const getSmltList = createAsyncThunk( 'analysis/getSmltList', - async ( - data: { - searchParams: any; - data: any; - page: number; - }, - thunkAPI - ) => { + async (data: IAnalysisSimulatorListRq, thunkAPI) => { const { rejectWithValue } = thunkAPI; try { const queryString = qs.stringify(data.searchParams, { @@ -30,6 +24,8 @@ export const getSmltList = createAsyncThunk( `/api/anls/smlt/list${queryString}&page=${data.page}` ); + console.log('>>', res.data); + return res.data; } catch (error) { thunkAPI.dispatch( diff --git a/src/components/analysis/simulation/AnalysisSimulationMarker.js b/src/components/analysis/simulation/AnalysisSimulationMarker.js index 715e7abc..1a1561c9 100644 --- a/src/components/analysis/simulation/AnalysisSimulationMarker.js +++ b/src/components/analysis/simulation/AnalysisSimulationMarker.js @@ -17,7 +17,8 @@ export const AnalysisSimulationMarker = props => { props.selMarker.setMap(null); } - if (props.data) { + console.log('>>', props.data); + if (props.data.length != 0) { const val = []; for (let i = 0; i < props.data?.length; i++) { if (props.data[i].lat > 0 && props.data[i].lon > 0) {