修复新建预约后规划页定位刷新

This commit is contained in:
2026-07-02 10:50:34 +08:00
parent 13974f13cc
commit 687d355246
2 changed files with 18 additions and 2 deletions
@@ -705,7 +705,10 @@ const submit = async (): Promise<void> => {
const result = await managerPlanningApi.createAppointment(payload) const result = await managerPlanningApi.createAppointment(payload)
removeDraftForm(session.userInfo) removeDraftForm(session.userInfo)
removeFormModalDraft(session.userInfo, APPOINTMENT_MODAL_STATE_DRAFT_NAME) removeFormModalDraft(session.userInfo, APPOINTMENT_MODAL_STATE_DRAFT_NAME)
markPlanningRefresh() markPlanningRefresh({
date: result.date || form.appointmentDate,
artistId: String(result.artistId ?? form.artistId)
})
toast.success('预约已创建') toast.success('预约已创建')
await router.replace(`/appointments/${result.orderItemId}`) await router.replace(`/appointments/${result.orderItemId}`)
} finally { } finally {
+14 -1
View File
@@ -197,6 +197,7 @@ import {
timeFromMinutes timeFromMinutes
} from '@/utils/date' } from '@/utils/date'
import { resolveAppointmentDate, resolveAppointmentStartMinute, resolveAppointmentTimeText, summaryMap } from '@/utils/planning' import { resolveAppointmentDate, resolveAppointmentStartMinute, resolveAppointmentTimeText, summaryMap } from '@/utils/planning'
import { consumePlanningRefresh } from '@/utils/storage'
type ViewMode = 'day' | 'week' | 'month' type ViewMode = 'day' | 'week' | 'month'
type MonthDisplayMode = 'count' | 'blocks' | 'rows' type MonthDisplayMode = 'count' | 'blocks' | 'rows'
@@ -438,6 +439,18 @@ const loadCalendar = async (): Promise<void> => {
} }
} }
const loadInitialCalendar = async (): Promise<void> => {
const refreshTarget = consumePlanningRefresh()
if (refreshTarget?.date) {
currentDateText.value = refreshTarget.date
viewMode.value = 'day'
}
if (refreshTarget?.artistId) {
selectedArtistId.value = refreshTarget.artistId
}
await loadCalendar()
}
const switchView = async (mode: ViewMode): Promise<void> => { const switchView = async (mode: ViewMode): Promise<void> => {
viewMode.value = mode viewMode.value = mode
await loadCalendar() await loadCalendar()
@@ -484,7 +497,7 @@ const openAppointment = (id: IdType): void => {
} }
onMounted(() => { onMounted(() => {
void loadCalendar() void loadInitialCalendar()
}) })
</script> </script>