mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-09-04 15:11:37 +08:00
refactor(timer): TimerConfig 控制器与视图迁移到 Base 层
控制器逻辑移入 extend/base/admin/controller/system/TimerConfigBase.php,app 层改为空壳继承。9 个视图文件迁移到 extend/base/admin/view/system/timer_config/。index.js 补 toolbar: ['refresh', 'export'] 声明(C 类页面,去掉默认的 add/delete)。 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
36
extend/base/admin/view/system/timer_config/edit.js
Normal file
36
extend/base/admin/view/system/timer_config/edit.js
Normal file
@@ -0,0 +1,36 @@
|
||||
$(function(){
|
||||
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