import { useQuery } from '@tanstack/react-query' import api from '@/lib/api' import { PieChart, Pie, Cell, Tooltip, ResponsiveContainer } from 'recharts' import { DataTable } from '@/components/DataTable' import { Badge } from '@/components/Badge' import { MetricCard } from '@/components/MetricCard' import { Pagination } from '@/components/Pagination' import { useState, useMemo } from 'react' const REVIEW_COLORS = { '达标': '#22c55e', '改善中': '#eab308', '未改善': '#ef4444' } const PAGE_SIZE = 10 export function MonthlyReviewPage() { const [month, setMonth] = useState('2026-05') const [page, setPage] = useState(1) const { data } = useQuery({ queryKey: ['monthly-review', month], queryFn: () => api.get('/tasks/monthly-review', { params: { month } }), }) const rd = (data as any)?.data const summary = rd?.summary || { total: 0, passed: 0, improving: 0, failed: 0 } const details = rd?.details || [] const pagedDetails = useMemo(() => details.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE), [details, page]) const pieData = [ { name: '达标', value: summary.passed }, { name: '改善中', value: summary.improving }, { name: '未改善', value: summary.failed }, ].filter((d) => d.value > 0) return (
达标门店的有效经验可标准化推广
暂无标准化经验
) : practices.map((p: any) => (标杆:{p.benchmark_store_name}
{p.key_actions}