Merge pull request '修复日程美甲师筛选消失与日视图泳道末端裁切' (#109) from dev into sit
自动发布测试环境 Nacos 配置 / publish (push) Successful in 34s

Reviewed-on: http://wcsrv.top:3000/xiaowang/JayuCloud/pulls/109
This commit was merged in pull request #109.
This commit is contained in:
2026-11-10 09:13:41 +08:00
6 changed files with 72 additions and 10 deletions
@@ -133,7 +133,9 @@ public class PlanningServiceImpl implements PlanningService {
}
}
boolean artistFiltered = artistId != null && artistId > 0;
List<PlanningArtistVO> artists = listArtists(shopId, artistId);
List<PlanningArtistVO> artistOptions = artistFiltered ? listArtists(shopId, null) : artists;
List<ArtistScheduleDO> schedules = listSchedules(shopId, start, end, artistId);
Map<Long, String> artistNames = artists.stream()
.collect(Collectors.toMap(PlanningArtistVO::getId, PlanningArtistVO::getName, (a, b) -> a));
@@ -151,6 +153,14 @@ public class PlanningServiceImpl implements PlanningService {
.filter(appointment -> appointment.getArtistId() != null)
.collect(Collectors.groupingBy(PlanningAppointmentVO::getArtistId, Collectors.counting()));
artists.forEach(artist -> artist.setRangeCount(countByArtist.getOrDefault(artist.getId(), 0L).intValue()));
if (artistFiltered) {
List<PlanningAppointmentVO> rangeAppointments = listAppointments(shopId, rangeStart, rangeEnd, null, artistOptions);
Map<Long, Long> optionCountByArtist = rangeAppointments.stream()
.filter(appointment -> appointment.getArtistId() != null)
.collect(Collectors.groupingBy(PlanningAppointmentVO::getArtistId, Collectors.counting()));
artistOptions.forEach(artist -> artist.setRangeCount(
optionCountByArtist.getOrDefault(artist.getId(), 0L).intValue()));
}
PlanningCalendarVO vo = new PlanningCalendarVO();
vo.setBusinessStartTime(businessHours == null ? null : businessHours.start().toString());
@@ -159,6 +169,7 @@ public class PlanningServiceImpl implements PlanningService {
|| shop.getDefaultAppointmentDurationMinutes() <= 0 ? DEFAULT_DURATION_MINUTES : shop.getDefaultAppointmentDurationMinutes());
vo.setSlotMinutes(DEFAULT_SLOT_MINUTES);
vo.setArtists(artists);
vo.setArtistOptions(artistOptions);
vo.setSchedules(scheduleVos);
vo.setAppointments(appointments);
vo.setDaySummaries(buildDaySummaries(start, end, artists, schedules, appointments, weeklyHours));
@@ -11,6 +11,8 @@ public class PlanningCalendarVO {
private Integer defaultAppointmentDurationMinutes;
private Integer slotMinutes;
private List<PlanningArtistVO> artists;
/** 全部美甲师选项(不受 artistId 筛选影响),供端侧筛选栏始终展示完整 chip 列表 */
private List<PlanningArtistVO> artistOptions;
private List<PlanningScheduleVO> schedules;
private List<PlanningAppointmentVO> appointments;
private List<PlanningDaySummaryVO> daySummaries;
+25 -10
View File
@@ -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,
@@ -292,6 +292,33 @@ async function run() {
assert.match(planningWxml, /bindtap="selectMonthDate" aria-label="查看\{\{item\.date\}\}日程"/)
assert.match(planningWxml, /bindtap="selectWeekDate" aria-label="查看\{\{item\.date\}\}日程"/)
assert.match(planningWxss, /\.week-list\s*\{/)
assert.strictEqual(definition.data.laneEdgeSpacerWidth, 24)
assert.match(planningWxml, /class="lane-edge-spacer" style="width: \{\{laneEdgeSpacerWidth\}\}rpx;"/)
assert.match(planningWxss, /\.lane-edge-spacer\s*\{[^}]*flex-shrink:\s*0;/)
assert.strictEqual(overlappingState.laneEdgeSpacerWidth, 24)
assert.strictEqual(overlappingState.laneWidth, 1016)
const filterPage = createPage()
let filterLoads = 0
filterPage.loadCalendar = () => { filterLoads += 1 }
filterPage.applyCalendar({
artists: [{ id: 1, name: '美甲师甲' }],
artistOptions: [{ id: 1, name: '美甲师甲', rangeCount: 3 }, { id: 2, name: '美甲师乙', rangeCount: 1 }],
appointments: [],
daySummaries: []
})
assert.strictEqual(filterPage.data.artists.length, 2)
assert.strictEqual(filterPage.data.artists[1].rangeCount, 1)
filterPage.selectArtist({ currentTarget: { dataset: { id: 2 } } })
assert.strictEqual(filterPage.data.selectedArtistId, '2')
assert.strictEqual(filterPage.data.artists.length, 2)
filterPage.selectArtist({ currentTarget: { dataset: { id: 2 } } })
assert.strictEqual(filterPage.data.selectedArtistId, '')
filterPage.selectArtist({ currentTarget: { dataset: { id: '' } } })
assert.strictEqual(filterPage.data.selectedArtistId, '')
assert.strictEqual(filterPage.data.selectedArtistName, '全部美甲师')
assert.strictEqual(filterLoads, 2)
}
run().catch(error => {
@@ -125,6 +125,7 @@
</view>
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">{{item.emptyText || '全天可约'}}</view>
</view>
<view class="lane-edge-spacer" style="width: {{laneEdgeSpacerWidth}}rpx;"></view>
</view>
</scroll-view>
</view>
@@ -421,6 +421,12 @@
background: #ffffff;
}
/* 泳道尾部留白:仅为扩展横向滚动范围,避免最后一列被卡片圆角/边框裁切,不参与泳道排布 */
.lane-edge-spacer {
flex-shrink: 0;
align-self: stretch;
}
.lane-unassigned-tag {
margin-left: auto;
color: #a56b24;