修复新建预约后规划页定位刷新
This commit is contained in:
@@ -705,7 +705,10 @@ const submit = async (): Promise<void> => {
|
||||
const result = await managerPlanningApi.createAppointment(payload)
|
||||
removeDraftForm(session.userInfo)
|
||||
removeFormModalDraft(session.userInfo, APPOINTMENT_MODAL_STATE_DRAFT_NAME)
|
||||
markPlanningRefresh()
|
||||
markPlanningRefresh({
|
||||
date: result.date || form.appointmentDate,
|
||||
artistId: String(result.artistId ?? form.artistId)
|
||||
})
|
||||
toast.success('预约已创建')
|
||||
await router.replace(`/appointments/${result.orderItemId}`)
|
||||
} finally {
|
||||
|
||||
@@ -197,6 +197,7 @@ import {
|
||||
timeFromMinutes
|
||||
} from '@/utils/date'
|
||||
import { resolveAppointmentDate, resolveAppointmentStartMinute, resolveAppointmentTimeText, summaryMap } from '@/utils/planning'
|
||||
import { consumePlanningRefresh } from '@/utils/storage'
|
||||
|
||||
type ViewMode = 'day' | 'week' | 'month'
|
||||
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> => {
|
||||
viewMode.value = mode
|
||||
await loadCalendar()
|
||||
@@ -484,7 +497,7 @@ const openAppointment = (id: IdType): void => {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void loadCalendar()
|
||||
void loadInitialCalendar()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user