refactor(Center): 重构投资规划中心日历与事件管理

This commit is contained in:
zdl
2025-12-23 17:44:35 +08:00
parent 39fb70a1eb
commit 12a57f2fa2
11 changed files with 764 additions and 234 deletions

View File

@@ -215,6 +215,14 @@ const planningSlice = createSlice({
state.allEvents = state.allEvents.filter(e => e.id !== action.payload);
state.lastUpdated = Date.now();
},
/** 乐观更新事件(编辑时使用) */
optimisticUpdateEvent: (state, action: PayloadAction<InvestmentEvent>) => {
const index = state.allEvents.findIndex(e => e.id === action.payload.id);
if (index !== -1) {
state.allEvents[index] = action.payload;
state.lastUpdated = Date.now();
}
},
},
extraReducers: (builder) => {
builder
@@ -277,6 +285,7 @@ export const {
optimisticAddEvent,
replaceEvent,
removeEvent,
optimisticUpdateEvent,
} = planningSlice.actions;
export default planningSlice.reducer;