mirror of https://gitee.com/y_project/RuoYi.git
定时任务支持在线生成cron表达式
parent
e39f8f9127
commit
4ec04eda71
|
@ -0,0 +1,149 @@
|
|||
@font-face {
|
||||
font-family:ZenIcon;src:url(../fonts/zenicon.woff?v=2.2.0) format('woff')
|
||||
}
|
||||
|
||||
.checkbox-primary,.radio-primary {
|
||||
position: relative;
|
||||
display: block
|
||||
}
|
||||
|
||||
.checkbox-primary>input,.radio-primary>input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 3;
|
||||
width: 100%;
|
||||
width: 20px;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
.checkbox-primary>label,.radio-primary>label {
|
||||
padding-left: 25px;
|
||||
font-weight: 400;
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.checkbox-primary>label:after,.checkbox-primary>label:before,.radio-primary>label:after,.radio-primary>label:before {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 0;
|
||||
left: 0;
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
text-align: center;
|
||||
content: ' ';
|
||||
border-radius: 2px
|
||||
}
|
||||
|
||||
.checkbox-primary>label:after,.radio-primary>label:after {
|
||||
z-index: 1;
|
||||
border: 1px solid gray;
|
||||
-webkit-transition: .4s cubic-bezier(.175,.885,.32,1);
|
||||
-o-transition: .4s cubic-bezier(.175,.885,.32,1);
|
||||
transition: .4s cubic-bezier(.175,.885,.32,1);
|
||||
-webkit-transition-property: border,background-color;
|
||||
-o-transition-property: border,background-color;
|
||||
transition-property: border,background-color
|
||||
}
|
||||
|
||||
.checkbox-primary>label:before,.radio-primary>label:before {
|
||||
top: 3px;
|
||||
z-index: 2;
|
||||
font-family: ZenIcon;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-variant: normal;
|
||||
line-height: 1;
|
||||
text-transform: none;
|
||||
content: '\e60d';
|
||||
opacity: 0;
|
||||
-webkit-transition: .2s cubic-bezier(.175,.885,.32,1);
|
||||
-o-transition: .2s cubic-bezier(.175,.885,.32,1);
|
||||
transition: .2s cubic-bezier(.175,.885,.32,1);
|
||||
-webkit-transition-property: opacity,-webkit-transform;
|
||||
-o-transition-property: opacity,-o-transform;
|
||||
transition-property: opacity,-webkit-transform;
|
||||
transition-property: opacity,transform;
|
||||
transition-property: opacity,transform,-webkit-transform,-o-transform;
|
||||
-webkit-transform: scale(0);
|
||||
-ms-transform: scale(0);
|
||||
-o-transform: scale(0);
|
||||
transform: scale(0);
|
||||
speak: none;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale
|
||||
}
|
||||
|
||||
.checkbox-primary.checked>label:after,.checkbox-primary>input:checked+label:after,.radio-primary.checked>label:after,.radio-primary>input:checked+label:after {
|
||||
background-color: #3280fc;
|
||||
border-color: #3280fc;
|
||||
border-width: 4px
|
||||
}
|
||||
|
||||
.checkbox-primary.checked>label:before,.checkbox-primary>input:checked+label:before,.radio-primary.checked>label:before,.radio-primary>input:checked+label:before {
|
||||
color: #fff;
|
||||
opacity: 1;
|
||||
-webkit-transform: scale(1);
|
||||
-ms-transform: scale(1);
|
||||
-o-transform: scale(1);
|
||||
transform: scale(1)
|
||||
}
|
||||
|
||||
.checkbox-primary.focus>label:after,.checkbox-primary>input:focus+label:after,.radio-primary.focus>label:after,.radio-primary>input:focus+label:after {
|
||||
border-color: #3280fc;
|
||||
-webkit-box-shadow: 0 0 8px #3280fc;
|
||||
box-shadow: 0 0 8px #3280fc
|
||||
}
|
||||
|
||||
.checkbox-primary input:disabled+label:after,.checkbox-primary.disabled>label:after,.radio-primary input:disabled+label:after,.radio-primary.disabled>label:after {
|
||||
background-color: #e5e5e5;
|
||||
border-color: #bbb
|
||||
}
|
||||
|
||||
.checkbox-primary input:disabled:checked+label:after,.checkbox-primary.checked.disabled>label:after,.radio-primary input:disabled:checked+label:after,.radio-primary.checked.disabled>label:after {
|
||||
background-color: #bbb
|
||||
}
|
||||
|
||||
.radio-primary>label:after {
|
||||
border-radius: 50%
|
||||
}
|
||||
|
||||
.radio-primary>label:before {
|
||||
top: 7px;
|
||||
left: 5px;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
content: ' ';
|
||||
border: 0;
|
||||
border-radius: 50%
|
||||
}
|
||||
|
||||
.radio-primary.checked>label:after,.radio-primary>input:checked+label:after {
|
||||
background-color: transparent;
|
||||
border-color: #3280fc;
|
||||
border-width: 2px
|
||||
}
|
||||
|
||||
.radio-primary.checked>label:before,.radio-primary>input:checked+label:before {
|
||||
background-color: #3280fc
|
||||
}
|
||||
|
||||
.radio-primary input:disabled:checked+label:after,.radio-primary.checked.disabled>label:after {
|
||||
background-color: transparent;
|
||||
border-color: #bbb
|
||||
}
|
||||
|
||||
.radio-primary input:disabled:checked+label:before,.radio-primary.checked.disabled>label:before {
|
||||
background-color: #bbb
|
||||
}
|
||||
|
||||
.tab-cron .tab-pane .tabsecondchk .checkbox-primary,.tab-qqskey .tab-pane .tabsecondchk .checkbox-primary {
|
||||
width: 50px;
|
||||
display: inline-block;
|
||||
margin-bottom: 10px
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,926 @@
|
|||
$().ready(function () {
|
||||
$("#unrunBtn").click(function () {
|
||||
var str = $("#cron").val();
|
||||
var str_arr = str.split(" ");
|
||||
try {
|
||||
$("#v_second").val(str_arr[0])
|
||||
$("#v_min").val(str_arr[1])
|
||||
$("#v_hour").val(str_arr[2])
|
||||
$("#v_day").val(str_arr[3])
|
||||
$("#v_month").val(str_arr[4])
|
||||
$("#v_week").val(str_arr[5])
|
||||
$("#v_year").val(str_arr[6])
|
||||
} catch (e) {
|
||||
}
|
||||
});
|
||||
//second
|
||||
$("#sec_all").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_second").val("*");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#sec_circle").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_sec_circle();
|
||||
}
|
||||
});
|
||||
$("#sec_circle1").change(function () {
|
||||
if ($("#sec_circle").prop('checked')) {
|
||||
change_sec_circle();
|
||||
}
|
||||
});
|
||||
$("#sec_circle2").change(function () {
|
||||
if ($("#sec_circle").prop('checked')) {
|
||||
change_sec_circle();
|
||||
}
|
||||
});
|
||||
$("#sec_per").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_sec_per();
|
||||
}
|
||||
});
|
||||
$("#sec_per1").change(function () {
|
||||
if ($("#sec_per").prop('checked')) {
|
||||
change_sec_per();
|
||||
}
|
||||
});
|
||||
$("#sec_per2").change(function () {
|
||||
if ($("#sec_per").prop('checked')) {
|
||||
change_sec_per();
|
||||
}
|
||||
});
|
||||
$("#sec_assign").click(function () {
|
||||
if ($("#sec_assign").prop('checked')) {
|
||||
change_sec_assign();
|
||||
}
|
||||
});
|
||||
$("input[name='zd_second']").click(function () {
|
||||
if ($("#sec_assign").prop('checked')) {
|
||||
change_sec_assign();
|
||||
}
|
||||
});
|
||||
|
||||
//minute
|
||||
$("#min_all").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_min").val("*");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#min_circle").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_min_circle();
|
||||
}
|
||||
});
|
||||
$("#min_circle1").change(function () {
|
||||
if ($("#min_circle").prop('checked')) {
|
||||
change_min_circle();
|
||||
}
|
||||
});
|
||||
$("#min_circle2").change(function () {
|
||||
if ($("#min_circle").prop('checked')) {
|
||||
change_min_circle();
|
||||
}
|
||||
});
|
||||
$("#min_per").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_min_per();
|
||||
}
|
||||
});
|
||||
$("#min_per1").change(function () {
|
||||
if ($("#min_per").prop('checked')) {
|
||||
change_min_per();
|
||||
}
|
||||
});
|
||||
$("#min_per2").change(function () {
|
||||
if ($("#min_per").prop('checked')) {
|
||||
change_min_per();
|
||||
}
|
||||
});
|
||||
$("#min_assign").click(function () {
|
||||
if ($("#min_assign").prop('checked')) {
|
||||
change_min_assign();
|
||||
}
|
||||
});
|
||||
$("input[name='zd_minute']").click(function () {
|
||||
if ($("#min_assign").prop('checked')) {
|
||||
change_min_assign();
|
||||
}
|
||||
});
|
||||
|
||||
//hour
|
||||
$("#hour_all").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_hour").val("*");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#hour_circle").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_hour_circle();
|
||||
}
|
||||
});
|
||||
$("#hour_circle1").change(function () {
|
||||
if ($("#hour_circle").prop('checked')) {
|
||||
change_hour_circle();
|
||||
}
|
||||
});
|
||||
$("#hour_circle2").change(function () {
|
||||
if ($("#hour_circle").prop('checked')) {
|
||||
change_hour_circle();
|
||||
}
|
||||
});
|
||||
$("#hour_per").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_hour_per();
|
||||
}
|
||||
});
|
||||
$("#hour_per1").change(function () {
|
||||
if ($("#hour_per").prop('checked')) {
|
||||
change_hour_per();
|
||||
}
|
||||
});
|
||||
$("#hour_per2").change(function () {
|
||||
if ($("#hour_per").prop('checked')) {
|
||||
change_hour_per();
|
||||
}
|
||||
});
|
||||
$("#hour_assign").click(function () {
|
||||
if ($("#hour_assign").prop('checked')) {
|
||||
change_hour_assign();
|
||||
}
|
||||
});
|
||||
$("input[name='zd_hour']").click(function () {
|
||||
if ($("#hour_assign").prop('checked')) {
|
||||
change_hour_assign();
|
||||
}
|
||||
});
|
||||
|
||||
//day
|
||||
$("#day_all").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_day").val("*");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#day_no").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_day").val("?");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#day_last").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_day").val("L");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#day_circle").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_day_circle();
|
||||
}
|
||||
});
|
||||
$("#day_circle1").change(function () {
|
||||
if ($("#day_circle").prop('checked')) {
|
||||
change_day_circle();
|
||||
}
|
||||
});
|
||||
$("#day_circle2").change(function () {
|
||||
if ($("#day_circle").prop('checked')) {
|
||||
change_day_circle();
|
||||
}
|
||||
});
|
||||
$("#day_per").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_day_per();
|
||||
}
|
||||
});
|
||||
$("#day_per1").change(function () {
|
||||
if ($("#day_per").prop('checked')) {
|
||||
change_day_per();
|
||||
}
|
||||
});
|
||||
$("#day_per2").change(function () {
|
||||
if ($("#day_per").prop('checked')) {
|
||||
change_day_per();
|
||||
}
|
||||
});
|
||||
$("#day_work").click(function () {
|
||||
if ($("#day_work").prop('checked')) {
|
||||
change_day_work();
|
||||
}
|
||||
});
|
||||
$("#day_work1").change(function () {
|
||||
if ($("#day_work").prop('checked')) {
|
||||
change_day_work();
|
||||
}
|
||||
});
|
||||
$("#day_assign").click(function () {
|
||||
if ($("#day_assign").prop('checked')) {
|
||||
change_day_assign();
|
||||
}
|
||||
});
|
||||
$("input[name='zd_day']").click(function () {
|
||||
if ($("#day_assign").prop('checked')) {
|
||||
change_day_assign();
|
||||
}
|
||||
});
|
||||
|
||||
//month
|
||||
$("#month_all").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_month").val("*");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#month_no").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_month").val("?");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#month_last").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_month").val("L");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#month_circle").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_month_circle();
|
||||
}
|
||||
});
|
||||
$("#month_circle1").change(function () {
|
||||
if ($("#month_circle").prop('checked')) {
|
||||
change_month_circle();
|
||||
}
|
||||
});
|
||||
$("#month_circle2").change(function () {
|
||||
if ($("#month_circle").prop('checked')) {
|
||||
change_month_circle();
|
||||
}
|
||||
});
|
||||
$("#month_per").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_month_per();
|
||||
}
|
||||
});
|
||||
$("#month_per1").change(function () {
|
||||
if ($("#month_per").prop('checked')) {
|
||||
change_month_per();
|
||||
}
|
||||
});
|
||||
$("#month_per2").change(function () {
|
||||
if ($("#month_per").prop('checked')) {
|
||||
change_month_per();
|
||||
}
|
||||
});
|
||||
$("#month_assign").click(function () {
|
||||
if ($("#month_assign").prop('checked')) {
|
||||
change_month_assign();
|
||||
}
|
||||
});
|
||||
$("input[name='zd_month']").click(function () {
|
||||
if ($("#month_assign").prop('checked')) {
|
||||
change_month_assign();
|
||||
}
|
||||
});
|
||||
|
||||
//week
|
||||
$("#week_all").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_week").val("*");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#week_no").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_week").val("?");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#week_circle").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_week_circle();
|
||||
}
|
||||
});
|
||||
$("#week_circle1").change(function () {
|
||||
if ($("#week_circle").prop('checked')) {
|
||||
change_week_circle();
|
||||
}
|
||||
});
|
||||
$("#week_circle2").change(function () {
|
||||
if ($("#week_circle").prop('checked')) {
|
||||
change_week_circle();
|
||||
}
|
||||
});
|
||||
$("#week_last").click(function () {
|
||||
if ($("#week_last").prop('checked')) {
|
||||
change_week_last();
|
||||
}
|
||||
});
|
||||
$("#week_last1").change(function () {
|
||||
if ($("#week_last").prop('checked')) {
|
||||
change_week_last();
|
||||
}
|
||||
});
|
||||
$("#week_num").click(function () {
|
||||
if ($("#week_num").prop('checked')) {
|
||||
change_week_num();
|
||||
}
|
||||
});
|
||||
$("#week_num1").change(function () {
|
||||
if ($("#week_num").prop('checked')) {
|
||||
change_week_num();
|
||||
}
|
||||
});
|
||||
$("#week_num2").change(function () {
|
||||
if ($("#week_num").prop('checked')) {
|
||||
change_week_num();
|
||||
}
|
||||
});
|
||||
$("#week_assign").click(function () {
|
||||
if ($("#week_assign").prop('checked')) {
|
||||
change_week_assign();
|
||||
}
|
||||
});
|
||||
$("input[name='zd_week']").click(function () {
|
||||
if ($("#week_assign").prop('checked')) {
|
||||
change_week_assign();
|
||||
}
|
||||
});
|
||||
|
||||
//year
|
||||
$("#year_all").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_year").val("*");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#year_no").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$("#v_year").val("");
|
||||
gen_cron();
|
||||
}
|
||||
});
|
||||
$("#year_circle").click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
change_year_circle();
|
||||
}
|
||||
});
|
||||
$("#year_circle1").change(function () {
|
||||
if ($("#year_circle").prop('checked')) {
|
||||
change_year_circle();
|
||||
}
|
||||
});
|
||||
$("#year_circle2").change(function () {
|
||||
if ($("#year_circle").prop('checked')) {
|
||||
change_year_circle();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function change_sec_assign() {
|
||||
var sec_array = new Array();
|
||||
$("input[name='zd_second']:checked").each(function () {
|
||||
sec_array[sec_array.length] = $(this).val();
|
||||
});
|
||||
sec_array = sec_array.join(",");
|
||||
if (sec_array == null || sec_array == '') {
|
||||
$("#v_second").val("*");
|
||||
} else {
|
||||
$("#v_second").val(sec_array);
|
||||
}
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_sec_circle() {
|
||||
var v1 = $("#sec_circle1").val();
|
||||
var v2 = $("#sec_circle2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#sec_circle1").val(v1);
|
||||
}
|
||||
if (v2 < 2) {
|
||||
v2 = 2;
|
||||
$("#sec_circle2").val(v2);
|
||||
}
|
||||
if (v2 > 59) {
|
||||
v2 = 59;
|
||||
$("#sec_circle2").val(v2);
|
||||
}
|
||||
if (v1 > 59) {
|
||||
v1 = 59;
|
||||
$("#sec_circle1").val(v1);
|
||||
}
|
||||
if (v1 >= v2) {
|
||||
v1 = v2 - 1;
|
||||
$("#sec_circle1").val(v1);
|
||||
}
|
||||
if (v1 > 60 || v2 > 60) {
|
||||
return;
|
||||
}
|
||||
if (v1 > v2) {
|
||||
return;
|
||||
}
|
||||
$("#v_second").val(v1 + "-" + v2);
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_sec_per() {
|
||||
var v1 = $("#sec_per1").val();
|
||||
var v2 = $("#sec_per2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 0) {
|
||||
v1 = 0;
|
||||
$("#sec_per1").val(v1);
|
||||
}
|
||||
if (v1 > 59) {
|
||||
v1 = 59;
|
||||
$("#sec_per1").val(v1);
|
||||
}
|
||||
if (v2 < 1) {
|
||||
v2 = 1;
|
||||
$("#sec_per2").val(v2);
|
||||
}
|
||||
if (v2 > 59) {
|
||||
v2 = 59;
|
||||
$("#sec_per2").val(v2);
|
||||
}
|
||||
$("#v_second").val(v1 + "/" + v2);
|
||||
gen_cron()
|
||||
}
|
||||
|
||||
function change_min_assign() {
|
||||
var sec_array = new Array();
|
||||
$("input[name='zd_minute']:checked").each(function () {
|
||||
sec_array[sec_array.length] = $(this).val();
|
||||
});
|
||||
sec_array = sec_array.join(",");
|
||||
if (sec_array == null || sec_array == '') {
|
||||
$("#v_min").val("*");
|
||||
} else {
|
||||
$("#v_min").val(sec_array);
|
||||
}
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_min_circle() {
|
||||
var v1 = $("#min_circle1").val();
|
||||
var v2 = $("#min_circle2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#min_circle1").val(v1);
|
||||
}
|
||||
if (v2 < 2) {
|
||||
v2 = 2;
|
||||
$("#min_circle2").val(v2);
|
||||
}
|
||||
if (v2 > 59) {
|
||||
v2 = 59;
|
||||
$("#min_circle2").val(v2);
|
||||
}
|
||||
if (v1 > 59) {
|
||||
v1 = 59;
|
||||
$("#min_circle1").val(v1);
|
||||
}
|
||||
if (v1 >= v2) {
|
||||
v1 = v2 - 1;
|
||||
$("#min_circle1").val(v1);
|
||||
}
|
||||
if (v1 > 60 || v2 > 60) {
|
||||
return;
|
||||
}
|
||||
if (v1 > v2) {
|
||||
return;
|
||||
}
|
||||
$("#v_min").val(v1 + "-" + v2);
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_min_per() {
|
||||
var v1 = $("#min_per1").val();
|
||||
var v2 = $("#min_per2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 0) {
|
||||
v1 = 0;
|
||||
$("#min_per1").val(v1);
|
||||
}
|
||||
if (v1 > 59) {
|
||||
v1 = 59;
|
||||
$("#min_per1").val(v1);
|
||||
}
|
||||
if (v2 < 1) {
|
||||
v2 = 1;
|
||||
$("#min_per2").val(v2);
|
||||
}
|
||||
if (v2 > 59) {
|
||||
v2 = 59;
|
||||
$("#min_per2").val(v2);
|
||||
}
|
||||
|
||||
$("#v_min").val(v1 + "/" + v2);
|
||||
gen_cron()
|
||||
}
|
||||
|
||||
function change_hour_assign() {
|
||||
var sec_array = new Array();
|
||||
$("input[name='zd_hour']:checked").each(function () {
|
||||
sec_array[sec_array.length] = $(this).val();
|
||||
});
|
||||
sec_array = sec_array.join(",");
|
||||
if (sec_array == null || sec_array == '') {
|
||||
$("#v_hour").val("*");
|
||||
} else {
|
||||
$("#v_hour").val(sec_array);
|
||||
}
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_hour_circle() {
|
||||
var v1 = $("#hour_circle1").val();
|
||||
var v2 = $("#hour_circle2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#hour_circle1").val(v1);
|
||||
}
|
||||
if (v2 < 2) {
|
||||
v2 = 2;
|
||||
$("#hour_circle2").val(v2);
|
||||
}
|
||||
if (v2 > 23) {
|
||||
v2 = 23;
|
||||
$("#hour_circle2").val(v2);
|
||||
}
|
||||
if (v1 > 23) {
|
||||
v1 = 23;
|
||||
$("#hour_circle1").val(v1);
|
||||
}
|
||||
if (v1 >= v2) {
|
||||
v1 = v2 - 1;
|
||||
$("#hour_circle1").val(v1);
|
||||
}
|
||||
if (v1 > 23 || v2 > 23) {
|
||||
return;
|
||||
}
|
||||
if (v1 > v2) {
|
||||
return;
|
||||
}
|
||||
$("#v_hour").val(v1 + "-" + v2);
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_hour_per() {
|
||||
var v1 = $("#hour_per1").val();
|
||||
var v2 = $("#hour_per2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 0) {
|
||||
v1 = 0;
|
||||
$("#hour_per1").val(v1);
|
||||
}
|
||||
if (v1 > 23) {
|
||||
v1 = 23;
|
||||
$("#hour_per1").val(v1);
|
||||
}
|
||||
if (v2 < 1) {
|
||||
v2 = 1;
|
||||
$("#hour_per2").val(v2);
|
||||
}
|
||||
if (v2 > 23) {
|
||||
v2 = 23;
|
||||
$("#hour_per2").val(v2);
|
||||
}
|
||||
|
||||
$("#v_hour").val(v1 + "/" + v2);
|
||||
gen_cron()
|
||||
}
|
||||
|
||||
function change_day_assign() {
|
||||
var sec_array = new Array();
|
||||
$("input[name='zd_day']:checked").each(function () {
|
||||
sec_array[sec_array.length] = $(this).val();
|
||||
});
|
||||
sec_array = sec_array.join(",");
|
||||
if (sec_array == null || sec_array == '') {
|
||||
$("#v_day").val("*");
|
||||
} else {
|
||||
$("#v_day").val(sec_array);
|
||||
}
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_day_circle() {
|
||||
var v1 = $("#day_circle1").val();
|
||||
var v2 = $("#day_circle2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#day_circle1").val(v1);
|
||||
}
|
||||
if (v2 < 2) {
|
||||
v2 = 2;
|
||||
$("#day_circle2").val(v2);
|
||||
}
|
||||
if (v2 > 31) {
|
||||
v2 = 31;
|
||||
$("#day_circle2").val(v2);
|
||||
}
|
||||
if (v1 > 31) {
|
||||
v1 = 31;
|
||||
$("#day_circle1").val(v1);
|
||||
}
|
||||
if (v1 >= v2) {
|
||||
v1 = v2 - 1;
|
||||
$("#day_circle1").val(v1);
|
||||
}
|
||||
if (v1 > 31 || v2 > 31) {
|
||||
return;
|
||||
}
|
||||
if (v1 > v2) {
|
||||
return;
|
||||
}
|
||||
$("#v_day").val(v1 + "-" + v2);
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_day_per() {
|
||||
var v1 = $("#day_per1").val();
|
||||
var v2 = $("#day_per2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#day_per1").val(v1);
|
||||
}
|
||||
if (v1 > 31) {
|
||||
v1 = 31;
|
||||
$("#day_per1").val(v1);
|
||||
}
|
||||
if (v2 < 1) {
|
||||
v2 = 1;
|
||||
$("#day_per2").val(v2);
|
||||
}
|
||||
if (v2 > 31) {
|
||||
v2 = 31;
|
||||
$("#day_per2").val(v2);
|
||||
}
|
||||
|
||||
$("#v_day").val(v1 + "/" + v2);
|
||||
gen_cron()
|
||||
}
|
||||
|
||||
function change_day_work() {
|
||||
var v1 = $("#day_work1").val();
|
||||
|
||||
if (v1 == null || v1 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#day_work1").val(v1);
|
||||
}
|
||||
if (v1 > 31) {
|
||||
v1 = 31;
|
||||
$("#day_work1").val(v1);
|
||||
}
|
||||
$("#v_day").val(v1 + "W");
|
||||
gen_cron()
|
||||
}
|
||||
|
||||
function change_month_assign() {
|
||||
var sec_array = new Array();
|
||||
$("input[name='zd_month']:checked").each(function () {
|
||||
sec_array[sec_array.length] = $(this).val();
|
||||
});
|
||||
sec_array = sec_array.join(",");
|
||||
if (sec_array == null || sec_array == '') {
|
||||
$("#v_month").val("*");
|
||||
} else {
|
||||
$("#v_month").val(sec_array);
|
||||
}
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_month_circle() {
|
||||
var v1 = $("#month_circle1").val();
|
||||
var v2 = $("#month_circle2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#month_circle1").val(v1);
|
||||
}
|
||||
if (v2 < 2) {
|
||||
v2 = 2;
|
||||
$("#month_circle2").val(v2);
|
||||
}
|
||||
if (v2 > 12) {
|
||||
v2 = 12;
|
||||
$("#month_circle2").val(v2);
|
||||
}
|
||||
if (v1 > 12) {
|
||||
v1 = 12;
|
||||
$("#month_circle1").val(v1);
|
||||
}
|
||||
if (v1 >= v2) {
|
||||
v1 = v2 - 1;
|
||||
$("#month_circle1").val(v1);
|
||||
}
|
||||
if (v1 > 12 || v2 > 12) {
|
||||
return;
|
||||
}
|
||||
if (v1 > v2) {
|
||||
return;
|
||||
}
|
||||
$("#v_month").val(v1 + "-" + v2);
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_month_per() {
|
||||
var v1 = $("#month_per1").val();
|
||||
var v2 = $("#month_per2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#month_per1").val(v1);
|
||||
}
|
||||
if (v1 > 12) {
|
||||
v1 = 12;
|
||||
$("#month_per1").val(v1);
|
||||
}
|
||||
if (v2 < 1) {
|
||||
v2 = 1;
|
||||
$("#month_per2").val(v2);
|
||||
}
|
||||
if (v2 > 12) {
|
||||
v2 = 12;
|
||||
$("#month_per2").val(v2);
|
||||
}
|
||||
|
||||
$("#v_month").val(v1 + "/" + v2);
|
||||
gen_cron()
|
||||
}
|
||||
|
||||
function change_week_assign() {
|
||||
var sec_array = new Array();
|
||||
$("input[name='zd_week']:checked").each(function () {
|
||||
sec_array[sec_array.length] = $(this).val();
|
||||
});
|
||||
sec_array = sec_array.join(",");
|
||||
if (sec_array == null || sec_array == '') {
|
||||
$("#v_week").val("*");
|
||||
} else {
|
||||
$("#v_week").val(sec_array);
|
||||
}
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_week_circle() {
|
||||
var v1 = $("#week_circle1").val();
|
||||
var v2 = $("#week_circle2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#week_circle1").val(v1);
|
||||
}
|
||||
if (v2 < 2) {
|
||||
v2 = 2;
|
||||
$("#week_circle2").val(v2);
|
||||
}
|
||||
if (v2 > 7) {
|
||||
v2 = 7;
|
||||
$("#week_circle2").val(v2);
|
||||
}
|
||||
if (v1 > 7) {
|
||||
v1 = 7;
|
||||
$("#week_circle1").val(v1);
|
||||
}
|
||||
if (v1 >= v2) {
|
||||
v1 = v2 - 1;
|
||||
$("#week_circle1").val(v1);
|
||||
}
|
||||
if (v1 > 7 || v2 > 7) {
|
||||
return;
|
||||
}
|
||||
if (v1 > v2) {
|
||||
return;
|
||||
}
|
||||
$("#v_week").val(v1 + "-" + v2);
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_week_last() {
|
||||
var v1 = $("#week_last1").val();
|
||||
|
||||
if (v1 == null || v1 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#week_last1").val(v1);
|
||||
}
|
||||
if (v1 > 7) {
|
||||
v1 = 7;
|
||||
$("#week_last1").val(v1);
|
||||
}
|
||||
$("#v_week").val(v1 + "L");
|
||||
gen_cron()
|
||||
}
|
||||
|
||||
function change_week_num() {
|
||||
var v1 = $("#week_num1").val();
|
||||
var v2 = $("#week_num2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 1) {
|
||||
v1 = 1;
|
||||
$("#week_num1").val(v1);
|
||||
}
|
||||
if (v2 < 1) {
|
||||
v2 = 1;
|
||||
$("#week_num2").val(v2);
|
||||
}
|
||||
if (v2 > 7) {
|
||||
v2 = 7;
|
||||
$("#week_num2").val(v2);
|
||||
}
|
||||
if (v1 > 4) {
|
||||
v1 = 4;
|
||||
$("#week_num1").val(v1);
|
||||
}
|
||||
|
||||
$("#v_week").val(v1 + "#" + v2);
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function change_year_circle() {
|
||||
var v1 = $("#year_circle1").val();
|
||||
var v2 = $("#year_circle2").val();
|
||||
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
|
||||
return;
|
||||
}
|
||||
if (v1 < 2000) {
|
||||
v1 = 2000;
|
||||
$("#year_circle1").val(v1);
|
||||
}
|
||||
if (v2 < 2000) {
|
||||
v2 = 2000;
|
||||
$("#year_circle2").val(v2);
|
||||
}
|
||||
if (v2 > 3000) {
|
||||
v2 = 3000;
|
||||
$("#year_circle2").val(v2);
|
||||
}
|
||||
if (v1 > 3000) {
|
||||
v1 = 3000;
|
||||
$("#year_circle1").val(v1);
|
||||
}
|
||||
if (v1 >= v2) {
|
||||
v1 = v2 - 1;
|
||||
$("#year_circle1").val(v1);
|
||||
}
|
||||
if (v1 > 3000 || v2 > 3000) {
|
||||
return;
|
||||
}
|
||||
if (v1 > v2) {
|
||||
return;
|
||||
}
|
||||
$("#v_year").val(v1 + "-" + v2);
|
||||
gen_cron();
|
||||
}
|
||||
|
||||
function gen_cron() {
|
||||
var str = $("#v_second").val() + " "
|
||||
+ $("#v_min").val() + " "
|
||||
+ $("#v_hour").val() + " "
|
||||
+ $("#v_day").val() + " "
|
||||
+ $("#v_month").val() + " "
|
||||
+ $("#v_week").val() + " "
|
||||
+ $("#v_year").val();
|
||||
$("#cron").val(str);
|
||||
}
|
|
@ -161,6 +161,14 @@ public class BaseController
|
|||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功数据
|
||||
*/
|
||||
public static AjaxResult success(Object data)
|
||||
{
|
||||
return AjaxResult.success("操作成功", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败消息
|
||||
*/
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
|
@ -189,4 +190,31 @@ public class SysJobController extends BaseController
|
|||
{
|
||||
return jobService.checkCronExpressionIsValid(job.getCronExpression());
|
||||
}
|
||||
|
||||
/**
|
||||
* Cron表达式在线生成
|
||||
*/
|
||||
@GetMapping("/cron")
|
||||
public String cron()
|
||||
{
|
||||
return prefix + "/cron";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询cron表达式近5次的执行时间
|
||||
*/
|
||||
@GetMapping("/queryCronExpression")
|
||||
@ResponseBody
|
||||
public AjaxResult queryCronExpression(@RequestParam(value = "cronExpression", required = false) String cronExpression)
|
||||
{
|
||||
if (jobService.checkCronExpressionIsValid(cronExpression))
|
||||
{
|
||||
List<String> dateList = CronUtils.getRecentTriggerTime(cronExpression);
|
||||
return success(dateList);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error("表达式无效");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package com.ruoyi.quartz.util;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.quartz.CronExpression;
|
||||
import org.quartz.TriggerUtils;
|
||||
import org.quartz.impl.triggers.CronTriggerImpl;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
||||
/**
|
||||
* cron表达式工具类
|
||||
|
@ -60,4 +65,30 @@ public class CronUtils
|
|||
throw new IllegalArgumentException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过表达式获取近10次的执行时间
|
||||
*
|
||||
* @param cron 表达式
|
||||
* @return 时间列表
|
||||
*/
|
||||
public static List<String> getRecentTriggerTime(String cron)
|
||||
{
|
||||
List<String> list = new ArrayList<String>();
|
||||
try
|
||||
{
|
||||
CronTriggerImpl cronTriggerImpl = new CronTriggerImpl();
|
||||
cronTriggerImpl.setCronExpression(cron);
|
||||
List<Date> dates = TriggerUtils.computeFireTimes(cronTriggerImpl, null, 10);
|
||||
for (Date date : dates)
|
||||
{
|
||||
list.add(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, date));
|
||||
}
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -47,6 +47,9 @@
|
|||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:job:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
<a class="btn btn-primary" onclick="javascript:cron()">
|
||||
<i class="fa fa-code"></i> 生成表达式
|
||||
</a>
|
||||
<a class="btn btn-info" onclick="javascript:jobLog()" shiro:hasPermission="monitor:job:detail">
|
||||
<i class="fa fa-list"></i> 日志
|
||||
</a>
|
||||
|
@ -176,6 +179,19 @@
|
|||
}
|
||||
$.modal.openTab("调度日志", url);
|
||||
}
|
||||
|
||||
/* cron表达式生成 */
|
||||
function cron() {
|
||||
var url = prefix + '/cron';
|
||||
var height = $(window).height() - 50;
|
||||
top.layer.open({
|
||||
title: "Cron表达式生成器",
|
||||
type: 2,
|
||||
area: ['800px', height + "px" ], //宽高
|
||||
shadeClose: true,
|
||||
content: url
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue