@@ -55,37 +55,38 @@ <h2 class="text-center">设置定时</h2>
55
55
</ script >
56
56
< script >
57
57
$ ( '#send' ) . on ( 'click' , function ( ) {
58
- if ( $ ( '#ontime_flg' ) [ 0 ] . checked == false ) {
59
- $ ( '#run-result' ) . html ( "<h1 class=\"alert alert-danger text-center\">请打开开关</h1><div><pre>如果要设置,请打开开关</pre></div>" ) . show ( ) ;
60
- return false ;
61
- }
62
-
63
58
sendData = { }
64
59
data = { }
65
- sendData [ 'mode' ] = $ ( '#ontime_method' ) [ 0 ] . value ;
66
- sendData [ 'sw' ] = true ;
67
- if ( sendData [ 'mode' ] == 'ontime' ) {
68
- sendData [ 'date' ] = $ ( '#ontime_run_date' ) [ 0 ] . value ;
69
- sendData [ 'time' ] = $ ( '#ontime_val' ) [ 0 ] . value ;
70
- sendData [ 'tz1' ] = parseInt ( $ ( '#randtimezone1' ) [ 0 ] . value ) ;
71
- sendData [ 'tz2' ] = parseInt ( $ ( '#randtimezone2' ) [ 0 ] . value ) ;
72
- if ( $ ( '#randtimezonesw' ) [ 0 ] . checked == true ) {
73
- if ( sendData [ 'tz1' ] > sendData [ 'tz2' ] ) {
74
- $ ( '#run-result' ) . html ( "<h1 class=\"alert alert-danger text-center\">随机值错误</h1><div><pre>开启随机时tz1 不能小于 tz2</pre></div>" ) . show ( ) ;
75
- return false ;
60
+
61
+ if ( $ ( '#ontime_flg' ) [ 0 ] . checked == true ) {
62
+ sendData [ 'mode' ] = $ ( '#ontime_method' ) [ 0 ] . value ;
63
+ sendData [ 'sw' ] = true ;
64
+ if ( sendData [ 'mode' ] == 'ontime' ) {
65
+ sendData [ 'date' ] = $ ( '#ontime_run_date' ) [ 0 ] . value ;
66
+ sendData [ 'time' ] = $ ( '#ontime_val' ) [ 0 ] . value ;
67
+ sendData [ 'tz1' ] = parseInt ( $ ( '#randtimezone1' ) [ 0 ] . value ) ;
68
+ sendData [ 'tz2' ] = parseInt ( $ ( '#randtimezone2' ) [ 0 ] . value ) ;
69
+ if ( $ ( '#randtimezonesw' ) [ 0 ] . checked == true ) {
70
+ if ( sendData [ 'tz1' ] > sendData [ 'tz2' ] ) {
71
+ $ ( '#run-result' ) . html ( "<h1 class=\"alert alert-danger text-center\">随机值错误</h1><div><pre>开启随机时tz1 不能小于 tz2</pre></div>" ) . show ( ) ;
72
+ return false ;
73
+ }
74
+ sendData [ 'randsw' ] = true ;
75
+ } else {
76
+ sendData [ 'randsw' ] = false ;
76
77
}
77
- sendData [ 'randsw' ] = true ;
78
- } else {
79
- sendData [ 'randsw' ] = false ;
80
- }
81
78
82
- } else if ( sendData [ 'mode' ] == 'cron' ) {
83
- sendData [ 'cron_val' ] = $ ( '#cron_val' ) [ 0 ] . value ;
84
- sendData [ 'cron_sec' ] = $ ( '#cron_sec' ) [ 0 ] . value ;
85
- } else {
86
- $ ( '#run-result' ) . html ( "<h1 class=\"alert alert-danger text-center\">模式错误</h1><div><pre>模式错误</pre></div>" ) . show ( ) ;
87
- return false ;
79
+ } else if ( sendData [ 'mode' ] == 'cron' ) {
80
+ sendData [ 'cron_val' ] = $ ( '#cron_val' ) [ 0 ] . value ;
81
+ sendData [ 'cron_sec' ] = $ ( '#cron_sec' ) [ 0 ] . value ;
82
+ } else {
83
+ $ ( '#run-result' ) . html ( "<h1 class=\"alert alert-danger text-center\">模式错误</h1><div><pre>模式错误</pre></div>" ) . show ( ) ;
84
+ return false ;
85
+ }
86
+ } else {
87
+ sendData [ 'sw' ] = false ;
88
88
}
89
+
89
90
var $this = $ ( this ) ;
90
91
$ . ajax ( "/task/{{task.id}}/settime" , {
91
92
type : 'POST' ,
0 commit comments