fix(history): 创建时间 UTC→北京时间(+8); 标的列加宽(100→130)治折行 [nas]
This commit is contained in:
@@ -158,7 +158,7 @@ function statusLabel(s: string): string {
|
|||||||
<template #default="{ row }"><span class="chip" :class="`chip-${row.type}`">{{ typeLabel(row.type) }}</span></template>
|
<template #default="{ row }"><span class="chip" :class="`chip-${row.type}`">{{ typeLabel(row.type) }}</span></template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="strategy" label="策略 / 因子" min-width="130" show-overflow-tooltip />
|
<el-table-column prop="strategy" label="策略 / 因子" min-width="130" show-overflow-tooltip />
|
||||||
<el-table-column prop="symbol" label="标的" width="100" />
|
<el-table-column prop="symbol" label="标的" width="130" />
|
||||||
<el-table-column label="状态" width="88">
|
<el-table-column label="状态" width="88">
|
||||||
<template #default="{ row }"><span class="chip" :class="`st-${row.status}`">{{ statusLabel(row.status) }}</span></template>
|
<template #default="{ row }"><span class="chip" :class="`st-${row.status}`">{{ statusLabel(row.status) }}</span></template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|||||||
+13
-1
@@ -322,6 +322,18 @@ def factor_report(task_id: str, factor: str, token: str = Query(...)):
|
|||||||
|
|
||||||
# ===== History + Optimization endpoints (S3) =====
|
# ===== History + Optimization endpoints (S3) =====
|
||||||
|
|
||||||
|
def _to_bj(ts: str | None) -> str:
|
||||||
|
"""SQLite CURRENT_TIMESTAMP 存的是 UTC → 转北京时间(+8)显示。"""
|
||||||
|
if not ts:
|
||||||
|
return ""
|
||||||
|
try:
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
dt = datetime.strptime(ts, "%Y-%m-%d %H:%M:%S")
|
||||||
|
return (dt + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
return ts
|
||||||
|
|
||||||
|
|
||||||
@router.get("/task", dependencies=[Depends(verify_token)])
|
@router.get("/task", dependencies=[Depends(verify_token)])
|
||||||
def list_tasks(type: str | None = None, status: str | None = None):
|
def list_tasks(type: str | None = None, status: str | None = None):
|
||||||
"""List tasks: 内存中 running/pending + DB done/failed(历史)。
|
"""List tasks: 内存中 running/pending + DB done/failed(历史)。
|
||||||
@@ -377,7 +389,7 @@ def list_tasks(type: str | None = None, status: str | None = None):
|
|||||||
"symbol": r.symbol,
|
"symbol": r.symbol,
|
||||||
"start": r.start,
|
"start": r.start,
|
||||||
"end": r.end,
|
"end": r.end,
|
||||||
"created_at": r.created_at,
|
"created_at": _to_bj(r.created_at),
|
||||||
})
|
})
|
||||||
|
|
||||||
active.reverse() # 最新提交的 running 在最上
|
active.reverse() # 最新提交的 running 在最上
|
||||||
|
|||||||
Reference in New Issue
Block a user