From c4d7fdae5fe3e7cd95186b1b876f09934b6d9226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=BA=90?= Date: Thu, 10 Sep 2026 14:35:04 +0800 Subject: [PATCH] feat: add by-day selector in performance filters --- index.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index fdc2472..554217e 100644 --- a/index.html +++ b/index.html @@ -156,6 +156,10 @@ +
+ + +
@@ -359,7 +363,8 @@ fillSelect('perfChannel', [...new Set(perfData.map(d => d.channel))].sort()); fillSelect('perfProduct', [...new Set(perfData.map(d => d.product))].sort()); fillSelect('perfCountry', [...new Set(perfData.map(d => d.location))].filter(x=>x&&x!=='0').sort()); - ['perfChannel','perfProduct','perfCountry','perfRange'].forEach(id => + fillSelect('perfDay', [...new Set(perfData.map(d => d.date))].sort().reverse()); + ['perfChannel','perfProduct','perfCountry','perfRange','perfDay'].forEach(id => document.getElementById(id).addEventListener('change', drawPerf)); drawPerf(); } @@ -370,10 +375,14 @@ const pr = document.getElementById('perfProduct').value; const co = document.getElementById('perfCountry').value; const rg = document.getElementById('perfRange').value; + const day = document.getElementById('perfDay').value; if (ch !== 'all') d = d.filter(x => x.channel === ch); if (pr !== 'all') d = d.filter(x => x.product === pr); if (co !== 'all') d = d.filter(x => x.location === co); - if (rg !== 'all') { + // 选了具体某天则优先按天过滤(覆盖时间范围);否则用时间范围 + if (day !== 'all') { + d = d.filter(x => x.date === day); + } else if (rg !== 'all') { const allDates = [...new Set(perfData.map(x => x.date))].sort(); const cut = allDates[Math.max(0, allDates.length - parseInt(rg))]; d = d.filter(x => x.date >= cut);