Move entry scheme to active plans only, required on archive.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6599,6 +6599,12 @@ body.funds-fullscreen-open {
|
||||
color: var(--text);
|
||||
opacity: 0.9;
|
||||
}
|
||||
.plan-scheme-row {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.plan-field-scheme select {
|
||||
min-width: 160px;
|
||||
}
|
||||
.plan-close-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -109,10 +109,6 @@
|
||||
<span>当前区间</span>
|
||||
<input id="plan-create-range" type="text" placeholder="如 67000-68000" />
|
||||
</label>
|
||||
<label class="plan-field plan-field-full">
|
||||
<span>入场方案</span>
|
||||
<select id="plan-create-scheme" required></select>
|
||||
</label>
|
||||
<label class="plan-field plan-field-full">
|
||||
<span>备注</span>
|
||||
<textarea id="plan-create-note" rows="2" placeholder="计划说明…"></textarea>
|
||||
@@ -814,7 +810,7 @@
|
||||
<script src="https://unpkg.com/lightweight-charts@4.2.0/dist/lightweight-charts.standalone.production.js"></script>
|
||||
<script src="/assets/chart_draw.js?v=20260609-market-day-split"></script>
|
||||
<script src="/assets/chart.js?v=20260609-prev-day-lines"></script>
|
||||
<script src="/assets/plan.js?v=20260614-entry-plan"></script>
|
||||
<script src="/assets/plan.js?v=20260614-entry-plan-scheme"></script>
|
||||
<script src="/assets/archive.js?v=20260612-archive-ai-chat"></script>
|
||||
<script src="/assets/funds.js?v=20260609-hub-funds-fold"></script>
|
||||
<script src="/assets/dashboard.js?v=20260612-dash-monitor-count"></script>
|
||||
|
||||
@@ -115,7 +115,6 @@
|
||||
fillSelect($("plan-create-type"), meta.plan_types, "value", "label");
|
||||
fillSelect($("plan-create-trend-tf"), meta.trend_timeframes);
|
||||
fillSelect($("plan-create-entry-tf"), meta.entry_timeframes);
|
||||
fillSelect($("plan-create-scheme"), meta.entry_schemes, "value", "label");
|
||||
renderDirectionRadios($("plan-create-direction"), "plan-direction", "long");
|
||||
const dateEl = $("plan-create-date");
|
||||
if (dateEl && !dateEl.value) dateEl.value = todayIso();
|
||||
@@ -133,6 +132,21 @@
|
||||
);
|
||||
}
|
||||
|
||||
function schemeOptionsHtml(selected) {
|
||||
let html = '<option value="">请选择</option>';
|
||||
(meta.entry_schemes || []).forEach(function (s) {
|
||||
html +=
|
||||
'<option value="' +
|
||||
esc(s.value) +
|
||||
'"' +
|
||||
(selected === s.value ? " selected" : "") +
|
||||
">" +
|
||||
esc(s.label) +
|
||||
"</option>";
|
||||
});
|
||||
return html;
|
||||
}
|
||||
|
||||
function renderActiveList() {
|
||||
const host = $("plan-active-list");
|
||||
const cnt = $("plan-active-count");
|
||||
@@ -166,8 +180,6 @@
|
||||
esc(p.trend_timeframe) +
|
||||
" / 入场 " +
|
||||
esc(p.entry_timeframe) +
|
||||
" · " +
|
||||
esc(p.entry_scheme_label || p.entry_scheme) +
|
||||
"</div>" +
|
||||
'<div class="plan-active-levels">目标 ' +
|
||||
esc(p.target_level || "—") +
|
||||
@@ -175,6 +187,14 @@
|
||||
esc(p.current_range || "—") +
|
||||
"</div>" +
|
||||
(p.note ? '<div class="plan-active-note">' + esc(p.note) + "</div>" : "") +
|
||||
'<div class="plan-scheme-row">' +
|
||||
'<label class="plan-field plan-field-inline plan-field-scheme"><span>入场方案</span>' +
|
||||
'<select class="plan-active-scheme" data-id="' +
|
||||
esc(p.id) +
|
||||
'">' +
|
||||
schemeOptionsHtml(p.entry_scheme || "") +
|
||||
"</select></label>" +
|
||||
"</div>" +
|
||||
'<div class="plan-close-row">' +
|
||||
'<label class="plan-field plan-field-inline"><span>结果</span>' +
|
||||
'<select class="plan-close-result" data-id="' +
|
||||
@@ -341,7 +361,6 @@
|
||||
direction: (dir && dir.value) || "",
|
||||
target_level: ($("plan-create-target") && $("plan-create-target").value) || "",
|
||||
current_range: ($("plan-create-range") && $("plan-create-range").value) || "",
|
||||
entry_scheme: ($("plan-create-scheme") && $("plan-create-scheme").value) || "",
|
||||
note: ($("plan-create-note") && $("plan-create-note").value) || "",
|
||||
};
|
||||
}
|
||||
@@ -555,12 +574,18 @@
|
||||
const card = t.closest(".plan-active-card");
|
||||
const resultEl = card && card.querySelector('.plan-close-result[data-id="' + id + '"]');
|
||||
const pnlEl = card && card.querySelector('.plan-close-pnl[data-id="' + id + '"]');
|
||||
const schemeEl = card && card.querySelector('.plan-active-scheme[data-id="' + id + '"]');
|
||||
const result = resultEl && resultEl.value;
|
||||
if (!result) {
|
||||
toast("请先选择结果(盈/亏)", true);
|
||||
return;
|
||||
}
|
||||
const payload = { result: result };
|
||||
const scheme = schemeEl && schemeEl.value;
|
||||
if (!scheme) {
|
||||
toast("请先选择入场方案(根据实际进场填写)", true);
|
||||
return;
|
||||
}
|
||||
const payload = { result: result, entry_scheme: scheme };
|
||||
const pnlRaw = pnlEl && pnlEl.value;
|
||||
if (pnlRaw !== "" && pnlRaw != null) payload.pnl_amount = Number(pnlRaw);
|
||||
api("/api/entry-plans/" + id, {
|
||||
@@ -577,6 +602,26 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
activeList.addEventListener("change", function (ev) {
|
||||
const t = ev.target;
|
||||
if (!(t instanceof HTMLElement) || !t.classList.contains("plan-active-scheme")) return;
|
||||
const id = t.getAttribute("data-id");
|
||||
const scheme = t.value;
|
||||
if (!id || !scheme) return;
|
||||
api("/api/entry-plans/" + id, {
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ entry_scheme: scheme }),
|
||||
})
|
||||
.then(function () {
|
||||
toast("入场方案已保存");
|
||||
return loadActive();
|
||||
})
|
||||
.catch(function (e) {
|
||||
toast(e.message || "保存失败", true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const historyList = $("plan-history-list");
|
||||
|
||||
Reference in New Issue
Block a user