合约管理简化为选品种+填月份,系统自动拼接合约代码
This commit is contained in:
@@ -139,20 +139,16 @@
|
||||
<form method="post" action="/admin/contract" style="display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;">
|
||||
<div class="form-group" style="margin-bottom:0;flex:1;min-width:140px;">
|
||||
<label>品种</label>
|
||||
<select name="product_id" id="contract-product" required onchange="onProductChange()">
|
||||
<select name="product_id" required>
|
||||
<option value="">-- 选择品种 --</option>
|
||||
{% for p in products %}
|
||||
<option value="{{ p.id }}" data-code="{{ p.code }}">{{ p.code }} · {{ p.name }}</option>
|
||||
<option value="{{ p.id }}">{{ p.code }} · {{ p.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom:0;flex:1;min-width:140px;">
|
||||
<label>合约代码 <span style="font-weight:400;color:var(--sub);font-size:0.75rem;">品种代码加月份</span></label>
|
||||
<input type="text" name="code" id="contract-code" required placeholder="先选品种" maxlength="10" style="text-transform:uppercase;">
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom:0;flex:1;min-width:100px;">
|
||||
<label>月份 <span style="font-weight:400;color:var(--sub);font-size:0.75rem;">如 2609</span></label>
|
||||
<input type="text" name="name" required placeholder="2609" maxlength="4" style="text-transform:uppercase;">
|
||||
<input type="text" name="month" required placeholder="2609" maxlength="4" style="text-transform:uppercase;">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">添加</button>
|
||||
</form>
|
||||
@@ -216,16 +212,5 @@ function toggleProduct(header) {
|
||||
}
|
||||
}
|
||||
|
||||
function onProductChange() {
|
||||
var sel = document.getElementById('contract-product');
|
||||
var opt = sel.options[sel.selectedIndex];
|
||||
var code = opt.dataset.code || '';
|
||||
var input = document.getElementById('contract-code');
|
||||
if (code) {
|
||||
input.placeholder = code + '2609';
|
||||
} else {
|
||||
input.placeholder = '先选品种';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user