feat: show entry type in trade records, remove journal custom entry reason
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<script>
|
||||
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
||||
const ORDER_ENTRY_MODEL_TRADE_STYLE = {{ entry_model_trade_style_map | tojson }};
|
||||
const JOURNAL_ENTRY_REASON_OTHER = {{ entry_reason_other_value | tojson }};
|
||||
|
||||
function tradeStyleForEntryModelSelect(sel){
|
||||
if(!sel || !sel.value) return "trend";
|
||||
@@ -57,38 +56,14 @@ function reloadInstancePage(){
|
||||
window.location.href = `${window.location.pathname}?_ts=${Date.now()}`;
|
||||
}
|
||||
|
||||
function syncJournalEntryReasonOtherUi(){
|
||||
const form = document.getElementById("journal-form");
|
||||
if(!form) return;
|
||||
const sel = form.querySelector('[name="entry_reason"]');
|
||||
const box = form.querySelector('[name="entry_reason_custom"]');
|
||||
if(!sel || !box) return;
|
||||
if(sel.value === JOURNAL_ENTRY_REASON_OTHER){
|
||||
box.style.display = "";
|
||||
box.required = true;
|
||||
} else {
|
||||
box.style.display = "none";
|
||||
box.required = false;
|
||||
box.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
function validateJournalEntryReason(){
|
||||
const form = document.getElementById("journal-form");
|
||||
if(!form) return true;
|
||||
const sel = form.querySelector('[name="entry_reason"]');
|
||||
const box = form.querySelector('[name="entry_reason_custom"]');
|
||||
if(!sel || !sel.value){
|
||||
alert("请选择开仓类型");
|
||||
return false;
|
||||
}
|
||||
if(sel.value === JOURNAL_ENTRY_REASON_OTHER){
|
||||
const t = (box && box.value || "").trim();
|
||||
if(!t){
|
||||
alert("选择「其他」时请填写自定义开仓类型说明");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function showImage(src){document.getElementById("bigImg").src=src;document.getElementById("imgModal").style.display="flex";}
|
||||
@@ -240,7 +215,7 @@ function editTradeRecordReview(t){
|
||||
const result = prompt("结果(止盈/止损/保本止盈/移动止盈/手动平仓/时间平仓)", String(t.result || ""));
|
||||
if(result === null) return;
|
||||
const note = prompt("备注(可空)", String(t.miss_reason || "")) ?? "";
|
||||
const entryHint = "开仓类型:五种固定整句、或自定义说明(2000字内;与复盘表单一致;留空=本次不改该项)";
|
||||
const entryHint = "开仓类型(下拉选项之一,留空=不改该项)";
|
||||
const entryIn = prompt(entryHint, String(t.effective_entry_reason || ""));
|
||||
if(entryIn === null) return;
|
||||
const payload = {
|
||||
@@ -616,8 +591,6 @@ function fillJournalFromTrade(t){
|
||||
setJournalField("entry_reason", "");
|
||||
}
|
||||
}
|
||||
setJournalField("entry_reason_custom", "");
|
||||
syncJournalEntryReasonOtherUi();
|
||||
const er = String(t.result || "").trim();
|
||||
const exitTrigMap = { 止盈: "止盈", 保本止盈: "保本止盈", 移动止盈: "移动止盈", 时间平仓: "时间平仓", 手动平仓: "手动平仓", 止损: "止损" };
|
||||
if(exitTrigMap[er]) setJournalField("early_exit_trigger", exitTrigMap[er]);
|
||||
@@ -1193,9 +1166,6 @@ if(_journalFormEl){
|
||||
_journalFormEl.addEventListener("submit", function(ev){
|
||||
if(!validateJournalEntryReason()) ev.preventDefault();
|
||||
});
|
||||
const _jErSel = _journalFormEl.querySelector('[name="entry_reason"]');
|
||||
if(_jErSel) _jErSel.addEventListener("change", syncJournalEntryReasonOtherUi);
|
||||
syncJournalEntryReasonOtherUi();
|
||||
}
|
||||
|
||||
const addOrderForm = document.getElementById("add-order-form");
|
||||
|
||||
@@ -213,12 +213,13 @@
|
||||
</div>
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<tr><th>品种</th><th>类型</th><th>方向</th><th>成交</th><th>止损(开仓)</th><th>止盈</th><th>基数</th><th>杠杆</th><th>持仓分钟</th><th>开仓时间(北京)</th><th>平仓时间(北京)</th><th>盈亏U</th><th>结果</th><th>操作</th></tr>
|
||||
<tr><th>品种</th><th>类型</th><th>开仓类型</th><th>方向</th><th>成交</th><th>止损(开仓)</th><th>止盈</th><th>基数</th><th>杠杆</th><th>持仓分钟</th><th>开仓时间(北京)</th><th>平仓时间(北京)</th><th>盈亏U</th><th>结果</th><th>操作</th></tr>
|
||||
{% for r in record %}
|
||||
<tr id="trade-row-{{ r.id }}">
|
||||
{% set pnl_val = (r.pnl_amount or 0)|float %}
|
||||
<td>{{ r.symbol }}</td>
|
||||
<td>{{ r.monitor_type }}{% if r.key_signal_type %} · {{ r.key_signal_type }}{% endif %}</td>
|
||||
<td>{{ r.effective_entry_reason or '-' }}</td>
|
||||
<td><span class="badge {{ 'direction-long' if r.direction == 'long' else 'direction-short' }}">{{ '做多' if r.direction == 'long' else '做空' }}</span></td>
|
||||
<td>{{ price_fmt(r.symbol, r.trigger_price) }}</td>
|
||||
{% set stop_show = r.display_open_stop_loss or r.initial_stop_loss or r.stop_loss %}
|
||||
@@ -256,7 +257,8 @@
|
||||
"closed_at": r.effective_closed_at,
|
||||
"pnl_amount": r.effective_pnl_amount,
|
||||
"result": r.effective_result,
|
||||
"risk_amount": r.risk_amount
|
||||
"risk_amount": r.risk_amount,
|
||||
"effective_entry_reason": r.effective_entry_reason or ""
|
||||
}|tojson|safe }})'
|
||||
>填入复盘</button>
|
||||
<button
|
||||
@@ -293,7 +295,7 @@
|
||||
<input type="hidden" name="exit_price_hint" id="exit-price-hint">
|
||||
<input type="hidden" name="direction_hint" id="direction-hint">
|
||||
{% from 'journal_form_fields.html' import journal_form_fields %}
|
||||
{{ journal_form_fields(entry_reason_options, entry_reason_other_value) }}
|
||||
{{ journal_form_fields(entry_reason_options) }}
|
||||
{% from 'journal_upload_slots.html' import journal_upload_slots %}
|
||||
{{ journal_upload_slots() }}
|
||||
<div class="form-row journal-chart-options" style="flex-wrap:wrap;align-items:center">
|
||||
|
||||
Reference in New Issue
Block a user