feat(web): 播报板搜索支持按节点 id 筛选

搜索框在内容/来源之外,新增节点 id 匹配:纯数字或 UI 展示的「#41」形式
都会精确命中该节点。服务端 NodesPage 在 payload/origin ILIKE 的 OR 组里
追加 id 精确匹配;mock 同步;补 NodesPage id 搜索测试。
This commit is contained in:
Autumn-27 committed 2026-09-17 11:31:27 -04:00
1 parent c6c5329a18
commit e2ada7e494
4 files changed
+65 -3

No files matched your search

@@ -567,7 +567,7 @@ export function BroadcastTab({ taskId }: { taskId: string }) {
<Input
value={queryInput}
onChange={(e) => setQueryInput(e.target.value)}
placeholder="搜索播报内容 / 来源"
placeholder="搜索内容 / 来源 / 节点 id"
className="h-8 pl-8"
aria-label="搜索播报"
/>
+6 -1
View File
@@ -2156,7 +2156,12 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
const rank = (id: string) => all.findIndex((n) => n.id === id);
const matched = all
.filter((n) => (kinds.size === 0 || kinds.has(n.type)) && (states.size === 0 || states.has(n.state)))
.filter((n) => !needle || `${n.payload ?? ""} ${n.origin}`.toLowerCase().includes(needle))
.filter(
(n) =>
!needle ||
// 内容 / 来源 / 节点 id 任一命中即可(id 兼容「#41」写法)。
`${n.payload ?? ""} ${n.origin} ${n.id}`.toLowerCase().includes(needle.replace(/^#/, "")),
)
.sort((a, b) => {
const d = Date.parse(a.ts) - Date.parse(b.ts) || rank(a.id) - rank(b.id);
return asc ? d : -d;