fix(admin): 修复日期选择框尺寸过大与自动排入跨日期逻辑

- **日期选择器尺寸优化**:AdminDatePicker 与 AdminMultiDatePicker 采用 w-9 h-9 的紧凑卡片,缩小字号、边距与圆角,贴合后台窄布局。
- **自动排入逻辑重构**:取消严格的 `expectedPlayDate === selectedDate` 过滤,改为按歌曲期望日期/时段自动分配 `playDate` 与 `playTimeId`;其他歌曲排到当前选中日期。
- **跨日期本地暂存池**:引入 `crossDateLocalPool` 保存尚未保存但已排入其他日期的临时排期,切换 `selectedDate` 或时段时正确回填对应日期的草稿,避免自动排入后切换视图导致丢失。
- **排期列表去重与过滤**:时段过滤逻辑修复 `playTimeId == null` 的边界,并在合并公开/草稿/本地暂存时按优先级去重。
This commit is contained in:
2026-09-13 16:18:09 +08:00
parent c4c30de416
commit 37fd18aaea
3 changed files with 158 additions and 66 deletions
+29 -13
View File
@@ -1,28 +1,34 @@
<template>
<div class="relative bg-zinc-900/50 border border-zinc-800/50 rounded-2xl p-1 overflow-hidden">
<div class="relative bg-zinc-900/50 border border-zinc-800/50 rounded-xl p-1 overflow-hidden">
<!-- 简化版多选日期显示 -->
<div class="flex items-center justify-between px-3 py-2" @click="toggleCalendar" style="cursor: pointer">
<div class="flex items-center gap-3">
<div class="flex flex-col">
<span class="text-sm font-bold text-zinc-200">
已选择 {{ modelValue.length }} 天
<div class="flex items-center justify-between px-2.5 py-1.5" @click="toggleCalendar" style="cursor: pointer">
<div class="flex items-center gap-2.5 min-w-0 flex-1">
<div class="flex flex-col items-center justify-center w-9 h-9 rounded-md bg-blue-600 text-white shadow shadow-blue-900/20 shrink-0">
<span class="text-[9px] font-bold uppercase tracking-wider opacity-80 leading-tight">
{{ modelValue.length }}
</span>
<span class="text-xs text-zinc-500 font-medium truncate max-w-[200px]">
{{ modelValue.join(', ') || '未选择日期' }}
<span class="text-[10px] font-bold leading-none opacity-80">天</span>
</div>
<div class="flex flex-col min-w-0 flex-1">
<span class="text-xs font-bold text-zinc-200 truncate">
{{ modelValue.length ? modelValue.slice(0, 3).join('、') + (modelValue.length > 3 ? ` 等${modelValue.length}天` : '') : '未选择日期' }}
</span>
<span class="text-[10px] text-zinc-500 font-medium leading-tight truncate">
{{ selectedDatesSummary }}
</span>
</div>
</div>
<div class="flex items-center border-l border-zinc-800 pl-3">
<button class="p-2 text-zinc-500 hover:text-emerald-400 transition-colors" title="跳转到今天" @click.stop="scrollToToday">
<CircleDot class="w-5 h-5" />
<div class="flex items-center border-l border-zinc-800 pl-2 ml-2 shrink-0">
<button class="p-1.5 text-zinc-500 hover:text-emerald-400 transition-colors" title="跳转到今天" @click.stop="scrollToToday">
<CircleDot class="w-4 h-4" />
</button>
<button
class="p-2 text-zinc-500 hover:text-blue-400 transition-colors"
class="p-1.5 text-zinc-500 hover:text-blue-400 transition-colors"
:class="{ 'text-blue-400': showCalendar }"
title="打开月历"
>
<CalendarIcon class="w-5 h-5" />
<CalendarIcon class="w-4 h-4" />
</button>
</div>
</div>
@@ -165,6 +171,16 @@ const calendarMonth = ref(today.getMonth())
const weekdayNames = ['日', '一', '二', '三', '四', '五', '六']
const selectedDatesSummary = computed(() => {
if (!props.modelValue || props.modelValue.length === 0) return '点击右侧按钮选择日期'
const sorted = sortDates(props.modelValue)
const todayStr = formatDateStr(today)
if (sorted.includes(todayStr)) return `含今天 共 ${sorted.length} 天`
const first = sorted[0]
const last = sorted[sorted.length - 1]
return `${first} ~ ${last}`
})
const batchActions = [
{ label: '今天', action: 'today' },
{ label: '明天起7天', action: 'next7' },