feat(energy): 氢/电统一时间速选为「本周/本月/近15天」+ 缺失日补 0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- 后端 Range 类型精简到 thisWeek / thisMonth / last15
  rangeClause 同步精简;删除 today / thisQuarter / last7 / last30 分支
- 新增 enumerateDates(range):列出 range 内全部日期,用于补零
- /hydrogen/daily:用 enumerateDates 补齐缺失日期 totalKg=0、stations=[]
  补零后基于完整日期序列重算环比(0→上一日有值时显示 -100%)
- /electric/monthly:增加 range 参数,扁平日聚合 + 月份分组
  缺失日期同样补零;环比基于补零序列重算
- 默认 range 改 last15

前端
- HydrogenDaily QUICK_PICK_OPTIONS 收紧到 3 项,默认 last15
- ElectricDaily 之前没有日期速选,现按氢能样式加上同样 3 项

类型 DateQuickPick 改 'thisWeek' | 'thisMonth' | 'last15'

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-30 14:56:13 +08:00
parent 234b44ea03
commit e0183986ee
5 changed files with 130 additions and 58 deletions

View File

@@ -8,16 +8,13 @@ import type { CustomerType, DateQuickPick, HydrogenDailyRow } from './types';
import RotatingFooterHint from '../../components/RotatingFooterHint';
const QUICK_PICK_OPTIONS: Array<{ id: DateQuickPick; label: string }> = [
{ id: 'today', label: '当天' },
{ id: 'thisWeek', label: '本' },
{ id: 'thisMonth', label: '本月' },
{ id: 'thisQuarter', label: '本季度' },
{ id: 'last7', label: '最近7天' },
{ id: 'last30', label: '最近30天' },
{ id: 'thisWeek', label: '本周' },
{ id: 'thisMonth', label: '本' },
{ id: 'last15', label: '近 15 天' },
];
export default function HydrogenDaily() {
const [pick, setPick] = useState<DateQuickPick>('last30');
const [pick, setPick] = useState<DateQuickPick>('last15');
const [customer, setCustomer] = useState<CustomerType>('lingniu');
const [expanded, setExpanded] = useState<Set<string>>(new Set());
const [rows, setRows] = useState<HydrogenDailyRow[] | null>(null);