Add lean review issues: up to two problem tags plus short note.

Persist review_issues, enforce max two on save, and show issue breakdown in stats.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-21 20:56:32 +08:00
parent 1bf353c505
commit 01ed885646
6 changed files with 165 additions and 10 deletions
+32 -5
View File
@@ -28,8 +28,8 @@
</table>
</div>
<div class="card">
<h3>入场形式标注</h3>
<form method="post" action="{{ url_for('record_annotate', tid=trade.id) }}">
<h3>复盘标注</h3>
<form method="post" action="{{ url_for('record_annotate', tid=trade.id) }}" id="annotate-form">
<div class="form-row">
<label>入场形式</label>
<select name="entry_style">
@@ -55,11 +55,23 @@
</optgroup>
{% endif %}
</select>
<p class="muted" style="margin:8px 0 0">顺势/反转均含:窄幅区间突破、宽幅区间假突破、波段高低点假突破;对不上的选「乱作」。</p>
<p class="muted" style="margin:8px 0 0">管「按什么形进的」;对不上选乱作。</p>
</div>
<div class="form-row">
<label>复盘备注</label>
<textarea name="review_note" rows="5" placeholder="位不对 / 形不对 / 出场违纪 …">{{ trade.review_note or '' }}</textarea>
<label>主要问题 <span class="muted">(最多 {{ review_issues_max }} 个,做对可不勾)</span></label>
<div class="issue-checks" id="issue-checks" data-max="{{ review_issues_max }}">
{% for iss in review_issues %}
<label class="issue-chip">
<input type="checkbox" name="review_issues" value="{{ iss }}"
{% if iss in trade.review_issues_list %}checked{% endif %}>
<span>{{ iss }}</span>
</label>
{% endfor %}
</div>
</div>
<div class="form-row">
<label>短备注</label>
<textarea name="review_note" rows="3" placeholder="补一句细节即可,如「假突破没等回踩」">{{ trade.review_note or '' }}</textarea>
</div>
<button class="btn" type="submit">保存标注</button>
</form>
@@ -103,4 +115,19 @@
{% block scripts %}
<script src="{{ url_for('static', filename='js/charts.js') }}"></script>
<script>
(function () {
var box = document.getElementById("issue-checks");
if (!box) return;
var maxN = parseInt(box.dataset.max || "2", 10) || 2;
box.addEventListener("change", function (e) {
var t = e.target;
if (!t || t.type !== "checkbox") return;
var checked = box.querySelectorAll('input[type="checkbox"]:checked');
if (checked.length <= maxN) return;
t.checked = false;
alert("主要问题最多选 " + maxN + " 个");
});
})();
</script>
{% endblock %}