|
@ -7,6 +7,7 @@ import { |
|
|
} from '../../services/mobileWsType'; |
|
|
} from '../../services/mobileWsType'; |
|
|
import Bridge from '../../utils/bridge'; |
|
|
import Bridge from '../../utils/bridge'; |
|
|
import { RootState } from '..'; |
|
|
import { RootState } from '..'; |
|
|
|
|
|
import { SettingDTO } from '../../services/apiTypes'; |
|
|
|
|
|
|
|
|
interface ContextState { |
|
|
interface ContextState { |
|
|
device: PeripheralStatus['data']; |
|
|
device: PeripheralStatus['data']; |
|
@ -19,9 +20,7 @@ interface ContextState { |
|
|
syncProgress: SyncProgress['data']; |
|
|
syncProgress: SyncProgress['data']; |
|
|
syncItems: Array<SyncItemFinish['data']>; |
|
|
syncItems: Array<SyncItemFinish['data']>; |
|
|
|
|
|
|
|
|
setting: { |
|
|
|
|
|
server: string; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
setting: SettingDTO; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const orgGwdXmStr = localStorage.getItem('org_gwd_xm'); |
|
|
const orgGwdXmStr = localStorage.getItem('org_gwd_xm'); |
|
@ -56,6 +55,7 @@ const initialState: ContextState = { |
|
|
|
|
|
|
|
|
setting: { |
|
|
setting: { |
|
|
server: '', |
|
|
server: '', |
|
|
|
|
|
standbyMinutes: 20, |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -66,7 +66,7 @@ export const fetchConfig = createAsyncThunk('context/fetchConfig', async () => { |
|
|
|
|
|
|
|
|
export const saveConfig = createAsyncThunk( |
|
|
export const saveConfig = createAsyncThunk( |
|
|
'context/saveConfig', |
|
|
'context/saveConfig', |
|
|
async (param: { server: string }, thunkAPI) => { |
|
|
|
|
|
|
|
|
async (param: SettingDTO, thunkAPI) => { |
|
|
const res = await Bridge.saveConfig(param); |
|
|
const res = await Bridge.saveConfig(param); |
|
|
res.success && thunkAPI.dispatch(fetchConfig()); |
|
|
res.success && thunkAPI.dispatch(fetchConfig()); |
|
|
return res; |
|
|
return res; |
|
@ -138,4 +138,9 @@ export const { |
|
|
} = contextSlice.actions; |
|
|
} = contextSlice.actions; |
|
|
export default contextSlice.reducer; |
|
|
export default contextSlice.reducer; |
|
|
|
|
|
|
|
|
export const selectOrgCodes = (state: RootState) => [state.context.currOrgCode, state.context.currGWDCode, state.context.currXMCode]; |
|
|
|
|
|
|
|
|
// 铁路局、工务段、线路名 编码数组
|
|
|
|
|
|
export const selectOrgCodes = (state: RootState) => [ |
|
|
|
|
|
state.context.currOrgCode, |
|
|
|
|
|
state.context.currGWDCode, |
|
|
|
|
|
state.context.currXMCode, |
|
|
|
|
|
]; |