pull/609/head
Mr Chen 11 months ago
parent 599d3ca8fc
commit d411439734
  1. 46
      route/static/app/crontab.js
  2. 2
      route/templates/default/crontab.html

@ -209,10 +209,10 @@ function planAdd(){
layer.msg('任务名称不能为空!',{icon:2}); layer.msg('任务名称不能为空!',{icon:2});
return; return;
} }
$("#set-Config input[name='name']").val(name); $("#cronConfig input[name='name']").val(name);
var type = $(".plancycle").find("b").attr("val"); var type = $(".plancycle").find("b").attr("val");
$("#set-Config input[name='type']").val(type); $("#cronConfig input[name='type']").val(type);
var is1; var is1;
@ -233,7 +233,7 @@ function planAdd(){
} }
var where1 = $('#excode_week b').attr('val'); var where1 = $('#excode_week b').attr('val');
$("#set-Config input[name='where1']").val(where1); $("#cronConfig input[name='where1']").val(where1);
if(where1 > is1 || where1 < is2){ if(where1 > is1 || where1 < is2){
$("#ptime input[name='where1']").focus(); $("#ptime input[name='where1']").focus();
@ -247,14 +247,14 @@ function planAdd(){
layer.msg('小时值不合法!',{icon:2}); layer.msg('小时值不合法!',{icon:2});
return; return;
} }
$("#set-Config input[name='hour']").val(hour); $("#cronConfig input[name='hour']").val(hour);
var minute = $("#ptime input[name='minute']").val(); var minute = $("#ptime input[name='minute']").val();
if(minute > 59 || minute < 0){ if(minute > 59 || minute < 0){
$("#ptime input[name='minute']").focus(); $("#ptime input[name='minute']").focus();
layer.msg('分钟值不合法!',{icon:2}); layer.msg('分钟值不合法!',{icon:2});
return; return;
} }
$("#set-Config input[name='minute']").val(minute); $("#cronConfig input[name='minute']").val(minute);
var save = $("#save").val(); var save = $("#save").val();
if(save < 0){ if(save < 0){
@ -262,8 +262,8 @@ function planAdd(){
return; return;
} }
$("#set-Config input[name='save']").val(save); $("#cronConfig input[name='save']").val(save);
$("#set-Config input[name='week']").val($(".planweek").find("b").attr("val")); $("#cronConfig input[name='week']").val($(".planweek").find("b").attr("val"));
var sType = $(".planjs").find("b").attr("val"); var sType = $(".planjs").find("b").attr("val");
var sBody = encodeURIComponent($("#implement textarea[name='sBody']").val()); var sBody = encodeURIComponent($("#implement textarea[name='sBody']").val());
@ -292,9 +292,9 @@ function planAdd(){
} }
} }
// urladdress = encodeURIComponent(urladdress); // urladdress = encodeURIComponent(urladdress);
$("#set-Config input[name='urladdress']").val(urladdress); $("#cronConfig input[name='urladdress']").val(urladdress);
$("#set-Config input[name='sType']").val(sType); $("#cronConfig input[name='sType']").val(sType);
$("#set-Config textarea[name='sBody']").val(decodeURIComponent(sBody)); $("#cronConfig textarea[name='sBody']").val(decodeURIComponent(sBody));
if(sType == 'site' || sType == 'database' || sType == 'path'){ if(sType == 'site' || sType == 'database' || sType == 'path'){
var backupTo = $(".planBackupTo").find("b").attr("val"); var backupTo = $(".planBackupTo").find("b").attr("val");
@ -320,28 +320,28 @@ function planAdd(){
if (type == 'minute-n'){ if (type == 'minute-n'){
var where1 = $("#ptime input[name='where1']").val(); var where1 = $("#ptime input[name='where1']").val();
$("#set-Config input[name='where1']").val(where1); $("#cronConfig input[name='where1']").val(where1);
} }
if (type == 'day-n'){ if (type == 'day-n'){
var where1 = $("#ptime input[name='where1']").val(); var where1 = $("#ptime input[name='where1']").val();
$("#set-Config input[name='where1']").val(where1); $("#cronConfig input[name='where1']").val(where1);
} }
if (type == 'hour-n'){ if (type == 'hour-n'){
var where1 = $("#ptime input[name='where1']").val(); var where1 = $("#ptime input[name='where1']").val();
$("#set-Config input[name='where1']").val(where1); $("#cronConfig input[name='where1']").val(where1);
} }
if (type == 'month'){ if (type == 'month'){
var where1 = $("#ptime input[name='where1']").val(); var where1 = $("#ptime input[name='where1']").val();
$("#set-Config input[name='where1']").val(where1); $("#cronConfig input[name='where1']").val(where1);
} }
$("#set-Config input[name='sName']").val(sName); $("#cronConfig input[name='sName']").val(sName);
layer.msg('正在添加,请稍候...!',{icon:16,time:0,shade: [0.3, '#000']}); layer.msg('正在添加,请稍候...!',{icon:16,time:0,shade: [0.3, '#000']});
var data = $("#set-Config").serialize() + '&sBody='+sBody + '&urladdress=' + urladdress; var data = $("#cronConfig").serialize() + '&sBody='+sBody + '&urladdress=' + urladdress;
// console.log(data); // console.log(data);
$.post('/crontab/add',data,function(rdata){ $.post('/crontab/add',data,function(rdata){
if(!rdata.status) { if(!rdata.status) {
@ -365,20 +365,20 @@ function allAddCrontab(dataList,successCount,errorMsg){
} }
var loadT = layer.msg(lan.get('add',[dataList[0]]),{icon:16,time:0,shade: [0.3, '#000']}); var loadT = layer.msg(lan.get('add',[dataList[0]]),{icon:16,time:0,shade: [0.3, '#000']});
var sType = $(".planjs").find("b").attr("val"); var sType = $(".planjs").find("b").attr("val");
var minute = parseInt($("#set-Config input[name='minute']").val()); var minute = parseInt($("#cronConfig input[name='minute']").val());
var hour = parseInt($("#set-Config input[name='hour']").val()); var hour = parseInt($("#cronConfig input[name='hour']").val());
var sTitle = (sType == 'site')?lan.crontab.backup_site:lan.crontab.backup_database; var sTitle = (sType == 'site')?lan.crontab.backup_site:lan.crontab.backup_database;
if(sType == 'logs') sTitle = lan.crontab.backup_log; if(sType == 'logs') sTitle = lan.crontab.backup_log;
minute += 5; minute += 5;
if(hour !== '' && minute > 59){ if(hour !== '' && minute > 59){
if(hour >= 23) hour = 0; if(hour >= 23) hour = 0;
$("#set-Config input[name='hour']").val(hour+1); $("#cronConfig input[name='hour']").val(hour+1);
minute = 5; minute = 5;
} }
$("#set-Config input[name='minute']").val(minute); $("#cronConfig input[name='minute']").val(minute);
$("#set-Config input[name='name']").val(sTitle + '['+dataList[0]+']'); $("#cronConfig input[name='name']").val(sTitle + '['+dataList[0]+']');
$("#set-Config input[name='sName']").val(dataList[0]); $("#cronConfig input[name='sName']").val(dataList[0]);
var pdata = $("#set-Config").serialize() + '&sBody=&urladdress='; var pdata = $("#cronConfig").serialize() + '&sBody=&urladdress=';
$.ajax({ $.ajax({
type:'POST', type:'POST',
url:'/crontab/add', url:'/crontab/add',

@ -96,7 +96,7 @@
<li>磁盘容量不够、数据库密码错误、网络不稳定等原因,可能导致数据备份不完整</li> <li>磁盘容量不够、数据库密码错误、网络不稳定等原因,可能导致数据备份不完整</li>
</ul> </ul>
</div> </div>
<form id="set-Config" action="/crontab/add" enctype="multipart/form-data" method="post" style="display: none;"> <form id="cronConfig" action="/crontab/add" enctype="multipart/form-data" method="post" style="display: none;">
<input type="text" name="name" value="" /> <input type="text" name="name" value="" />
<input type="text" name="type" value="" /> <input type="text" name="type" value="" />
<input type="number" name="where1" value="" /> <input type="number" name="where1" value="" />

Loading…
Cancel
Save