fix(self-operated): follow selected dates in hot rankings

This commit is contained in:
2026-10-13 18:47:56 +08:00
parent 133654327d
commit 698ca34529
11 changed files with 76 additions and 28 deletions
@@ -62,9 +62,11 @@ export function parseDashboardDrilldown(query: LocationQuery, mode: 'sales' | 'i
if (['coverageBucket', 'coverageSelection', 'bucketRuleVersion', 'attention', 'sortBy'].some(key => query[key] !== undefined)) throw new Error('销量下钻不能携带库存条件')
const analysis = scalar(query, 'analysis', true)
if (analysis === 'HOT') {
if (['rangePreset', 'startDate', 'endDate'].some(key => query[key] !== undefined)) throw new Error('热销下钻不能携带趋势日期条件')
if (scalar(query, 'windowDays', true) !== '30') throw new Error('热销下钻须为30个完整日')
result.analysis = 'hot'; result.summary += ' · 近30日热销Top100'
if (query.windowDays !== undefined || scalar(query, 'rangePreset', true) !== 'CUSTOM') throw new Error('热销下钻须使用榜单实际日期')
result.startDate = scalar(query, 'startDate', true); result.endDate = scalar(query, 'endDate', true)
if (validateCustomRange(result.startDate, result.endDate, context.anchorDate)) throw new Error('热销下钻日期无效')
result.analysis = 'hot'; result.rangePreset = 'CUSTOM'
result.summary += ` · 所选时段热销Top100 · ${result.startDate} 至 ${result.endDate}`
} else if (analysis === 'SKU') {
if (query.windowDays !== undefined) throw new Error('SKU日期下钻不能携带榜单窗口')
const range = scalar(query, 'rangePreset', true)