update 细节调整

This commit is contained in:
2021-06-23 11:31:57 +08:00
parent bf18f21a24
commit fb834eaa11
14 changed files with 88 additions and 44 deletions

View File

@@ -1,8 +1,30 @@
const business = (state = {}, action) => {
switch (action.type) {
case 'PATROL_INIT_GRADE_BY_COMPLETED_DATE':
const _state = { ...state, completedDate: action.value }
return _state
{
const completedDate = state.completedDate || []
const { date } = action
const record = completedDate.find(p => p.id === date.id)
if (record) {
record.value = date.value
} else {
completedDate.push(date)
}
const _state = { ...state, completedDate }
return _state
}
case 'PATROL_REMOVE_INIT_GRADE_BY_COMPLETED_DATE':
{
const completedDate = state.completedDate || []
const record = completedDate.find(p => p.id === action.id)
if (!record) {
return state
} else {
completedDate.splice(completedDate.indexOf(record), 1)
const _state = { ...state, completedDate }
return _state
}
}
default:
return state
}