mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-30 12:45:32 +08:00
feat(timer): 编辑页并发数配置表单
edit 表单放行 concurrency 字段,空值=继承代码默认写 NULL,正整数=覆盖。前端联动提示语义。 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -27,6 +27,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">并发数</label>
|
||||
<div class="layui-input-block" style="padding-top:8px;">
|
||||
<div class="layui-inline" style="margin-right:15px;">
|
||||
<input type="radio" name="concurrency_type" lay-filter="concurrency_type" value="default" title="默认(继承代码)" {if condition="$row.concurrency eq null"}checked{/if}>
|
||||
<input type="radio" name="concurrency_type" lay-filter="concurrency_type" value="custom" title="自定义" {if condition="$row.concurrency neq null"}checked{/if}>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="number" name="concurrency" value="{$row.concurrency}" min="1" step="1" placeholder="正整数" class="layui-input" style="display:inline-block;width:120px;" lay-affix="concurrency_type">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">
|
||||
<span class="layui-badge layui-bg-gray">默认=继承代码</span>
|
||||
空值=继承;正整数=覆盖;0或负数=拒绝(防静默吞任务)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">同步状态</label>
|
||||
<div class="layui-input-block" style="padding-top: 8px;">
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
$(function(){
|
||||
ua.listen();
|
||||
})
|
||||
var form = layui.form;
|
||||
|
||||
// ============ 并发数:默认/自定义切换联动 ============
|
||||
// 默认 → number input 禁用 + 提交时清空(写 NULL 继承)
|
||||
// 自定义 → number input 启用,必须正整数
|
||||
function syncConcurrencyInput() {
|
||||
var type = $('input[name="concurrency_type"]:checked').val();
|
||||
var $input = $('input[name="concurrency"]');
|
||||
if (type === 'default') {
|
||||
$input.prop('disabled', true).val('');
|
||||
} else {
|
||||
$input.prop('disabled', false);
|
||||
}
|
||||
form.render();
|
||||
}
|
||||
|
||||
form.on('radio(concurrency_type)', function () {
|
||||
syncConcurrencyInput();
|
||||
});
|
||||
|
||||
// 初始化(根据模板 checked 状态同步)
|
||||
syncConcurrencyInput();
|
||||
|
||||
// ============ 提交前归一化 ============
|
||||
// 默认 → concurrency=''(后端 normalizeConcurrency 写 NULL)
|
||||
// 自定义 → 保留输入值(后端校验正整数,0/负数/非数字被拒)
|
||||
ua.listen(function (dataField) {
|
||||
if (dataField.concurrency_type === 'default') {
|
||||
dataField.concurrency = '';
|
||||
}
|
||||
// 移除辅助字段,避免传给后端
|
||||
delete dataField.concurrency_type;
|
||||
return dataField;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user