Commit 1ae46160 authored by 郭阔's avatar 郭阔

ui(schedules): 操作列收成一行小按钮+行下展开编辑抽屉;去掉06:00交付线展示

- 操作列由平铺的频率+6时段编辑器改为 ✎排程/▶采集/⏸停用(⏵启用)/✕ 一行小按钮,
  意图编辑器移到点击后行下方展开的抽屉,表格不再被撑宽
- ▶采集=立即采集一次(/run),⏸/⏵=调度与技能总开关(/toggle)
- 时间轴上的 06:00 交付线竖线与图例说明移除(规划仍按交付线排,仅不再展示)
parent 35feb5c2
...@@ -9,6 +9,12 @@ function toggleRuns(sel) { ...@@ -9,6 +9,12 @@ function toggleRuns(sel) {
sp.style.display = parseInt(sp.dataset.i, 10) <= f ? '' : 'none'; sp.style.display = parseInt(sp.dataset.i, 10) <= f ? '' : 'none';
}); });
} }
function toggleEdit(name) {
var d = document.getElementById('edit-' + name);
var open = d.style.display !== 'none';
document.querySelectorAll('tr.drawer').forEach(function (x) { x.style.display = 'none'; });
if (!open) { d.style.display = ''; }
}
</script> </script>
<style> <style>
.tl { position:relative; height:30px; background:linear-gradient(90deg,#181b24,#1e2230); border:1px solid #2a2d37; border-radius:5px; min-width:300px; } .tl { position:relative; height:30px; background:linear-gradient(90deg,#181b24,#1e2230); border:1px solid #2a2d37; border-radius:5px; min-width:300px; }
...@@ -17,24 +23,24 @@ function toggleRuns(sel) { ...@@ -17,24 +23,24 @@ function toggleRuns(sel) {
.tl .dot.next { background:#e8c34a; box-shadow:0 0 7px #e8c34a; } .tl .dot.next { background:#e8c34a; box-shadow:0 0 7px #e8c34a; }
.tl .dot.dis { background:#5a5f6e; } .tl .dot.dis { background:#5a5f6e; }
.tl .now { position:absolute; top:-2px; bottom:-2px; width:2px; background:#e05555; z-index:2; } .tl .now { position:absolute; top:-2px; bottom:-2px; width:2px; background:#e05555; z-index:2; }
.tl .deadline { position:absolute; top:-3px; bottom:-3px; width:0; border-left:2px dashed #6b9ef1; z-index:2; }
.tl .deadline .dlbl { position:absolute; top:-14px; left:3px; font-size:10px; color:#6b9ef1; white-space:nowrap; }
.tl .lbl { position:absolute; top:-12px; font-size:10px; color:#e8c34a; transform:translateX(-50%); white-space:nowrap; } .tl .lbl { position:absolute; top:-12px; font-size:10px; color:#e8c34a; transform:translateX(-50%); white-space:nowrap; }
.hourbar { display:flex; justify-content:space-between; color:#666; font-size:10px; margin-top:2px; } .hourbar { display:flex; justify-content:space-between; color:#666; font-size:10px; margin-top:2px; }
.time-input { width:110px; background:#1a1d27; border:1px solid #2a2d37; border-radius:4px; color:#d4d4d4; padding:3px 6px; font-family:monospace; }
.next-cell { font-weight:bold; } .next-cell { font-weight:bold; }
.next-cell .in { color:#e8c34a; font-size:12px; } .next-cell .in { color:#e8c34a; font-size:12px; }
.opsbar { display:flex; gap:4px; white-space:nowrap; }
.opsbar form { display:inline; margin:0; }
tr.drawer > td { background:#161923; border-top:1px dashed #2a2d37; padding:12px 16px; }
tr.drawer .hint { color:#888; font-size:12px; margin-bottom:8px; }
</style> </style>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>调度中心</h1> <h1>调度中心</h1>
<p style="color:#666;font-size:13px"> <p style="color:#666;font-size:13px">
<strong style="color:#6b9ef1">┄ 06:00 编辑部交付线</strong>:所有晨间采集在其之前完成(蓝色虚线);
每源一行:24 小时时间轴上标出全部触发时刻(<span style="color:#3f7d52">●</span>), 每源一行:24 小时时间轴上标出全部触发时刻(<span style="color:#3f7d52">●</span>),
<span style="color:#e8c34a">黄色高亮</span>为下次触发,红色竖线为当前时刻,按下次触发排序。 <span style="color:#e8c34a">黄色高亮</span>为下次触发,红色竖线为当前时刻,按下次触发排序。
每日汇总 digest:{{ digest_times|join(', ') if digest_times else '未排' }}{% if digest_next %},下次 {{ digest_next.strftime('%m-%d %H:%M') }}{% endif %}。 每日汇总 digest:{{ digest_times|join(', ') if digest_times else '未排' }}{% if digest_next %},下次 {{ digest_next.strftime('%m-%d %H:%M') }}{% endif %}。
时间格式 HH:MM,多个用逗号分隔(如 05:00,17:00 = 每日两次);删除仅移除调度,技能源与历史保留。 「✎ 排程」按频率+时段意图维护,保存后自动重排全部时间。
</p> </p>
<form method="POST" action="{{ url_for('schedule_gap') }}" style="margin:6px 0 4px;display:inline"> <form method="POST" action="{{ url_for('schedule_gap') }}" style="margin:6px 0 4px;display:inline">
全局最小间隔: 全局最小间隔:
...@@ -73,7 +79,6 @@ function toggleRuns(sel) { ...@@ -73,7 +79,6 @@ function toggleRuns(sel) {
{% if r.times %} {% if r.times %}
<div class="tl"> <div class="tl">
<div class="h" style="left:25%"></div><div class="h" style="left:50%"></div><div class="h" style="left:75%"></div> <div class="h" style="left:25%"></div><div class="h" style="left:50%"></div><div class="h" style="left:75%"></div>
<div class="deadline" style="left:25%"><span class="dlbl">06:00 交付线</span></div>
{% for t in r.times %} {% for t in r.times %}
{% set h = t.split(':')[0]|int %}{% set m = t.split(':')[1]|int %} {% set h = t.split(':')[0]|int %}{% set m = t.split(':')[1]|int %}
{% set pct = ((h*60+m)/1440*100)|round(2) %} {% set pct = ((h*60+m)/1440*100)|round(2) %}
...@@ -101,7 +106,38 @@ function toggleRuns(sel) { ...@@ -101,7 +106,38 @@ function toggleRuns(sel) {
{% else %}<span style="color:#666">从未</span>{% endif %} {% else %}<span style="color:#666">从未</span>{% endif %}
</td> </td>
<td> <td>
<form method="POST" action="{{ url_for('schedule_intent') }}" style="display:inline;white-space:nowrap"> <div class="opsbar">
<button type="button" class="btn btn-sm" onclick="toggleEdit('{{ r.name }}')">✎ 排程</button>
{% if r.enabled %}
<form method="POST" action="/run/{{ r.name }}"
onsubmit="return confirm('立即采集 {{ r.name }} 一次?')">
<button type="submit" class="btn btn-sm" title="立即采集一次">▶ 采集</button>
</form>
{% endif %}
{% if r.state != 'none' %}
{% if r.state == 'active' %}
<form method="POST" action="/toggle/{{ r.name }}" onsubmit="return confirm('停用 {{ r.name }}?(调度与技能一并停用,可随时再开启)')">
<input type="hidden" name="on" value="0">
<button type="submit" class="btn btn-sm" title="停用调度与技能">⏸ 停用</button>
</form>
{% else %}
<form method="POST" action="/toggle/{{ r.name }}">
<input type="hidden" name="on" value="1">
<button type="submit" class="btn btn-sm" title="启用调度与技能">⏵ 启用</button>
</form>
{% endif %}
<form method="POST" action="/schedule-delete/{{ r.name }}"
onsubmit="return confirm('移除 {{ r.name }} 的调度?(技能源与运行历史保留,可随时重建)')">
<button type="submit" class="btn btn-sm btn-danger" title="移除调度">✕</button>
</form>
{% endif %}
</div>
</td>
</tr>
<tr id="edit-{{ r.name }}" class="drawer" style="display:none">
<td colspan="6">
<div class="hint">排程意图:选频率和各次时段,保存后自动按交付线/全局间隔重排全部源的时间。</div>
<form method="POST" action="{{ url_for('schedule_intent') }}" style="white-space:nowrap">
<input type="hidden" name="name" value="{{ r.name }}"> <input type="hidden" name="name" value="{{ r.name }}">
<select name="freq" class="intsel" onchange="toggleRuns(this)" <select name="freq" class="intsel" onchange="toggleRuns(this)"
style="background:#1a1d27;border:1px solid #2a2d37;border-radius:4px;color:#d4d4d4;padding:3px 6px"> style="background:#1a1d27;border:1px solid #2a2d37;border-radius:4px;color:#d4d4d4;padding:3px 6px">
...@@ -110,7 +146,7 @@ function toggleRuns(sel) { ...@@ -110,7 +146,7 @@ function toggleRuns(sel) {
{% endfor %} {% endfor %}
</select> </select>
{% for i in range(1,7) %} {% for i in range(1,7) %}
<span class="runwin" data-i="{{ i }}" style="{% if i > r.intent.freq %}display:none;{% endif %}margin-left:4px"> <span class="runwin" data-i="{{ i }}" style="{% if i > r.intent.freq %}display:none;{% endif %}margin-left:8px">
第{{ i }}次 第{{ i }}次
<select name="window_{{ i }}" style="background:#1a1d27;border:1px solid #2a2d37;border-radius:4px;color:#d4d4d4;padding:3px 4px"> <select name="window_{{ i }}" style="background:#1a1d27;border:1px solid #2a2d37;border-radius:4px;color:#d4d4d4;padding:3px 4px">
{% for v, lbl in [('overnight','凌晨批次'),('morning','上午'),('afternoon','下午'),('evening','晚间')] %} {% for v, lbl in [('overnight','凌晨批次'),('morning','上午'),('afternoon','下午'),('evening','晚间')] %}
...@@ -119,14 +155,8 @@ function toggleRuns(sel) { ...@@ -119,14 +155,8 @@ function toggleRuns(sel) {
</select> </select>
</span> </span>
{% endfor %} {% endfor %}
<button type="submit" class="btn btn-sm">保存</button> <button type="submit" class="btn btn-primary" style="margin-left:10px">保存并重排</button>
</form> </form>
{% if r.state != 'none' %}
<form method="POST" action="{{ url_for('schedule_delete', name=r.name) }}" style="display:inline"
onsubmit="return confirm('移除 {{ r.name }} 的调度?(技能源与运行历史保留,可随时重建)')">
<button type="submit" class="btn btn-sm btn-danger">删除</button>
</form>
{% endif %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment