持仓监控独立导航页,交易记录与复盘合并为同一页
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+119
-2
@@ -1,8 +1,114 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}复盘 - 国内期货监控系统{% endblock %}
|
||||
{% block title %}交易记录与复盘 - 国内期货监控系统{% endblock %}
|
||||
{% block content %}
|
||||
<div class="card" style="margin-bottom:1.25rem">
|
||||
<h2>交易记录</h2>
|
||||
<div class="card-body">
|
||||
<label class="trade-switch-label">
|
||||
<input type="checkbox" id="trade-edit-switch">
|
||||
<span>修改/核对开关(开启后可编辑关键字段)</span>
|
||||
</label>
|
||||
<div class="trade-table-wrap card-scroll">
|
||||
<table class="trade-table">
|
||||
<thead>
|
||||
<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>结果</th><th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for t in trades %}
|
||||
<tr data-trade-id="{{ t.id }}">
|
||||
<td><span class="cell-readonly">{{ t.symbol_name or t.symbol }}</span></td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide">{{ t.monitor_type }}</span>
|
||||
<input class="cell-edit-show" type="hidden" name="monitor_type" value="{{ t.monitor_type }}">
|
||||
</td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide">
|
||||
<span class="badge dir">{{ '做多' if t.direction == 'long' else '做空' }}</span>
|
||||
</span>
|
||||
<select class="cell-edit-show" name="direction" style="display:none">
|
||||
<option value="long" {% if t.direction=='long' %}selected{% endif %}>做多</option>
|
||||
<option value="short" {% if t.direction=='short' %}selected{% endif %}>做空</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide">{{ t.entry_price }}</span>
|
||||
<input class="cell-edit-show" type="number" step="0.0001" name="entry_price" value="{{ t.entry_price }}" style="display:none">
|
||||
</td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide">{{ t.stop_loss }}</span>
|
||||
<input class="cell-edit-show" type="number" step="0.0001" name="stop_loss" value="{{ t.stop_loss }}" style="display:none">
|
||||
</td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide">{{ t.take_profit }}</span>
|
||||
<input class="cell-edit-show" type="number" step="0.0001" name="take_profit" value="{{ t.take_profit }}" style="display:none">
|
||||
</td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide">{{ t.lots }}手 / {{ t.margin or '-' }}</span>
|
||||
<input class="cell-edit-show" type="number" step="0.01" name="margin" value="{{ t.margin or '' }}" placeholder="保证金" style="display:none">
|
||||
<input type="hidden" name="lots" value="{{ t.lots }}">
|
||||
</td>
|
||||
<td><span class="cell-readonly">—</span></td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide">{{ t.holding_minutes or 0 }}</span>
|
||||
<input class="cell-edit-show" type="number" name="holding_minutes" value="{{ t.holding_minutes or 0 }}" style="display:none">
|
||||
</td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide">{{ (t.open_time or '')[:16].replace('T',' ') }}</span>
|
||||
<input class="cell-edit-show" type="text" name="open_time" value="{{ t.open_time or '' }}" style="display:none">
|
||||
</td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide">{{ (t.close_time or '')[:16].replace('T',' ') }}</span>
|
||||
<input class="cell-edit-show" type="text" name="close_time" value="{{ t.close_time or '' }}" style="display:none">
|
||||
</td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide {% if t.pnl and t.pnl > 0 %}text-profit{% elif t.pnl and t.pnl < 0 %}text-loss{% endif %}">
|
||||
{{ t.pnl if t.pnl is not none else '-' }}
|
||||
</span>
|
||||
<input class="cell-edit-show" type="number" step="0.01" name="pnl" value="{{ t.pnl or '' }}" style="display:none">
|
||||
<input type="hidden" name="close_price" value="{{ t.close_price or '' }}">
|
||||
<input type="hidden" name="symbol_name" value="{{ t.symbol_name or t.symbol }}">
|
||||
</td>
|
||||
<td>
|
||||
<span class="cell-readonly cell-edit-hide">
|
||||
{% if t.result == '止盈' %}<span class="badge profit">{{ t.result }}</span>
|
||||
{% elif t.result == '止损' %}<span class="badge loss">{{ t.result }}</span>
|
||||
{% elif t.result == '手动平仓' %}<span class="badge result-manual">{{ t.result }}</span>
|
||||
{% else %}<span class="badge result-external">{{ t.result }}</span>{% endif %}
|
||||
{% if t.verified %}<span class="badge active" style="margin-left:.25rem">已核对</span>{% endif %}
|
||||
</span>
|
||||
<select class="cell-edit-show" name="result" style="display:none">
|
||||
<option value="手动平仓" {% if t.result=='手动平仓' %}selected{% endif %}>手动平仓</option>
|
||||
<option value="止盈" {% if t.result=='止盈' %}selected{% endif %}>止盈</option>
|
||||
<option value="止损" {% if t.result=='止损' %}selected{% endif %}>止损</option>
|
||||
<option value="外部平仓" {% if t.result=='外部平仓' %}selected{% endif %}>外部平仓</option>
|
||||
<option value="时间平仓" {% if t.result=='时间平仓' %}selected{% endif %}>时间平仓</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<div class="trade-actions">
|
||||
<a href="{{ url_for('fill_review_from_trade', tid=t.id) }}" class="btn-fill">填入复盘</a>
|
||||
<button type="button" class="btn-verify trade-save-btn" disabled>核对修改</button>
|
||||
<a href="{{ url_for('del_trade', tid=t.id) }}" class="btn-del" onclick="return confirm('删除?')">删除</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="14" class="text-muted">暂无交易记录</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="split-grid records-split">
|
||||
<div class="card">
|
||||
<div class="card" id="review-panel">
|
||||
<h2>复盘上传</h2>
|
||||
<div class="card-body">
|
||||
<form id="review-form" action="{{ url_for('add_review') }}" method="post" enctype="multipart/form-data" class="form-compact form-compact-review line-tight">
|
||||
@@ -178,10 +284,12 @@
|
||||
{% endblock %}
|
||||
{% block extra_js %}
|
||||
<script src="{{ url_for('static', filename='js/review.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/trades.js') }}"></script>
|
||||
{% if prefill %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var form = document.getElementById('review-form');
|
||||
var panel = document.getElementById('review-panel');
|
||||
if (!form) return;
|
||||
var map = {{ prefill | tojson }};
|
||||
Object.keys(map).forEach(function (k) {
|
||||
@@ -191,7 +299,16 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
var symInput = form.querySelector('.symbol-input');
|
||||
if (symInput && map.symbol_name) symInput.value = map.symbol_name;
|
||||
if (typeof recalc === 'function') recalc();
|
||||
if (panel) panel.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
if (window.location.hash === '#review-panel') {
|
||||
var panel = document.getElementById('review-panel');
|
||||
if (panel) panel.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user