import { useState } from 'react' import { ChevronLeft, ChevronRight, ExternalLink, Sparkles, Star } from 'lucide-react' import * as Popover from '@radix-ui/react-popover' import type { RankedItem } from '../lib/day2' import { message } from '../lib/day2' import { useStore } from '../lib/store' import { defaultMatchDimNames } from '../types' import type { AnalysisPanelState } from './AiPanel' import { ProjectTags } from './ProjectTags' import { GhostButton } from './ui-ext/AiButton' const PAGE_SIZE = 8 /** 原型七列表格,所有分数、节奏与门槛均读取已保存摘要,缺字段不在浏览器猜测。 */ export function OpportunityTable({ items, batchId, onOpenPanel }: { items: RankedItem[]; batchId: string; onOpenPanel: (state: AnalysisPanelState) => void }) { const { addWatch, isWatched } = useStore() const [scoreProject, setScoreProject] = useState(null) const [page, setPage] = useState(1), [error, setError] = useState('') const [tagProject, setTagProject] = useState(null), [saving, setSaving] = useState(false) const totalPages = Math.max(1, Math.ceil(items.length / PAGE_SIZE)), current = Math.min(page, totalPages) const rows = items.slice((current - 1) * PAGE_SIZE, current * PAGE_SIZE) const open = (item: RankedItem) => onOpenPanel({ kind: 'project', project: item.facts, item, batchId }) const follow = async (id: string) => { if (saving) return setSaving(true); setError('') try { if (!isWatched(id)) await addWatch(id); setTagProject(id) } catch (e) { setError(message(e)) } finally { setSaving(false) } } return <> {error &&

{error}

}
{[30, 15, 9, 14, 11, 7, 14].map((width, i) => )}{['项目名称', '招标方', '预算', '时间节奏', '参与门槛', '匹配度', '操作'].map((name, i) => )}{rows.map(item => { const p = item.facts, summary = item.analysis?.summary, match = item.analysis?.match return open(item)} className="cursor-pointer border-b border-line-soft/70 transition-colors last:border-0 hover:bg-brand-50/40"> })}
{name}
{ e.stopPropagation(); if (!p.url) open(item) }} className="inline-flex items-start gap-1 font-medium leading-snug text-ink-900 hover:text-brand-500 hover:underline">{p.title || '标题待核验'}{p.url && }
{p.products.slice(0, 2).map(kw => {kw})}
{p.purchaser || '待核验'}
{p.region || '地区未知'}
{p.budgetWan == null ? 未披露 : {p.budgetWan.toLocaleString()} 万元}
{summary?.schedule[0] || '截止未披露'}
发布 {p.publishDate || '未知'}
{summary?.qualifications[0] || '条件待核验'} setScoreProject(value ? p.id : null)}> e.stopPropagation()} sideOffset={8} className="z-50 w-72 rounded-card border border-line-soft bg-white p-3 shadow-card-hover">

贴合度打分构成

{match ? <>
    {Object.entries(match.dimensions).map(([key, dim]) =>
  • {defaultMatchDimNames[key as keyof typeof defaultMatchDimNames] ?? key} · 权重 {match.weights[key]}%{dim.known ? `${dim.score} 分` : '待核验'}

    {dim.basis}

  • )}

完整性 {match.completeness}% · 档案 v{match.profileVersion} · {match.limitation}

:

尚无已保存评分,请完善公司档案后重新检索。

}
{ if (!value) setTagProject(null) }}> e.stopPropagation()}> setTagProject(null)} />
{!items.length &&
} {!!items.length &&
第 {(current - 1) * PAGE_SIZE + 1}–{Math.min(current * PAGE_SIZE, items.length)} 条,共 {items.length} 条 setPage(current - 1)} className="!px-2.5 !py-1 text-xs"> 上一页第 {current} / {totalPages} 页= totalPages} onClick={() => setPage(current + 1)} className="!px-2.5 !py-1 text-xs">下一页
} } function SearchEmpty() { return <>

没有符合条件的项目

可调整关键词、地区、预算或发布时间范围后重新检索

}