feat: review entry reason picker uses dropdown instead of prompt

Add modal select for trade record review, expand options to two-level labels (反转/启动A), and accept legacy short labels on save.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 00:38:16 +08:00
parent f580e4542d
commit 1092816359
10 changed files with 188 additions and 34 deletions
+6 -4
View File
@@ -1121,8 +1121,9 @@ STATS_SEGMENT_DEFS = (
("key_trigger", "关键位触价开仓", {"segment": "key_trigger"}),
)
def normalize_entry_reason(raw, custom_text=None):
v = str(raw or "").strip()
return v if v in ENTRY_REASON_OPTIONS else ""
from lib.trade.entry_model_lib import normalize_review_entry_reason
return normalize_review_entry_reason(raw, ENTRY_REASON_OPTIONS)
def normalize_early_exit_trigger(raw):
@@ -8933,9 +8934,10 @@ def api_trade_record_review_update():
reviewed_entry_reason_update = _MISSING_ER
if "reviewed_entry_reason" in payload:
s = str(payload.get("reviewed_entry_reason") or "").strip()
if s and not normalize_entry_reason(s):
norm = normalize_entry_reason(s) if s else None
if s and not norm:
return jsonify({"ok": False, "msg": "开仓类型须为下拉选项之一或留空"}), 400
reviewed_entry_reason_update = s or None
reviewed_entry_reason_update = norm
conn = get_db()
row = conn.execute("SELECT risk_amount FROM trade_records WHERE id=?", (rec_id,)).fetchone()