fix: 修复成本/库存/对账多页面数据准确性与展示问题

- 库存周转: turnover_days零消耗时返回NULL并显示"无消耗",排序至末尾;
  门店名称三级回退(dim_store→mv_distribution_monthly→硬编码中央厨房)
- 成本管理: estimated_inventory_days为NULL时显示"-"而非"0.0天";
  补充成本率口径与指标关系说明
- 成本分析: 修复理论成本率计算(按单位售价而非单价),新增sales_quantity展示;
  区分菜品级(Excel)与门店级(倒挤)成本指标,说明差异原因
- 配送对账: 区分中央厨房/门店,分层展示耗用口径
- 告警/任务/目标管理: 新增详情弹窗组件,优化交互体验

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
selfrelease
2026-08-15 17:37:06 +08:00
parent d373fb5f0c
commit 9b3a9cdb4b
19 changed files with 1605 additions and 298 deletions
+4 -17
View File
@@ -8,13 +8,14 @@ import { Tabs } from '@/components/Tabs'
import { formatCurrency, formatNumber, formatPercent } from '@/lib/utils'
import { useState } from 'react'
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, PieChart, Pie, Cell } from 'recharts'
import { MonthPicker } from '@/components/MonthPicker'
const GRADE_COLORS: Record<string, string> = { A: '#22c55e', B: '#3b82f6', C: '#eab308', D: '#ef4444' }
export function TargetManagementPage() {
const [tab, setTab] = useState('overview')
const [year, setYear] = useState(new Date().getFullYear())
const [month, setMonth] = useState(new Date().toISOString().slice(0, 7))
const [month, setMonth] = useState('2026-04')
const year = parseInt(month.split('-')[0])
const queryClient = useQueryClient()
const { data: annualData, isLoading: annualLoading } = useQuery({
@@ -96,21 +97,7 @@ export function TargetManagementPage() {
<h1 className="text-xl font-bold"></h1>
<p className="mt-0.5 text-xs text-muted-foreground"> · · · </p>
</div>
<div className="flex items-center gap-2">
<input
type="number"
value={year}
onChange={(e) => setYear(parseInt(e.target.value))}
className="w-20 rounded border px-2 py-1 text-sm"
/>
<span className="text-sm text-muted-foreground"></span>
<input
type="month"
value={month}
onChange={(e) => setMonth(e.target.value)}
className="rounded border px-2 py-1 text-sm"
/>
</div>
<MonthPicker month={month} onChange={setMonth} />
</div>
<Tabs