|
|
|
@ -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; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|