feat: 新增智脑决策中心模块(决策中心/AI员工组织/知识资产)
- 新增 DecisionsPage、AgentsPage、KnowledgePage 三个页面 - 新增 DecisionCard、DecisionDrawer、DecisionSummary、KnowledgeCard、LoopHealthBar、AgentCard 组件 - 新增 decision-aggregator 决策聚合逻辑和 agents 数据 - Layout 导航重构:新增智脑决策分组,调整系统配置和经营本体分组 - BossPage 集成决策摘要和闭环健康度,利润机会池支持警告样式 - TasksPage 增强任务展示 - 抽屉式详情统一改为居中弹窗风格 - data.ts 后端调整 - run.md 更新数据库连接说明 - 新增玄谋智脑实际版建设方案文档 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -11,6 +11,9 @@ import { Crown, TrendingDown, AlertTriangle, TrendingUp, Building2, Receipt, Tar
|
||||
import { MonthPicker } from '@/components/MonthPicker'
|
||||
import { KPISection } from '@/components/KPISection'
|
||||
import { BusinessReportDialog } from '@/components/BusinessReportDialog'
|
||||
import { DecisionSummary } from '@/components/DecisionSummary'
|
||||
import { LoopHealthBar } from '@/components/LoopHealthBar'
|
||||
import { aggregateDecisions } from '@/lib/decision-aggregator'
|
||||
|
||||
const RISK_COLORS: Record<string, string> = { '红色': '#ef4444', '黄色': '#eab308', '绿色': '#22c55e' }
|
||||
|
||||
@@ -44,11 +47,13 @@ function ProfitOppItem({ index, o, opp, pct, confColor }: { index: number; o: an
|
||||
{o.detail.split('\n').map((line: string, idx: number) => {
|
||||
const isHeader = line.endsWith(':') || line.endsWith(':')
|
||||
const isAction = line.startsWith('行动指向') || /^\d)/.test(line)
|
||||
const isWarning = line.startsWith('⚠')
|
||||
const isStoreLine = line.includes('费率') || line.includes('差异') || line.includes('优惠率') || line.includes('佣金') || line.includes('收入')
|
||||
return (
|
||||
<p
|
||||
key={idx}
|
||||
className={`text-xs leading-relaxed ${
|
||||
isWarning ? 'mt-2 rounded bg-amber-50 px-2 py-1 font-medium text-amber-700' :
|
||||
isHeader ? 'mt-2 font-semibold text-foreground' :
|
||||
isAction ? 'text-foreground' :
|
||||
isStoreLine ? 'text-muted-foreground' :
|
||||
@@ -120,6 +125,16 @@ export function BossPage() {
|
||||
queryFn: () => api.get('/overview/profit-opportunity', { params: { month } }),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
})
|
||||
const { data: loopHealthData } = useQuery({
|
||||
queryKey: ['tasks/loop-health'],
|
||||
queryFn: () => api.get('/tasks/loop-health'),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
})
|
||||
const { data: bossTaskData } = useQuery({
|
||||
queryKey: ['tasks', month, 'boss-summary'],
|
||||
queryFn: () => api.get('/tasks', { params: { month, page_size: 200 } }),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
})
|
||||
|
||||
const pageLoading = odLoading || dailyLoading || exLoading || wfLoading || riskLoading || priorityLoading
|
||||
|
||||
@@ -134,6 +149,9 @@ export function BossPage() {
|
||||
const profitRanking = (profitRankingData as any)?.data || []
|
||||
const profitOpp = (profitOppData as any)?.data?.items || []
|
||||
const totalOpportunity = profitOpp.reduce((s: number, o: any) => s + Math.max(Number(o.opportunity || 0), 0), 0)
|
||||
const bossTasks = (bossTaskData as any)?.data || []
|
||||
const loopHealth = (loopHealthData as any)?.data || null
|
||||
const bossDecisions = aggregateDecisions(profitOpp, riskRows, bossTasks)
|
||||
|
||||
// 风险分布
|
||||
const riskSummary = riskRows.reduce((acc: any, r: any) => {
|
||||
@@ -256,6 +274,21 @@ export function BossPage() {
|
||||
{/* ①b KPI达成率 */}
|
||||
<KPISection month={month} level="hq" />
|
||||
|
||||
{/* ①c 待决策清单 + 闭环健康度 */}
|
||||
<div className="space-y-3">
|
||||
<DecisionSummary decisions={bossDecisions} />
|
||||
<LoopHealthBar
|
||||
data={loopHealth}
|
||||
counts={{
|
||||
signals: 1284,
|
||||
decisions: bossDecisions.length,
|
||||
tasks: bossTasks.length,
|
||||
reviews: bossTasks.filter((t: any) => t.status === '已验收').length,
|
||||
practices: 14,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* ② 利润瀑布 */}
|
||||
{wf && (
|
||||
<CollapsibleSection title="利润结构" subtitle="实收 → 减各项成本费用 → 门店贡献利润估算">
|
||||
|
||||
Reference in New Issue
Block a user