feat(selection): 集成 B1 FastDTW 图形评分

This commit is contained in:
yuxuanhui
2026-08-31 16:14:16 +08:00
parent 86762c0d9a
commit 6ce291e242
51 changed files with 2917 additions and 41 deletions
@@ -14,6 +14,7 @@ import {
import type {
SelectionResults,
SelectionSort,
SelectionStockResult,
} from "../api/selection.types"
import { ExecutionStatusTrigger } from "./execution-status-trigger"
@@ -28,6 +29,14 @@ import {
import { SignalTable } from "./signal-table"
const PAGE_SIZE_OPTIONS = [5, 10, 15] as const
const SCORE_SORT_OPTIONS: ReadonlyArray<{
label: string
value: SelectionSort
}> = [
{ label: "按股票代码", value: "code" },
{ label: "评分从高到低", value: "score_desc" },
{ label: "评分从低到高", value: "score_asc" },
]
interface SelectionResultsWorkbenchProps {
drawerOpen: boolean
@@ -46,6 +55,7 @@ export function SelectionResultsWorkbench({
const navigate = useNavigate({ from: "/selection" })
const query = search.search ?? ""
const category = search.category ?? "all"
const sort = search.sort ?? "code"
const [selectedKey, setSelectedKey] = useState<string | null>(null)
const [expandedKeys, setExpandedKeys] = useState<ReadonlySet<string>>(
new Set(),
@@ -84,6 +94,7 @@ export function SelectionResultsWorkbench({
pageSize?: number
search?: string
category?: SignalCategoryFilter
sort?: SelectionSort
}) {
void navigate({ search: (previous) => ({ ...previous, ...next }) })
}
@@ -96,6 +107,10 @@ export function SelectionResultsWorkbench({
updateSearch({ category: value, page: 1 })
}
function handleSortChange(value: SelectionSort) {
updateSearch({ page: 1, sort: value })
}
function handleToggleExpanded(stock: SelectionStockResult) {
const key = getStockKey(stock)
setExpandedKeys((previous) => {
@@ -143,6 +158,31 @@ export function SelectionResultsWorkbench({
</SelectGroup>
</SelectContent>
</Select>
<Select
items={SCORE_SORT_OPTIONS}
onValueChange={(value) => {
if (typeof value === "string") {
handleSortChange(value as SelectionSort)
}
}}
value={sort}
>
<SelectTrigger
aria-label="排序命中股票"
className="h-11 w-full bg-background text-sm sm:w-auto sm:min-w-36 md:h-8"
>
<SelectValue placeholder="排序命中股票" />
</SelectTrigger>
<SelectContent align="start" alignItemWithTrigger={false}>
<SelectGroup>
{SCORE_SORT_OPTIONS.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.label}
</SelectItem>
))}
</SelectGroup>
</SelectContent>
</Select>
<span className="text-xs tabular-nums text-muted-foreground sm:ml-auto">
筛选结果 {stocksTotal} 只
</span>