Browse Source

[redux-tookit] 통계 type 수정

master
박상현 7 months ago
parent
commit
c567495c3f
  1. 9
      src/_redux/features/analysis/history/historyState.ts
  2. 10
      src/_redux/features/analysis/history/historyThunk.ts
  3. 89
      src/_redux/features/statistics/statisticsSlice.ts
  4. 75
      src/_redux/features/statistics/statisticsState.ts
  5. 1
      src/components/analysis/simulation/AnalysisSimulationMarker.js

9
src/_redux/features/analysis/history/historyState.ts

@ -65,3 +65,12 @@ export interface IGetHstryLogRs {
trmnlRcvDt: Date;
srvrRcvDt: Date;
}
export interface IHstryListRq {
searchParams: {
endDate: string;
search1: string;
page: number;
};
page: number;
}

10
src/_redux/features/analysis/history/historyThunk.ts

@ -8,18 +8,12 @@ import {
SAVE_MESSAGE,
DELETE_MESSAGE
} from '@src/configs/constants';
import { IHstryListRq } from './historyState';
// 비행이력 조회
export const getHstryList = createAsyncThunk(
'analysis/getHstryList',
async (
data: {
searchParams: any;
data: any;
page: number;
},
thunkAPI
) => {
async (data: IHstryListRq, thunkAPI) => {
const { rejectWithValue } = thunkAPI;
try {
const queryString = qs.stringify(data.searchParams, {

89
src/_redux/features/statistics/statisticsSlice.ts

@ -1,5 +1,5 @@
import { createSlice } from '@reduxjs/toolkit';
import { initialState } from './statisticsState';
import { IStatisticsState, IStcsRs, IStcsSearchRs } from './statisticsState';
import {
getFlightStatistics,
getFlightSearch,
@ -9,28 +9,103 @@ import {
getAbnormalSearch
} from './statisticsThunk';
export const initialState: IStatisticsState = {
flight: [
{
name: '-',
year: '00:00:00',
month: '00:00:00',
day: '00:00:00'
},
{
name: '-',
year: 0,
month: 0,
day: 0
},
{
name: '-',
year: 0,
month: 0,
day: 0
}
],
flightSearch: {
graphData: [],
topData: []
},
abnormal: [
{
name: '-',
year: 0,
month: 0,
day: 0
},
{
name: '-',
year: 0,
month: 0,
day: 0
},
{
name: '-',
year: 0,
month: 0,
day: 0
}
],
abnormalSearch: {
graphData: [],
topData: []
},
result: [
{
name: '-',
year: 0,
month: 0,
day: 0
},
{
name: '-',
year: 0,
month: 0,
day: 0
},
{
name: '-',
year: 0,
month: 0,
day: 0
}
],
resultSearch: {
graphData: [],
topData: []
}
};
const statisticsSlice = createSlice({
name: 'statisticsSlice',
initialState: initialState,
reducers: {},
extraReducers: builder => {
builder.addCase(getFlightStatistics.fulfilled, (state, action) => {
state.flight = action.payload;
state.flight = action.payload as IStcsRs[];
});
builder.addCase(getFlightSearch.fulfilled, (state, action) => {
state.flightSearch = action.payload;
state.flightSearch = action.payload as IStcsSearchRs;
});
builder.addCase(getAbnormalStatistics.fulfilled, (state, action) => {
state.abnormal = action.payload;
state.abnormal = action.payload as IStcsRs[];
});
builder.addCase(getResultStatistics.fulfilled, (state, action) => {
state.result = action.payload;
state.result = action.payload as IStcsRs[];
});
builder.addCase(getResultSearch.fulfilled, (state, action) => {
state.resultSearch = action.payload;
state.resultSearch = action.payload as IStcsSearchRs;
});
builder.addCase(getAbnormalSearch.fulfilled, (state, action) => {
state.abnormalSearch = action.payload;
state.abnormalSearch = action.payload as IStcsSearchRs;
});
}
});

75
src/_redux/features/statistics/statisticsState.ts

@ -33,78 +33,3 @@ export interface IStcsSearchRq {
type: string;
serviceType: string;
}
export const initialState: IStatisticsState = {
flight: [
{
name: '-',
year: '00:00:00',
month: '00:00:00',
day: '00:00:00'
},
{
name: '-',
year: 0,
month: 0,
day: 0
},
{
name: '-',
year: 0,
month: 0,
day: 0
}
],
flightSearch: {
graphData: [],
topData: []
},
abnormal: [
{
name: '-',
year: 0,
month: 0,
day: 0
},
{
name: '-',
year: 0,
month: 0,
day: 0
},
{
name: '-',
year: 0,
month: 0,
day: 0
}
],
abnormalSearch: {
graphData: [],
topData: []
},
result: [
{
name: '-',
year: 0,
month: 0,
day: 0
},
{
name: '-',
year: 0,
month: 0,
day: 0
},
{
name: '-',
year: 0,
month: 0,
day: 0
}
],
resultSearch: {
graphData: [],
topData: []
}
};

1
src/components/analysis/simulation/AnalysisSimulationMarker.js

@ -17,7 +17,6 @@ export const AnalysisSimulationMarker = props => {
props.selMarker.setMap(null);
}
console.log('>>', props.data);
if (props.data.length != 0) {
const val = [];
for (let i = 0; i < props.data?.length; i++) {

Loading…
Cancel
Save