修复日程美甲师筛选消失与日视图泳道末端裁切
This commit is contained in:
@@ -211,6 +211,7 @@ Page({
|
||||
laneWidth: 720,
|
||||
laneItemWidth: 240,
|
||||
laneHeaderHeight: 54,
|
||||
laneEdgeSpacerWidth: 24,
|
||||
dayTotal: 0,
|
||||
freeArtistCount: 0,
|
||||
pendingCount: 0,
|
||||
@@ -370,10 +371,15 @@ Page({
|
||||
},
|
||||
|
||||
selectArtist(event) {
|
||||
const id = event.currentTarget.dataset.id || ''
|
||||
const artist = this.data.artists.find(item => String(item.id) === String(id))
|
||||
const id = String(event.currentTarget.dataset.id || '')
|
||||
const currentId = String(this.data.selectedArtistId || '')
|
||||
const nextId = id && currentId === id ? '' : id
|
||||
if (nextId === currentId) return
|
||||
const artist = nextId
|
||||
? this.data.artists.find(item => String(item.id) === nextId)
|
||||
: null
|
||||
this.setData({
|
||||
selectedArtistId: id,
|
||||
selectedArtistId: nextId,
|
||||
selectedArtistName: artist ? artist.name : '全部美甲师'
|
||||
})
|
||||
this.loadCalendar()
|
||||
@@ -516,14 +522,20 @@ Page({
|
||||
|
||||
applyCalendar(calendar) {
|
||||
const businessHours = resolveBusinessHours(calendar)
|
||||
const artistSource = Array.isArray(calendar.artists) ? calendar.artists : []
|
||||
const artistOptionSource = Array.isArray(calendar.artistOptions) && calendar.artistOptions.length
|
||||
? calendar.artistOptions
|
||||
: artistSource
|
||||
const normalizeArtist = artist => ({
|
||||
...artist,
|
||||
color: resolveDisplayColor({ name: artist.name || artist.nickname, color: artist.color })
|
||||
})
|
||||
const snapshot = {
|
||||
businessStartTime: businessHours ? businessHours.start : '',
|
||||
businessEndTime: businessHours ? businessHours.end : '',
|
||||
businessHoursConfigured: hasBusinessHours(calendar),
|
||||
artists: (Array.isArray(calendar.artists) ? calendar.artists : []).map(artist => ({
|
||||
...artist,
|
||||
color: resolveDisplayColor({ name: artist.name || artist.nickname, color: artist.color })
|
||||
})),
|
||||
artists: artistSource.map(normalizeArtist),
|
||||
artistOptions: artistOptionSource.map(normalizeArtist),
|
||||
appointments: Array.isArray(calendar.appointments) ? calendar.appointments : [],
|
||||
daySummaries: Array.isArray(calendar.daySummaries) ? calendar.daySummaries : []
|
||||
}
|
||||
@@ -532,7 +544,7 @@ Page({
|
||||
businessStartTime: snapshot.businessStartTime,
|
||||
businessEndTime: snapshot.businessEndTime,
|
||||
businessHoursConfigured: snapshot.businessHoursConfigured,
|
||||
artists: snapshot.artists,
|
||||
artists: snapshot.artistOptions,
|
||||
calendarError: '',
|
||||
rangeUnassignedCount: snapshot.appointments.filter(item => !item.artistId).length,
|
||||
nearestUnassignedDate: this.findNearestUnassignedDate(snapshot.appointments),
|
||||
@@ -653,6 +665,7 @@ Page({
|
||||
|
||||
buildDayView(calendar) {
|
||||
const minuteScale = 2.5
|
||||
const laneEdgeSpacerWidth = Number(this.data.laneEdgeSpacerWidth) || 0
|
||||
const daySummary = this.summaryMap(calendar)[this.data.currentDateText] || null
|
||||
const businessHours = resolveBusinessHours(calendar, this.data.currentDateText)
|
||||
const filteredArtists = this.data.selectedArtistId
|
||||
@@ -676,7 +689,8 @@ Page({
|
||||
timelineViewportHeight: 320,
|
||||
laneHeaderHeight: 54,
|
||||
laneItemWidth: 248,
|
||||
laneWidth: 720,
|
||||
laneEdgeSpacerWidth,
|
||||
laneWidth: 720 + laneEdgeSpacerWidth,
|
||||
dayTotal: dayAppointments.length,
|
||||
freeArtistCount: 0,
|
||||
pendingCount,
|
||||
@@ -753,7 +767,8 @@ Page({
|
||||
timelineViewportHeight: Math.min(820, timelineHeight + laneHeaderHeight + TIMELINE_BOTTOM_SPACE),
|
||||
laneHeaderHeight,
|
||||
laneItemWidth: 248,
|
||||
laneWidth: Math.max(720, lanes.reduce((width, lane) => width + (lane.width || 248), 0)),
|
||||
laneEdgeSpacerWidth,
|
||||
laneWidth: Math.max(720, lanes.reduce((width, lane) => width + (lane.width || 248), 0) + laneEdgeSpacerWidth),
|
||||
dayTotal: dayAppointments.length,
|
||||
freeArtistCount: employeeLanes.filter(item => item.blocks.every(block => block.historicalBackfill)).length,
|
||||
pendingCount,
|
||||
|
||||
Reference in New Issue
Block a user