| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- {% extends 'base.html' %}
- {% block title %}{{ '改' if editing else '新增' }}{{ meta.cn }}{% endblock %}
- {% block body %}
- <div class="page-head">
- <div>
- <h1>{{ '编辑' if editing else '新增' }}{{ meta.cn }}</h1>
- <div class="sub">主键 {{ meta.pk|join(' + ') }} · {{ meta.cols|length }} 个字段 · 保存后采集进程 5 秒内热重载点表</div>
- </div>
- <div class="acts">
- <a href="/db/{{ table }}"><button type="button" class="gray">返回列表</button></a>
- {% if editing and row.get('wind_id') %}
- <a href="/db/signal?farm_id={{ row.get('farm_id', '') }}&wind_id={{ row.get('wind_id', '') }}"><button type="button" class="gray">该机组的测点</button></a>
- {% endif %}
- </div>
- </div>
- {% if err %}<div class="err">{{ err }}</div>{% endif %}
- {% if ok %}<div class="flash">{{ ok }}</div>{% endif %}
- <form method="post" action="{{ action }}">
- <div class="card">
- <div class="grid">
- {% for col, cn, req in meta.cols %}
- {% set chosen = row.get(col) or '' %}
- {% set is_pk = col in meta.pk %}
- <div class="field">
- <label for="f_{{ col }}">{{ cn }}{% if req or is_pk %} *{% endif %}</label>
- {% if col == 'farm_id' and table != 'farm' and opts.get('farm_id') %}
- <select id="f_{{ col }}" name="{{ col }}"
- {%- if editing and is_pk %} disabled{%- endif %}>
- <option value="">(选风场)</option>
- {% for o in opts['farm_id'] %}
- <option value="{{ o.v }}" {{ 'selected' if chosen == o.v }} title="{{ o.v }}">{{ o.l }}</option>
- {% endfor %}
- {% if chosen and chosen not in farm_map %}
- <option value="{{ chosen }}" selected>{{ chosen }}(风场台账里没有这个编号)</option>
- {% endif %}
- </select>
- <span class="hint">{{ '主键,改风场等于换记录,请删掉重建' if editing and is_pk else '从风场台账里选' }}</span>
- {% elif is_pk %}
- <input id="f_{{ col }}" name="{{ col }}" class="mono" value="{{ chosen }}"
- {% if editing %}readonly{% endif %}>
- <span class="hint">主键{% if editing %},保存时以链接里的原值为准{% endif %}</span>
- {% elif col == 'enabled' %}
- <select id="f_{{ col }}" name="{{ col }}">
- <option value="true" {{ 'selected' if row.get(col) is not false }}>启用(采集进程监听这个端口)</option>
- <option value="false" {{ 'selected' if row.get(col) is false }}>停用(采集进程不监听,重启后生效)</option>
- </select>
- <span class="hint">停用只改台账,采集进程要重启才不监听这个端口</span>
- {% else %}
- <input id="f_{{ col }}" name="{{ col }}"
- class="{{ 'mono' if col in ('port', 'common_addr', 'obj_addr', 'signal_id', 'algo_signal', 'signal_name', 'wind_id', 'engine_code', 'mill_type_code') else '' }}"
- value="{{ chosen }}">
- <span class="hint"> </span>
- {% endif %}
- </div>
- {% endfor %}
- </div>
- <div class="frow" style="margin-top:16px">
- <button type="submit">保存</button>
- <a href="/db/{{ table }}" class="hint">取消,返回列表</a>
- </div>
- </div>
- </form>
- {% if editing and pk_qs %}
- <form method="post" action="/db/{{ table }}/delete?{{ pk_qs }}"
- onsubmit="return confirm('确定删除这条{{ meta.cn }}?删掉后采集到的对应数据会被算作「点表未收录」。')">
- <button type="submit" class="red">删除这条{{ meta.cn }}</button>
- </form>
- {% endif %}
- {% endblock %}
|