From 11bf71e93736a4f88602cc9909ebe7a282791ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=A9=AC1988?= <1010895047@qq.com> Date: Sat, 27 Aug 2022 11:00:08 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A1=A8=E8=BE=BE?= =?UTF-8?q?=E5=BC=8F=E9=94=99=E8=AF=AFBUG=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=90=8E=E4=B8=80=E9=A1=B9=E4=B8=8D=E4=B8=BA*=20=E9=82=A3?= =?UTF-8?q?=E4=B9=88=E5=89=8D=E4=B8=80=E9=A1=B9=E8=82=AF=E5=AE=9A=E4=B8=8D?= =?UTF-8?q?=E4=B8=BA*=EF=BC=8C=E8=A6=81=E4=B8=8D=E7=84=B6=E5=B0=B1?= =?UTF-8?q?=E6=88=90=E4=BA=86=E6=AF=8F=E7=A7=92=E6=89=A7=E8=A1=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 小马1988 <1010895047@qq.com> --- .../src/main/resources/static/js/cron.js | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/static/js/cron.js b/ruoyi-admin/src/main/resources/static/js/cron.js index 26de770e1..269e9600b 100644 --- a/ruoyi-admin/src/main/resources/static/js/cron.js +++ b/ruoyi-admin/src/main/resources/static/js/cron.js @@ -922,5 +922,37 @@ function gen_cron() { + $("#v_month").val() + " " + $("#v_week").val() + " " + $("#v_year").val(); - $("#cron").val(str); + var vals = $("input[name^='v_']"); + var cron = $("#cron"); + var item = []; + vals.each(function() { + item.push(this.value); + }); + // 修复表达式错误BUG,如果后一项不为* 那么前一项肯定不为*,要不然就成了每秒执行了 + // 获取当前选中tab + var currentIndex = 0; + $(".nav-tabs>li").each(function(i, item) { + if ($(item).hasClass("active")) { + currentIndex = i; + return false; + } + + }); + // 当前选中项之前的如果为*,则都设置成0 + for (var i = currentIndex; i >= 1; i--) { + if (item[i] != "*" && item[i - 1] == "*") { + item[i - 1] = "0"; + } + } + // 当前选中项之后的如果不为*则都设置成* + if (item[currentIndex] == "*") { + for (var i = currentIndex + 1; i < item.length; i++) { + if (i == 5) { + item[i] = "?"; + } else { + item[i] = "*"; + } + } + } + cron.val(item.join(" ")).change(); } \ No newline at end of file From d04711c89293b6401444c29b274697c40d92f76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=A9=AC1988?= <1010895047@qq.com> Date: Sat, 27 Aug 2022 11:03:28 +0000 Subject: [PATCH 2/2] update ruoyi-quartz/src/main/resources/templates/monitor/job/cron.html. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 小马1988 <1010895047@qq.com> --- .../main/resources/templates/monitor/job/cron.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ruoyi-quartz/src/main/resources/templates/monitor/job/cron.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/cron.html index 290ea75c0..5fc950e51 100644 --- a/ruoyi-quartz/src/main/resources/templates/monitor/job/cron.html +++ b/ruoyi-quartz/src/main/resources/templates/monitor/job/cron.html @@ -1105,13 +1105,13 @@ 表达式字段 - - - - - - - + + + + + + + Cron 表达式