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