feat: 线索池品类选项扩展、隐藏数量列、采集器按钮样式优化

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Sisyphus 2026-06-26 16:25:06 +08:00
parent 0a423af4d2
commit 44609be8c7
3 changed files with 21 additions and 18 deletions

View File

@ -1 +1 @@
NEXT_PUBLIC_API_URL=
NEXT_PUBLIC_API_URL=/api

View File

@ -35,7 +35,7 @@ function mapLead(raw: any): Lead {
id: raw.id,
title: raw.title,
star: raw.star || 0,
level: raw.level || 'C',
level: raw.level ? raw.level + '级' : 'C级',
amount: raw.amount || '待确认',
status: raw.status || '待复核',
deadline: raw.deadline || '',
@ -58,9 +58,9 @@ function mapLead(raw: any): Lead {
}
const STATUS_OPTIONS = ['全部状态', '待复核', '待跟进', '跟进中', '已转询价', '已转协同', '已成交', '无效线索']
const LEVEL_OPTIONS = ['全部级别', 'S级', 'A级', 'B级']
const CAT_OPTIONS = ['全部品类', '防火门', '配电箱', '电线电缆', '阀门', '钢材', '涂料', '混凝土']
const SOURCE_OPTIONS = ['全部来源', 'PowerChina 招采', '新矿集团', '发改委审批', '行业资讯']
const LEVEL_OPTIONS = ['全部级别', 'S级', 'A级', 'B级', 'C级', 'D级']
const CAT_OPTIONS = ['全部品类', '防火门', '配电箱', '电线电缆', '阀门', '钢材', '涂料', '混凝土', '变压器', '水泵', '风机', '管材', '开关', '灯具', '仪表', '电机']
const SOURCE_OPTIONS = ['全部来源', '中电建', '新矿集团', '中核集团']
const PERSON_OPTIONS = ['全部人员', '郑钊', '赵主任', '运营管理员', '未分配']
function getStatusClass(status: string) {
@ -110,7 +110,7 @@ export default function InquiryPage({ onLeadDetail }: { onLeadDetail?: (id: stri
const showToast = (msg: string) => { setToast(msg); setTimeout(() => setToast(''), 2500) }
const [fTime, setFTime] = useState('全部时间')
const [fTime, setFTime] = useState('全部日期')
const [fStar, setFStar] = useState('全部星级')
const [fStatus, setFStatus] = useState('全部状态')
const [fLevel, setFLevel] = useState('全部级别')
@ -118,7 +118,7 @@ export default function InquiryPage({ onLeadDetail }: { onLeadDetail?: (id: stri
const [fSource, setFSource] = useState('全部来源')
const [fPerson, setFPerson] = useState('全部人员')
const loadLeads = useCallback(async (star?: string, status?: string, level?: string, cat?: string, source?: string, person?: string) => {
const loadLeads = useCallback(async (star?: string, status?: string, level?: string, cat?: string, source?: string, person?: string, timeRange?: string) => {
setLoading(true)
const params = new URLSearchParams()
if (star && star !== '全部星级') {
@ -128,11 +128,12 @@ export default function InquiryPage({ onLeadDetail }: { onLeadDetail?: (id: stri
else if (star === '2星及以下') params.set('star', '2星及以下')
}
if (status && status !== '全部状态') params.set('status', status)
if (level && level !== '全部级别') params.set('level', level)
if (level && level !== '全部级别') params.set('level', level.replace('级', ''))
if (cat && cat !== '全部品类') params.set('category', cat)
if (source && source !== '全部来源') params.set('source', source)
if (person && person !== '全部人员' && person !== '未分配') params.set('assignedTo', person)
if (person === '未分配') params.set('assignedTo', '未分配')
if (timeRange && timeRange !== '全部日期') params.set('timeRange', timeRange)
try {
const qs = params.toString()
const data: any[] = await fetch(`${API}${qs ? '?' + qs : ''}`).then(r => r.json())
@ -144,10 +145,10 @@ export default function InquiryPage({ onLeadDetail }: { onLeadDetail?: (id: stri
setLoading(false)
}, [])
useEffect(() => { loadLeads(fStar, fStatus, fLevel, fCat, fSource, fPerson) }, [loadLeads, fStar, fStatus, fLevel, fCat, fSource, fPerson])
useEffect(() => { loadLeads(fStar, fStatus, fLevel, fCat, fSource, fPerson, fTime) }, [loadLeads, fStar, fStatus, fLevel, fCat, fSource, fPerson, fTime])
const refreshLeads = async () => {
await loadLeads(fStar, fStatus, fLevel, fCat, fSource, fPerson)
await loadLeads(fStar, fStatus, fLevel, fCat, fSource, fPerson, fTime)
}
const totalPages = Math.ceil(filtered.length / pageSize)
@ -392,7 +393,7 @@ export default function InquiryPage({ onLeadDetail }: { onLeadDetail?: (id: stri
<div className="bg-white p-4 border border-border-subtle rounded-lg shadow-sm flex flex-wrap items-center gap-4">
<div className="flex flex-wrap items-center gap-4">
{[
{ label: '时间范围', value: fTime, set: setFTime, opts: ['全部时间', '今天', '昨天', '本周', '本月'] },
{ label: '公告日期', value: fTime, set: setFTime, opts: ['全部日期', '今天', '昨天', '本周', '本月'] },
{ label: '星级', value: fStar, set: setFStar, opts: ['全部星级', '5星', '4星', '3星', '2星及以下'] },
{ label: '状态', value: fStatus, set: setFStatus, opts: STATUS_OPTIONS },
{ label: '甲方级别', value: fLevel, set: setFLevel, opts: LEVEL_OPTIONS },
@ -445,7 +446,6 @@ export default function InquiryPage({ onLeadDetail }: { onLeadDetail?: (id: stri
<th className="p-4 w-20 text-[10px] font-bold tracking-wider text-on-surface-variant uppercase whitespace-nowrap">星级</th>
<th className="p-4 w-16 text-[10px] font-bold tracking-wider text-on-surface-variant uppercase whitespace-nowrap">甲方级别</th>
<th className="p-4 w-20 text-[10px] font-bold tracking-wider text-on-surface-variant uppercase text-right whitespace-nowrap">金额(万)</th>
<th className="p-4 w-20 text-[10px] font-bold tracking-wider text-on-surface-variant uppercase whitespace-nowrap">数量</th>
<th className="p-4 w-16 text-[10px] font-bold tracking-wider text-on-surface-variant uppercase whitespace-nowrap">状态</th>
<th className="p-4 w-24 text-[10px] font-bold tracking-wider text-on-surface-variant uppercase whitespace-nowrap">投标截止</th>
<th className="p-4 w-24 text-[10px] font-bold tracking-wider text-on-surface-variant uppercase whitespace-nowrap">公告日期</th>
@ -454,9 +454,9 @@ export default function InquiryPage({ onLeadDetail }: { onLeadDetail?: (id: stri
</thead>
<tbody className="divide-y divide-border-subtle">
{loading ? (
<tr><td colSpan={11} className="p-8 text-center text-sm text-on-surface-variant">加载中...</td></tr>
<tr><td colSpan={10} className="p-8 text-center text-sm text-on-surface-variant">加载中...</td></tr>
) : pageLeads.length === 0 ? (
<tr><td colSpan={11} className="p-8 text-center text-sm text-on-surface-variant">暂无数据</td></tr>
<tr><td colSpan={10} className="p-8 text-center text-sm text-on-surface-variant">暂无数据</td></tr>
) : pageLeads.map(lead => {
const stars = '★'.repeat(lead.star) + '☆'.repeat(5 - lead.star)
return (
@ -476,7 +476,6 @@ export default function InquiryPage({ onLeadDetail }: { onLeadDetail?: (id: stri
<td className="p-4 text-right whitespace-nowrap">
<span className={lead.amount === '待确认' ? 'text-[10px] text-slate-400' : 'text-[11px] font-medium'}>{lead.amount}</span>
</td>
<td className="p-4 text-[10px] text-slate-500 whitespace-nowrap">{lead.quantity ? `${lead.quantity}${lead.unit || ''}` : '-'}</td>
<td className="p-4 whitespace-nowrap"><span className={`px-2 py-0.5 text-[10px] font-medium rounded-full ${getStatusClass(lead.status)}`}>{lead.status}</span></td>
<td className="p-4 text-[10px] text-slate-500 whitespace-nowrap">{lead.deadline ? lead.deadline.slice(5, 10) : '-'}</td>
<td className="p-4 text-[10px] text-slate-500 whitespace-nowrap">{lead.publishTime ? lead.publishTime.slice(0, 10) : '-'}</td>

View File

@ -796,12 +796,16 @@ export default function RuleCenterPage() {
</div>
) : <span className="text-xs text-slate-400">全部</span>}
</td>
<td className="p-3">
<td className="p-3">
<button
onClick={() => toggleCrawlerStatus(c.id, c.status)}
className={`px-2 py-0.5 text-[10px] font-medium rounded-full border ${getStatusStyle(c.status)}`}
className={`px-3 py-1 text-[11px] font-semibold rounded-md transition-all cursor-pointer ${
c.status === 'active'
? 'bg-amber-50 text-amber-700 hover:bg-amber-100 active:bg-amber-200'
: 'bg-emerald-50 text-emerald-700 hover:bg-emerald-100 active:bg-emerald-200'
}`}
>
{{ active: '暂停', paused: '启动', error: '重启' }[c.status] || c.status}
{{ active: '点击暂停', paused: '点击启动', error: '重启' }[c.status] || c.status}
</button>
</td>
<td className="p-3 text-xs text-on-surface-variant">