006fd7de7e
- 新增 useCompanyName hook 和 CompanyNameTag 组件 - 20+ investor 页面添加 CompanyNameTag 显示企业名 - 表格型页面(agents/agreements/board/weak-signals/talents/reports)新增企业列 - 卡片型页面(risks/synergies/sentinels/alpha/exit-signals/okrs/aars/events/tasks/pre-mortems/nudges/product-diagnostics/peer-circles)添加企业名标签 - customer-success 改用 CompanyNameTag 替代手动 company_name 显示 - PlanCard 组件添加企业名标签 - 编译验证通过
88 lines
3.5 KiB
TypeScript
88 lines
3.5 KiB
TypeScript
"use client";
|
|
|
|
import { useState } from "react";
|
|
import { useScopeEffect } from "@/lib/company-scope";
|
|
import { CompanyNameTag } from "@/components/shared/CompanyNameTag";
|
|
import { listWeakSignals } from "@/lib/api-v2";
|
|
import { PageContainer, Badge} from "@/components/shared/PageContainer";
|
|
import { LoadingSpinner } from "@/components/shared/LoadingSpinner";
|
|
import { EmptyState } from "@/components/shared/EmptyState";
|
|
|
|
/** 弱信号项。 */
|
|
interface WeakSignal {
|
|
company_id?: string;
|
|
signal_type: string;
|
|
content: string;
|
|
confidence: number;
|
|
risk_probability?: number;
|
|
status: string;
|
|
}
|
|
|
|
const SIGNAL_TYPE_LABELS: Record<string, string> = {
|
|
technical: "技术",
|
|
sentiment: "情绪",
|
|
org: "组织",
|
|
market: "市场",
|
|
};
|
|
|
|
export default function WeakSignalsPage() {
|
|
const [items, setItems] = useState<WeakSignal[]>([]);
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
|
|
useScopeEffect(() => {
|
|
listWeakSignals()
|
|
.then((resp) => setItems((resp.data as WeakSignal[]) ?? []))
|
|
.catch(() => setItems([]))
|
|
.finally(() => setIsLoading(false));
|
|
});
|
|
|
|
return (
|
|
<PageContainer title="弱信号监控" description="技术/情绪/组织/市场四类弱信号采集与关联分析">
|
|
{isLoading ? (
|
|
<LoadingSpinner />
|
|
) : items.length === 0 ? (
|
|
<EmptyState description="暂无弱信号" />
|
|
) : (
|
|
<div className="overflow-x-auto rounded-lg border border-gray-200">
|
|
<table className="min-w-full divide-y divide-gray-200 text-sm">
|
|
<thead className="bg-gray-50">
|
|
<tr>
|
|
<th className="px-4 py-2 text-left font-medium text-gray-500">企业</th>
|
|
<th className="px-4 py-2 text-left font-medium text-gray-500">类型</th>
|
|
<th className="px-4 py-2 text-left font-medium text-gray-500">内容</th>
|
|
<th className="px-4 py-2 text-left font-medium text-gray-500">置信度</th>
|
|
<th className="px-4 py-2 text-left font-medium text-gray-500">风险概率</th>
|
|
<th className="px-4 py-2 text-left font-medium text-gray-500">状态</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody className="divide-y divide-gray-100 bg-white">
|
|
{items.map((item, i) => (
|
|
<tr key={i}>
|
|
<td className="px-4 py-2"><CompanyNameTag companyId={item.company_id} /></td>
|
|
<td className="px-4 py-2">
|
|
<Badge color="blue">{SIGNAL_TYPE_LABELS[item.signal_type] ?? item.signal_type}</Badge>
|
|
</td>
|
|
<td className="px-4 py-2 text-gray-900 max-w-xs truncate">{item.content}</td>
|
|
<td className="px-4 py-2 text-gray-600">{(item.confidence * 100).toFixed(0)}%</td>
|
|
<td className="px-4 py-2">
|
|
{item.risk_probability ? (
|
|
<Badge color={item.risk_probability > 0.6 ? "red" : item.risk_probability > 0.3 ? "amber" : "green"}>
|
|
{(item.risk_probability * 100).toFixed(0)}%
|
|
</Badge>
|
|
) : "-"}
|
|
</td>
|
|
<td className="px-4 py-2">
|
|
<Badge color={item.status === "alerted" ? "red" : item.status === "correlated" ? "amber" : "gray"}>
|
|
{item.status}
|
|
</Badge>
|
|
</td>
|
|
</tr>
|
|
))}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
)}
|
|
</PageContainer>
|
|
);
|
|
}
|