From 12fe271ce0d1252db3fb95f734647afed7180473 Mon Sep 17 00:00:00 2001 From: augushong Date: Sat, 25 Jul 2026 21:58:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(timer):=20=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E6=95=B0=E9=85=8D=E7=BD=AE=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit edit 表单放行 concurrency 字段,空值=继承代码默认写 NULL,正整数=覆盖。前端联动提示语义。 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- app/admin/view/system/timer_config/edit.html | 17 +++++++++ app/admin/view/system/timer_config/edit.js | 37 ++++++++++++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/app/admin/view/system/timer_config/edit.html b/app/admin/view/system/timer_config/edit.html index 43e4852..50110f3 100644 --- a/app/admin/view/system/timer_config/edit.html +++ b/app/admin/view/system/timer_config/edit.html @@ -27,6 +27,23 @@ +
+ +
+
+ + +
+
+ +
+
+ 默认=继承代码 + 空值=继承;正整数=覆盖;0或负数=拒绝(防静默吞任务) +
+
+
+
diff --git a/app/admin/view/system/timer_config/edit.js b/app/admin/view/system/timer_config/edit.js index 4a445e0..9d3bfb3 100644 --- a/app/admin/view/system/timer_config/edit.js +++ b/app/admin/view/system/timer_config/edit.js @@ -1,3 +1,36 @@ $(function(){ - ua.listen(); -}) \ No newline at end of file + 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; + }); +});