Commit c5ee146c authored by yff's avatar yff

删除多余部分

parent 14326866
<div class="gui-fluid editTable">
<input type="hidden" name="flag">
<input type="hidden" name="id" >
<div class="gui-row">
<div class="gui-col-sm12">
<label class="gui-form-label" for="">日志保留时间:</label>
<div class="gui-input-block">
<input type="text" name="day" data-toggle="gui-numberspinner" data-options="min:1" style="width:200px">
<span style="margin-left: 5px;color: #666;font-size: 12px"></span>
</div>
</div>
</div>
</div>
<script>
$(function () {
var dig=$('#timerlogConfig');
HTTP.post("timer/timer/getTimer",{},function (res) {
if(res["success"]){
var selectedRow=res["data"]["records"];
dig.find("input[name='day']").val(selectedRow.day);
}
},null,false);
/*循环计数*/
})
</script>
<style>
#creater_trigger header{
margin: 20px 0 10px 10px;
color: #666666;
}
#creater_trigger .label-radio{
padding:5px 30px 5px 0;width:68px;
}
#creater_trigger .label-radioo{
padding:5px 30px 5px 0;width:50px;
}
#creater_trigger .template input{
text-align: center
}
</style>
<div title="基本任务" >
<div class="gui-fluid editTable" style="">
<input type="hidden" name="id">
<input type="hidden" name="flag">
<input type="hidden" name="tybz" value="N">
<div class="gui-row">
<div class="gui-col-sm12">
<label class="gui-form-label" for="">名称:</label>
<div class="gui-input-block">
<input type="text" name="mc" data-options="required:true" data-toggle="gui-textbox" style="width: 100%">
</div>
</div>
</div>
<div class="gui-row">
<div class="gui-col-sm12">
<label class="gui-form-label" for="">描述:</label>
<div class="gui-input-block">
<input type="text" name="ms" data-options="multiline:true" data-toggle="gui-textarea" style="width: 100%;height:66px">
</div>
</div>
</div>
<div class="gui-row" >
<div class="gui-col-sm12">
<label class="gui-form-label" for="">类型:</label>
<div class="gui-input-block">
<input type="text" name="type" style="width: 100%">
</div>
</div>
</div>
<div class="gui-row" style="display: inline-block;width: 50%">
<div class="gui-col-sm12">
<label class="gui-form-label" for="">URL:</label>
<div class="gui-input-block">
<input type="text" name="url" data-toggle="gui-textbox" style="width: 100%" disabled>
</div>
</div>
</div>
<div class="gui-row" style="display: inline-block;width:49.5%">
<div class="gui-col-sm12">
<label class="gui-form-label" for="">方法:</label>
<div class="gui-input-block">
<input type="text" name="method" style="width: 100%">
</div>
</div>
</div>
<div class="gui-row">
<div class="gui-col-sm12">
<label class="gui-form-label" for="">参数:</label>
<div class="gui-input-block">
<input type="text" name="data" data-options="multiline:true" data-toggle="gui-textarea" style="width: 100%;height:90px">
</div>
</div>
</div>
</div>
</div>
<div title="触发器" data-options="" style="display:none;">
<table class="trigger"></table>
</div>
<script>
$(function () {
var $dialog=$('#timerTimerEdit');
$dialog.find('input[name="type"]').iCombobox({textField: "text", valueField: "value", data: [{text: "sql查询", value: "1", selected: !0}, {text: "sql更新", value: "2"}, {text: "调用服务", value: "3"}, {text: "实时数据抽取", value: "4"}],height:30,
onSelect:function (data) {
$dialog.trigger("type.changed", data.value);
}});
$dialog.find('input[name="method"]').iCombobox({textField: "text", valueField: "value", data: [{text: "POST", value: "POST", selected: !0}, {text: "GET", value: "GET"}],height:30,disabled:true});
$dialog.on("type.changed",function (event, data) {
if(data=='3'){
$dialog.find('input[textboxname="method"]').combobox({'disabled':false});
$dialog.find('input[textboxname="url"]').textbox({'disabled':false});
}else{
$dialog.find('input[textboxname="method"]').combobox({'disabled':true});
$dialog.find('input[textboxname="url"]').textbox({'disabled':true});
}
});
/*触发器*/
$('#timer-tab').tabs({
onSelect:function(title){
}
});
$dialog.find(".trigger").datagrid({
columns:[[
{title: "触发器", field: "type",halign:"center", width:180},
{title: "详细情况", field: "desc",halign:"center", width: 630,},
{title:"状态",field:"status",halign:"center",width:100,formatter:function (value) {
var map={1:"正在运行",0:"停止"};
return map[value]||"";
}}
]],
pagination:false,
rownumbers:true,
singleSelect:true,
height:360,
toolbar:[{
iconCls: 'fa fa-plus',
text:"新建",
handler: function(){
createEle_trigger("creater_trigger",{"title":"新建触发器","tag":"add"}, $dialog.find(".trigger"));
}},{
iconCls: 'fa fa-pencil',
text:"编辑",
handler: function(){
var row=$dialog.find(".trigger").datagrid("getSelected");
if(row==undefined)return false;
createEle_trigger("creater_trigger",{"title":"新建触发器","tag":"edit"}, $dialog.find(".trigger"));
}
},'-',{
iconCls:'fa fa-trash',
text:'删除',
handler: function(){
var $fieldView=$dialog.find(".trigger");
var cols = $fieldView.datagrid('getRows');
var aa=[];
var selectrow=$fieldView.datagrid('getSelected');
if(selectrow == null){
return false;
}
var delIndex=$fieldView.edatagrid('getRowIndex',selectrow);
$.each(cols,function (i,col) {
if( i==delIndex){
if( cols[i]["flag"]!=null && cols[i]["flag"]=='I'){
} else {
cols[i]['flag'] = 'D';
aa.push(col);
}
}
});
if($fieldView.data("mxData")){
var bb=$fieldView.data("mxData");
$.each(aa,function (i,item) {
bb.push(item);
});
$fieldView.data("mxData",bb);
}else{
$fieldView.data("mxData", aa);
}
$fieldView.datagrid('deleteRow', delIndex);
$.each(cols,function (index, col) {
$fieldView.datagrid('updateRow',{
index:index,
row: {
xh: index+1
}
});
})
}
}]
});
if($dialog.attr("tag")!="add"){
HTTP.post("timer/timertask/query",{timerid:$('#timerTimerTable').datagrid("getSelected").id},function (result) {
if(result["success"]&&result["data"]["records"]){
$dialog.find(".trigger").datagrid("loadData",result["data"]["records"]);
}
})
}
function createEle_trigger(ele,opt,table) {
$('<div id="'+ele+'" style="position:relative">').iDialog({
title:opt.title,
width:960, height:360,
buttons: [{
text: '确认',
iconCls: 'fa fa-save',
btnCls: 'gui-btn-save',
handler: function (div) {
var getData=DataBind.collectData(ele);
var master={};
switch (getData['jldw']) {
case "year":master=getTimerData('year_',getData);master["desc"]="每"+master["year"]+"年的"+master["month"]+"月"+master["day"]+"日"+master["hour"]+"时"+master["minute"]+"分"+master["second"]+"秒"; break;
case "month":master=getTimerData('month_',getData);master["desc"]="每"+master["month"]+"月的"+master["day"]+"日"+master["hour"]+"时"+master["minute"]+"分"+master["second"]+"秒"; break;
case "week":master=getTimerData('week_',getData); master["desc"]="每"+master["week"]+"周的周"+master["day"]+master["hour"]+"时"+master["minute"]+"分"+master["second"]+"秒"; break;
case "day":master=getTimerData('day_',getData);master["desc"]="每"+master["day"]+"天的"+master["hour"]+"时"+master["minute"]+"分"+master["second"]+"秒"; break;
case "hour":master=getTimerData('hour_',getData); master["desc"]="每"+master["hour"]+"小时";break;
case "minute":master=getTimerData('minute_',getData);master["desc"]="每"+master["minute"]+"分钟";break;
case "second":master=getTimerData('second_',getData);master["desc"]="每"+master["second"]+"秒";break;
case "once":master['begintime']=getData['begintime_once'];break;
default:master=getTimerData(getData)
}
master['jldw']=getData['jldw'];
master['begintime']=getData['begintime'];
master['status']='1';
function getTimerData(pre,json) {
return {
year:json[pre+'year']||0,month:json[pre+'month']||0,day:json[pre+'day']||0,hour:json[pre+'hour']||0,week:json[pre+'week']||0,minute:json[pre+'minute']||0,second:json[pre+'second']||0
}
}
if(table){
master["type"]=master["jldw"];
if(opt.tag==="edit"){
table.datagrid("updateRow",{
index:table.datagrid("getRowIndex",table.datagrid("getSelected")),
row:master
});
}else{
master["flag"]="I";
table.datagrid("appendRow",master);
}
}
$('#'+ele).form("clear");
$('#'+ele).iDialog('destroy');
}
},{
text:'取消',
iconCls: "fa fa-close",
btnCls: "gui-btn-danger",
handler:function () {
$('#'+ele).iDialog('close');
}
}],
onOpen:function () {
var _content =' <div class="gui-fluid">\n' +
' <header>希望该任务何时开始?</header>\n' +
' <div class="gui-row">\n' +
' <div class="gui-col-sm12">\n' +
' <div>\n' +
' <div data-toggle="gui-radio" style="margin-left: 20px"> ' +
' <a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">\n' +
' <input type="radio" name="jldw" value="year" checked/>\n' +
' <label class="gui-form-label label-radio">年(Y)</label>\n' +
' </a>\n' +
' <a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">\n' +
' <input type="radio" name="jldw" value="month"/>\n' +
' <label class="gui-form-label label-radio">月(M)</label >\n' +
' </a>\n' +
' <a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">\n' +
' <input type="radio" name="jldw" value="week"/>\n' +
' <label class="gui-form-label label-radio">周(W)</label>\n' +
'\n' +
' </a>\n' +
' <a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">\n' +
' <input type="radio" name="jldw" value="day"/>\n' +
' <label class="gui-form-label label-radio">天(D)</label>\n' +
'\n' +
' </a>\n' +
' <a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">\n' +
' <input type="radio" name="jldw" value="hour" />\n' +
' <label class="gui-form-label label-radio">时(H)</label>\n' +
'\n' +
' </a>\n' +
' <a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">\n' +
' <input type="radio" name="jldw" value="minute"/>\n' +
' <label class="gui-form-label label-radio">分(N)</label>\n' +
'\n' +
' </a>\n' +
' <a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">\n' +
' <input type="radio" name="jldw" value="second"/>\n' +
' <label class="gui-form-label label-radio">秒(S)</label>\n' +
' </a>\n' +
' <a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">\n' +
' <input type="radio" name="jldw" value="once"/>\n' +
' <label class="gui-form-label label-radio" style="width: 88px">一次(O)</label>\n' +
' </a>' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' <hr>\n' +
' <div class="gui-row timer-content" style="margin-left: -40px;margin-top: 20px">\n' +
' <div class="gui-col-sm12">\n' +
' <label class="gui-form-label" for="">开始:</label>\n' +
' <div class="gui-input-block">\n' +
' <input type="text" name="begintime" data-options="" data-toggle="gui-datetimebox" style="width: 90%">\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' <article style="margin-left: -40px;margin-top: 30px;" class="timer-content">\n' +
' <label class="gui-form-label" for="">周期:</label>\n' +
' <div class="gui-row timer-year" style="margin-left: -90px;display: inline-block">\n' +
' <div class="gui-col-sm12">\n' +
' <label class="gui-form-label" for="">每</label>\n' +
' <div class="template-content">\n' +
' <!--每年-->\n' +
' <div class="gui-input-block template-year template">\n' +
' <input type="number" name="year_year" data-options="min:1,width:60" data-toggle="gui-numberbox" style="width: 60px" value="1">\n' +
' <label >年</label>\n' +
' <input type="text" name="year_month" data-options="" style="width: 80px">\n' +
' <label >月</label>\n' +
' <input type="text" name="year_day" data-options="" style="width: 80px">\n' +
' <label>日</label>\n' +
' <input type="number" name="year_hour" data-options="min:0, max:23,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>时</label>\n' +
' <input type="number" name="year_minute" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>分</label>\n' +
' <input type="number" name="year_second" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>秒</label>\n' +
' <label>执行一次</label>\n' +
' </div>\n' +
' <!--每月-->\n' +
' <div class="gui-input-block template-month template none">\n' +
' <input type="number" name="month_month" data-options="min:1,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label >月</label>\n' +
' <input type="text" name="month_day" data-options="" style="width: 80px">\n' +
' <label>日</label>\n' +
' <input type="number" name="month_hour" data-options="min:0, max:23,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>时</label>\n' +
' <input type="number" name="month_minute" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>分</label>\n' +
' <input type="number" name="month_second" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>秒</label>\n' +
' <label>执行一次</label>\n' +
' </div>\n' +
' <!--每周-->\n' +
' <div class="gui-input-block template-week template none">\n' +
' <input type="number" name="week_week" data-options="width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label >周</label>\n' +
' <label>周</label>\n' +
' <input type="text" name="week_day" data-options="" style="width: 80px">\n' +
' <input type="number" name="week_hour" data-options="min:0, max:23,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>时</label>\n' +
' <input type="number" name="week_minute" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>分</label>\n' +
' <input type="number" name="week_second" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>秒</label>\n' +
' <label>执行一次</label>\n' +
' </div>\n' +
' <!--每日-->\n' +
' <div class="gui-input-block template-day template none">\n' +
' <input type="number" name="day_day" data-options="width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>日</label>\n' +
' <input type="number" name="day_hour" data-options="min:0, max:23,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>时</label>\n' +
' <input type="number" name="day_minute" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>分</label>\n' +
' <input type="number" name="day_second" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>秒</label>\n' +
' <label>执行一次</label>\n' +
' </div>\n' +
' <!--每时-->\n' +
' <div class="gui-input-block template-hour template none">\n' +
' <input type="number" name="hour_hour" data-options="min:0,width:60" data-toggle="gui-numberbox" style="width: 60px">\n' +
' <label>时</label>\n' +
' <label>执行一次</label>\n' +
' </div>\n' +
' <!--每分-->\n' +
' <div class="gui-input-block template-minute template none">\n' +
' <input type="number" name="minute_minute" data-options="min:0,width:60" data-toggle="gui-numberbox" style="width: 60px"/>\n' +
' <label>分</label>\n' +
' <label>执行一次</label>\n' +
' </div>\n' +
' <!--每秒-->\n' +
' <div class="gui-input-block template-second template none">\n' +
' <input type="number" name="second_second" data-options="min:0,width:60" data-toggle="gui-numberbox" style="width: 60px"/>\n' +
' <label>秒</label>\n' +
' <label>执行一次</label>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </article>\n' +
' <div class="gui-row none timer-once" style="margin-left: -40px" >\n' +
' <div class="gui-col-sm12">\n' +
' <label class="gui-form-label" for="">执行时间:</label>\n' +
' <div class="gui-input-block">\n' +
' <input type="text" name="begintime_once" data-toggle="gui-datetimebox" data-options="width:600" style="width: 600px">\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </div>';
$(this).append( _content);
var dig=$('#'+ele);
ComboboBox.init(dig.find('input[name="year_month"]'),{textField: "text", valueField: "value",height:32,data:[
{text: "一", value: "1",selected:1}, {text: "二", value: "2"}, {text: "三", value: "3"}, {text:"四",value:"4"}, {text: "五", value: "5"},{text:"六",value:"6"},
{text: "七", value: "7"}, {text: "八", value: "8"}, {text: "九", value: "9"}, {text:"十",value:"10"}, {text: "十一", value: "11"},{text:"十二",value:"12"}
]});
var monthOption=createData(32);monthOption.push({value:'32',text:'月末'});
ComboboBox.init(dig.find('input[name="year_day"]'),{textField: "text", valueField: "value",height:32,
data: monthOption
});
$('#'+ele).on('click','.label-radio,.RadioA',function () {
var that=this;
var value=$(this).next('input').val();
if($(this)[0].tagName==='LABEL'){
value=$(this).parent().find('.RadioA').next('input').val();
that=$(this).parent().find('.RadioA');
}
$('#'+ele).find('.timer-once').css('display','none');
$('#'+ele).find('.timer-content').css('display','block');
switch (value) {
case "year":CreatYearElement(dig,$(that)); break;
case "month":CreatMonthElement(dig,$(that)); break;
case "week":CreatWeekElement(dig,$(that)); break;
case "day":CreatDayElement(dig,$(that)); break;
case "hour":CreatHourElement(dig,$(that)); break;
case "minute":CreatMinElement(dig,$(that));break;
case "second":CreatSecElement(dig,$(that));break;
case "once":CreatOncElement(dig,$(that));break;
default:CreatYearElement(dig,$(that))
}
});
/*编辑界面*/
var tag=opt.tag,selectedRow=table.datagrid("getSelected");
if((tag==="edit"||tag==="copy"||tag==='review')&&selectedRow){
var value=selectedRow["jldw"];
dig.find('input[name="begintime_once"]').val(selectedRow['begintime']);
dig.find('input[name="jldw"]').attr('checked',false);
dig.find('[value="'+value+'"]').prop('checked',true);
dig.find('[value="'+value+'"]').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-'+value).css('display','block');
switch (value) {
case "year": assignmentYearValue(value,selectedRow); break;
case "month": assignmentMonthValue(value,selectedRow); break;
case "week": assignmentWeekValue(value,selectedRow); break;
case "day":assignmentDayValue(value,selectedRow); break;
case "hour":assignmentHourValue(value,selectedRow);break;
case "minute":assignmentMinuteValue(value,selectedRow);break;
case "second":assignmentSecondValue(value,selectedRow);break;
case "once": assignmentOnceValue(value,selectedRow);break;
}
}
$(this).trigger(gui.eventType.initUI.form);
/*编辑-assign*/
function assignmentYearValue(vakle,s) {
dig.find('input[name='+vakle+'_year]').val(s['year']);
assignmentMonthValue(vakle,s);
}
function assignmentMonthValue(vakle,s) {
dig.find('input[name='+vakle+'_month]').val(s['month']);
dig.find('input[name='+vakle+'_day]').val(s['day']);
assignmentHourValue(vakle,s);
}
function assignmentWeekValue(vakle,s) {
dig.find('input[name='+vakle+'_week]').val(s['week']);
ComboboBox.init(dig.find('input[name="week_day"]'),{textField: "text", valueField: "value",
data: [{text: "日", value: "7", selected: !0}, {text: "一", value: "1"}, {text: "二", value: "2"},
{text: "三", value: "3"},{text:"四",value:"4"}, {text: "五", value: "5"},{text:"六",value:"6"}],height:32
});
dig.find('input[textboxname="week_day"]').combobox('setValue',s['day']);
assignmentHourValue(vakle,s);
}
function assignmentDayValue(vakle,s) {
dig.find('input[name='+vakle+'_day]').val(s['day']);
assignmentHourValue(vakle,s);
}
function assignmentHourValue(vakle,s) {
dig.find('input[name='+vakle+'_hour]').val(s['hour']);
assignmentMinuteValue(vakle,s);
}
function assignmentMinuteValue(vakle,s) {
dig.find('input[name='+vakle+'_minute]').val(s['minute']);
assignmentSecondValue(vakle,s);
}
function assignmentSecondValue(vakle,s) {
dig.find('input[name='+vakle+'_second]').val(s['second']);
}
function assignmentOnceValue(vakle,s) {
dig.find('.timer-content').css('display','none');
dig.find('.timer-once').css('display','block');
}
},
onClose: function () {
$(this).form("clear");
$(this).iDialog('destroy');
}
});
$('#'+ele).iDialog('open');
}
/*choose 计量单位*/
function CreatYearElement(dig,ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-year').css('display','block');
}
function CreatMonthElement(dig,ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-month').css('display','block');
var monthOption=createData(32);monthOption.push({value:'last',text:'月末'});
ComboboBox.init(dig.find('input[name="month_day"]'),{textField: "text", valueField: "value",height:32,
data: monthOption
});
}
function CreatWeekElement(dig,ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-week').css('display','block');
ComboboBox.init(dig.find('input[name="week_day"]'),{textField: "text", valueField: "value",
data: [{text: "日", value: "7", selected: !0}, {text: "一", value: "1"}, {text: "二", value: "2"},
{text: "三", value: "3"},{text:"四",value:"4"}, {text: "五", value: "5"},{text:"六",value:"6"}],height:30
});
}
function CreatDayElement(dig,ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-day').css('display','block');
}
function CreatHourElement(dig,ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-hour').css('display','block');
}
function CreatMinElement(dig,ele) {
dig.find('input[name="jldw"]').attr('checked',false);
ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-minute').css('display','block');
}
function CreatSecElement(dig,ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-second').css('display','block');
}
function CreatOncElement(dig,ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.timer-content').css('display','none');
dig.find('.timer-once').css('display','block');
}
/*循环计数*/
function createData(num) {
var arry=[];
for(var i=1;i<num;i++){
if(i==1){arry.push({
value:i+'',text:i+'',selected:1
})}else{
arry.push({
value:i+'',text:i+''
})
}
}
return arry;
}
})
</script>
\ No newline at end of file
<div id="timerTimer" class="gui-div">
<table class="toolbar-table" data-options="id: 'timerTimerTable',herf:'kzzx/gridset/query'">
</table>
<div id="timerTimerTable-toolbar" class="gui-toolbar" data-options="grid:{type:'datagrid',id:'timerTimerTable'}">
<div class="navbar-toolbar">
<a class="toolbar-reload toolbar" href="javascript:void(0)" style="display: none"></a>
<a class="toolbar-print toolbar" href="javascript:void(0)"></a>
<a class="toolbar-export toolbar" href="javascript:void(0)"></a>
<a class="toolbar-review toolbar" href="javascript:void(0)"></a>
<a class="toolbar-add toolbar" href="javascript:void(0)"></a>
<a class="toolbar-copy toolbar" href="javascript:void(0)"></a>
<a class="toolbar-edit toolbar" href="javascript:void(0)"></a>
<a class="toolbar-delete toolbar" href="javascript:void(0)"></a>
<a class="toolbar-setConfig toolbar" href="javascript:void(0)"></a>
</div>
<div class="form-sub" style="height: auto;">
<form action="" class="query-criteria">
<div class="toolbar-search-span"><a class="toolbar-search" href="javascript:void(0)"></a></div>
<ul><li>
<div style="display: inline-block">
<span class="query-criteria-inline">
<label >名称:</label><input type="text" name="mc" class="gui-textbox query-criteria-input">
</span>
<span class="query-criteria-inline">
<label >类型:</label><input type="text" name="type" style="width: 140px">
</span>
</div>
</li></ul>
</form>
</div>
</div>
</div>
<script>
$(function () {
var $div=$('#timerTimer');
$div.find('input[name="type"]').iCombobox({
valueField: 'value', textField: 'text',
data: [{text: "sql查询", value: "1"}, {text: "sql更新", value: "2"}, {text: "调用服务", value: "3"}, {text: "实时数据抽取", value: "4"}],
allowNull:true
});
var options={
url:'timer/timer',
queryParams:{
mc: $div.find('form input[name="mc"]').val(),
type: $div.find('form input[name="type"]').val()
},
columns:[[
{title: "id", field: "id", width: 160,hidden:true},
{title: "名称", field: "mc", width: 200},
{title: "描述", field: "ms", width: 600},
{title: "类型", field: "type", width: 160,hidden:false,formatter:function (value) {
var map = {"1": "sql查询", "2": "sql更新", "3": "调用服务", "4": "实时数据抽取"};
return map[value]|| value;
}},
{title: "URL", field: "url", width: 160,hidden:true},
{title: "参数", field: "data", width: 160,hidden:true},
{title:"调用方法",field:"method",width:200,hidden:true},
{title: "停用状态", field: "tybz", width: 60,align:'center'},
{title: "停用日期", field: "tyrq", width: 160,align:'center',fieldType:'ftDateTime'},
{title: "备注", field: "bz", width: 160},
{title: "维护人编码", field: "whrid", width: 160,hidden:true},
{title: "维护人", field: "whr", width: 160},
{title: "维护时间", field: "whsj", width: 1,fieldType:'ftDateTime'},
{title: "创建人编码", field: "cjrid", width: 160,hidden:true},
{title: "创建人", field: "cjr", width: 160,hidden:true},
{title: "创建时间", field: "cjsj", width: 1,hidden:true,fieldType:'ftDateTime'},
]],
dialog:{
id:'timerTimerEdit',
width: 960,
height: 500,
href:'timer/timer/edit',
addGroup:
[{text:'保存',url:'timer/timer/add',iconCls:'fa fa-plus',btnCls:'gui-btn-normal',handler:"parameterForm",
callback:function(){
var master=DataBind.collectData($('#timerTimerEdit'));
var _details=[];
var data=$("#timerTimerEdit").find(".trigger").datagrid("getData")["rows"];
_details.push({
id: 'TIMERTASK',
records: data||[]
});
return {
parmas:{master:master,details:_details}
};
},validate:function () {
var master=DataBind.collectData($('#timerTimerEdit'));
if(master['type']==3&&(master['method']==''||master['url']=='')){
gas.showWarning('url、method字段不允许为空')
return false;
}else if((master['type']==1||master['type']==2)&&master['data']==''){
gas.showWarning('sql类型的任务必须输入sql语句')
return false;
}
}}],
copyGroup:
{text:'保存',url:'timer/timer/add',iconCls:'fa fa-plus',handler:"parameterForm",btnCls:'gui-btn-save',
callback:function(){
var master=DataBind.collectData($('#timerTimerEdit'));
var _details=[];
var data=$("#timerTimerEdit").find(".trigger").datagrid("getData")["rows"];
_details.push({
id: 'TIMERTASK',
records: data||[]
});
if($("#timerTimerEdit").find(".trigger").data("mxData")&&$("#timerTimerEdit").find(".trigger").data("mxData").length>0){
$.each($("#timerTimerEdit").find(".trigger").data("mxData"),function (i,item) {
data.push(item);
});
}
return {
parmas:{master:master,details:_details}
};
},validate:function () {
var master=DataBind.collectData($('#timerTimerEdit'));
if(master['type']==3&&(master['method']==''||master['url']=='')){
gas.showWarning("url、method字段不允许为空")
return false;
}else if((master['type']==1||master['type']==2)&&master['data']==''){
gas.showWarning("sql类型的任务必须输入sql语句")
return false;
}
}},
editGroup:{text:'更新',url:'timer/timer/update',iconCls:'fa fa-plus',btnCls:'gui-btn-normal',
handler:"parameterForm",
callback:function(){
var master=DataBind.collectData($('#timerTimerEdit'));
var _details=[];
var data=$("#timerTimerEdit").find(".trigger").datagrid("getData")["rows"];
_details.push({
id: 'TIMERTASK',
records: data||[]
});
if($("#timerTimerEdit").find(".trigger").data("mxData")&&$("#timerTimerEdit").find(".trigger").data("mxData").length>0){
$.each($("#timerTimerEdit").find(".trigger").data("mxData"),function (i,item) {
data.push(item);
});
}
return {
parmas:{master:master,details:_details}
};
},validate:function () {
var master=DataBind.collectData($('#timerTimerEdit'));
if(master['type']==3&&(master['method']==''||master['url']=='')){
gas.showWarning("url、method字段不允许为空")
return false;
}else if((master['type']==1||master['type']==2)&&master['data']==''){
gas.showWarning("sql类型的任务必须输入sql语句")
return false;
}
}},
}
};
$div.Container(options);
$div.find(".toolbar-setConfig").iMenubutton({
text:"设置",
iconCls:"fa fa-cog",
event:"openDialog",
dialog:{
width: 400,
height: 220,
id:'timerlogConfig',
href:'timer/timer/config',
buttonsGroup:[{text:'确定',iconCls:'fa fa-check',btnCls:'gui-btn-save',handler:function(){
var getData=DataBind.collectData($("#timerlogConfig"));
HTTP.post("timer/timer/setTimer",{day:getData['day']},function (res) {
if(res["success"]){
$("#timerlogConfig").iDialog("destroy");
gas.showWarning("设置成功")
}else{
gas.showError(res,"设置失败")
}
});
}}]
}
})
});
</script>
<div class="gui-fluid editTable">
<input type="hidden" name="flag">
<input type="hidden" name="id" >
<div class="gui-row">
<div class="gui-col-sm12">
<label class="gui-form-label">消息模板:</label>
<div class="gui-input-block">
<input type="text" name="tmplid" data-toggle="gui-textbox">
</div>
<input type="hidden" name="id">
<input type="hidden" name="taskid">
</div>
</div>
</div>
<script>
$(function () {
var $div=$('#timerMsgConfig');
var $cbxTmpl = $div.find('input[name="tmplid"]');
var taskid=$div.iDialog("options").data.taskid;
$div.find("input[name='taskid']").val(taskid);
function paramInit(ops){
}
function pageInit() {
$cbxTmpl.iCombobox({valueField: "id", textField: "title", allowNull:true, allowEdit:false});
}
/*数据初始化*/
function dataInit(ops){
gas.post("timer/timertask/getTaskMsgTmpl",{taskid:taskid},function (res) {
if(res["success"]&&res["data"]["records"]&&res["data"]["records"].length > 0){
var selectedRow=res["data"]["records"][0];
$div.find("input[name='tmplid']").val(selectedRow.templetid);
$div.find("input[name='id']").val(selectedRow.id);
}
},ops);
gas.post("message/msgtemplet/queryMsgList",{},function (res) {
if(res["success"]&&res["data"]["records"]){
$cbxTmpl.combobox("loadData",res["data"]["records"])
}
},ops);
}
function run(res){
}
gas.load(paramInit,pageInit,dataInit,run);
})
</script>
<style>
#timertaskTimerEdit header{
margin: 20px 0 10px 10px;
color: #666666;
}
#timertaskTimerEdit .label-radio{
padding:5px 30px 5px 0;width:68px;
}
#timertaskTimerEdit .label-radioo{
padding:5px 30px 5px 0;width:50px;
}
#timertaskTimerEdit .template input{
text-align: center
}
</style>
<div class="gui-fluid">
<p>1.选择任务</p>
<div class="gui-row">
<div class="gui-input-block">
<input type="text" name="timerid" data-options="required:true" class="gui-textbox" data-title="mc" style="width: 100%">
<input type="hidden" name="mc">
</div>
</div>
<p>2.希望该任务何时开始?</p>
<div class="gui-row">
<div class="gui-col-sm12">
<div>
<div data-toggle="gui-radio" style="margin-left: 20px">
<a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">
<input type="radio" name="jldw" value="year" checked/>
<label class="gui-form-label label-radio">年(Y)</label>
</a>
<a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">
<input type="radio" name="jldw" value="month"/>
<label class="gui-form-label label-radio">月(M)</label >
</a>
<a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">
<input type="radio" name="jldw" value="week"/>
<label class="gui-form-label label-radio">周(W)</label>
</a>
<a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">
<input type="radio" name="jldw" value="day"/>
<label class="gui-form-label label-radio">天(D)</label>
</a>
<a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">
<input type="radio" name="jldw" value="hour" />
<label class="gui-form-label label-radio">时(H)</label>
</a>
<a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">
<input type="radio" name="jldw" value="minute"/>
<label class="gui-form-label label-radio">分(N)</label>
</a>
<a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">
<input type="radio" name="jldw" value="second"/>
<label class="gui-form-label label-radio">秒(S)</label>
</a>
<a href="javascript:void(0)" style="display: inline-block" class="radio-gruop">
<input type="radio" name="jldw" value="once"/>
<label class="gui-form-label label-radio" style="width: 88px">一次(O)</label>
</a>
</div>
</div>
</div>
</div>
<hr>
<div class="gui-row timer-content" style="margin-left: -40px;margin-top: 20px">
<div class="gui-col-sm12">
<label class="gui-form-label" for="">开始:</label>
<div class="gui-input-block">
<input type="text" name="begintime" data-options="" data-toggle="gui-datetimebox" style="width: 90%">
</div>
</div>
</div>
<article style="margin-left: -40px;margin-top: 30px;" class="timer-content">
<label class="gui-form-label" for="">周期:</label>
<div class="gui-row timer-year" style="margin-left: -90px;display: inline-block">
<div class="gui-col-sm12">
<label class="gui-form-label" for=""></label>
<div class="template-content">
<!--每年-->
<div class="gui-input-block template-year template">
<input type="number" name="year_year" data-options="min:1,width:60" data-toggle="gui-numberbox" style="width: 60px" value="1">
<label ></label>
<input type="text" name="year_month" data-options="" style="width: 80px">
<label ></label>
<input type="text" name="year_day" data-options="" style="width: 80px">
<label></label>
<input type="number" name="year_hour" data-options="min:0, max:23,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<input type="number" name="year_minute" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<input type="number" name="year_second" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<label>执行一次</label>
</div>
<!--每月-->
<div class="gui-input-block template-month template none">
<input type="number" name="month_month" data-options="min:1,width:60" value="1" data-toggle="gui-numberbox" style="width: 60px">
<label ></label>
<input type="text" name="month_day" data-options="" style="width: 80px">
<label></label>
<input type="number" name="month_hour" data-options="min:0, max:23,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<input type="number" name="month_minute" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<input type="number" name="month_second" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<label>执行一次</label>
</div>
<!--每周-->
<div class="gui-input-block template-week template none">
<input type="number" name="week_week" data-options="width:60" value="1" data-toggle="gui-numberbox" style="width: 60px">
<label ></label>
<label></label>
<input type="text" name="week_day" data-options="" style="width: 80px">
<input type="number" name="week_hour" data-options="min:0, max:23,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<input type="number" name="week_minute" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<input type="number" name="week_second" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<label>执行一次</label>
</div>
<!--每日-->
<div class="gui-input-block template-day template none">
<input type="number" name="day_day" data-options="width:60" value="1" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<input type="number" name="day_hour" data-options="min:0, max:23,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<input type="number" name="day_minute" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<input type="number" name="day_second" data-options="min:0, max:59,width:60" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<label>执行一次</label>
</div>
<!--每时-->
<div class="gui-input-block template-hour template none">
<input type="number" name="hour_hour" data-options="min:0,width:60" value="1" data-toggle="gui-numberbox" style="width: 60px">
<label></label>
<label>执行一次</label>
</div>
<!--每分-->
<div class="gui-input-block template-minute template none">
<input type="number" name="minute_minute" data-options="min:0,width:60" value="1" data-toggle="gui-numberbox" style="width: 60px"/>
<label></label>
<label>执行一次</label>
</div>
<!--每秒-->
<div class="gui-input-block template-second template none">
<input type="number" name="second_second" data-options="min:0,width:60" value="1" data-toggle="gui-numberbox" style="width: 60px"/>
<label></label>
<label>执行一次</label>
</div>
</div>
</div>
</div>
</article>
<div class="gui-row none timer-once" style="margin-left: -40px" >
<div class="gui-col-sm12">
<label class="gui-form-label" for="">执行时间:</label>
<div class="gui-input-block">
<input type="text" name="begintime_once" data-options="width: 600" data-toggle="gui-datetimebox" style="width: 600px">
</div>
</div>
</div>
<p>3.是否需要该任务记录日志?</p>
<div class="gui-row">
<div class="gui-input-block" data-toggle="gui-checkbox" data-options="label:'记录日志'">
<input type="checkbox" name="needlog" style="width: 100%" >
</div>
</div>
</div>
<script>
$(function () {
var dig=$('#timertaskTimerEdit');
var selectedRow=$('#timertaskTimerTable').datagrid('getSelected');
var $txtTimer=dig.find('input[name="timerid"]');
Auxiliary.whbox($txtTimer,{callback:function () {
var columns=[
{title: "id", field: "id", width: 160,hidden:true},
{title: "名称", field: "mc", width: 80},
{title: "描述", field: "ms", width: 200},
{title: "类型", field: "type", width: 160,hidden:true},
{title: "URL", field: "url", width: 160,hidden:true},
{title: "参数", field: "data", width: 160,hidden:true},
{title:"调用方法",field:"method",width:200,hidden:true},
{title: "停用状态", field: "tybz", width: 60,align:'center',fieldType:"tybz"},
{title: "停用日期", field: "tyrq", width: 160,align:'center',fieldType:'ftDateTime'}];
var config={
title:'已定义任务',columns:new $.common.formatterCol(columns),url: "timer/timer/query",parmas:{}
};
Appent.choose(config, function (row) {
if(row){
dig.find('input[textboxname="timerid"]').textbox('setValue',row['id']);
dig.find('input[textboxname="timerid"]').textbox('setText',row['mc']);
}
});
}})
dig.find('input[name="year_month"]').iCombobox({textField: "text", valueField: "value",height:32,data:[
{text: "一", value: "1",selected:1}, {text: "二", value: "2"}, {text: "三", value: "3"}, {text:"四",value:"4"}, {text: "五", value: "5"},{text:"六",value:"6"},
{text: "七", value: "7"}, {text: "八", value: "8"}, {text: "九", value: "9"}, {text:"十",value:"10"}, {text: "十一", value: "11"},{text:"十二",value:"12"}
]});
var monthOption=createData(32);monthOption.push({value:'32',text:'月末'});
dig.find('input[name="year_day"]').iCombobox({textField: "text", valueField: "value",height:32,
data: monthOption
});
/* dig.find('.search').unbind().bind('click',function () {
});*/
dig.on('click','.label-radio,.RadioA',function () {
var that=this;
var value=$(this).next('input').val();
if($(this)[0].tagName==='LABEL'){
value=$(this).parent().find('.RadioA').next('input').val();
that=$(this).parent().find('.RadioA');
}
dig.find('.timer-once').css('display','none');
dig.find('.timer-content').css('display','block');
switch (value) {
case "year":CreatYearElement($(that)); break;
case "month":CreatMonthElement($(that)); break;
case "week":CreatWeekElement($(that)); break;
case "day":CreatDayElement($(that)); break;
case "hour":CreatHourElement($(that)); break;
case "minute":CreatMinElement($(that));break;
case "second":CreatSecElement($(that));break;
case "once":CreatOncElement($(that));break;
default:CreatYearElement($(that))
}
});
/*编辑界面*/
var tag=dig.attr('tag');
if((tag==="edit"||tag==="copy"||tag==='review')&&selectedRow){
var value=selectedRow["jldw"];
dig.find('input[name="begintime_once"]').val(selectedRow['begintime']);
dig.find('input[name="jldw"]').attr('checked',false);
dig.find('[value="'+value+'"]').prop('checked',true);
dig.find('[value="'+value+'"]').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-'+value).css('display','block');
switch (value) {
case "year": assignmentYearValue(value,selectedRow); break;
case "month": assignmentMonthValue(value,selectedRow); break;
case "week": assignmentWeekValue(value,selectedRow); break;
case "day":assignmentDayValue(value,selectedRow); break;
case "hour":assignmentHourValue(value,selectedRow);break;
case "minute":assignmentMinuteValue(value,selectedRow);break;
case "second":assignmentSecondValue(value,selectedRow);break;
case "once": assignmentOnceValue(value,selectedRow);break;
}
}
/*编辑-assign*/
function assignmentYearValue(vakle,s) {
dig.find('input[name='+vakle+'_year]').val(s['year']);
assignmentMonthValue(vakle,s);
}
function assignmentMonthValue(vakle,s) {
dig.find('input[name='+vakle+'_month]').val(s['month']);
dig.find('input[name='+vakle+'_day]').val(s['day']);
assignmentHourValue(vakle,s);
}
function assignmentWeekValue(vakle,s) {
dig.find('input[name='+vakle+'_week]').val(s['week']);
dig.find('input[comboname="week_day"]').combobox('setValue',s['day']);
assignmentHourValue(vakle,s);
}
function assignmentDayValue(vakle,s) {
dig.find('input[name='+vakle+'_day]').val(s['day']);
assignmentHourValue(vakle,s);
}
function assignmentHourValue(vakle,s) {
dig.find('input[name='+vakle+'_hour]').val(s['hour']);
assignmentMinuteValue(vakle,s);
}
function assignmentMinuteValue(vakle,s) {
dig.find('input[name='+vakle+'_minute]').val(s['minute']);
assignmentSecondValue(vakle,s);
}
function assignmentSecondValue(vakle,s) {
dig.find('input[name='+vakle+'_second]').val(s['second']);
}
function assignmentOnceValue(vakle,s) {
dig.find('.timer-content').css('display','none');
dig.find('.timer-once').css('display','block');
}
/*choose 计量单位*/
function CreatYearElement(ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-year').css('display','block');
}
function CreatMonthElement(ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-month').css('display','block');
var monthOption=createData(32);monthOption.push({value:'last',text:'月末'});
ComboboBox.init(dig.find('input[name="month_day"]'),{textField: "text", valueField: "value",height:32,
data: monthOption
});
}
function CreatWeekElement(ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-week').css('display','block');
ComboboBox.init(dig.find('input[name="week_day"]'),{textField: "text", valueField: "value",
data: [{text: "日", value: "7", selected: !0}, {text: "一", value: "1"}, {text: "二", value: "2"},
{text: "三", value: "3"},{text:"四",value:"4"}, {text: "五", value: "5"},{text:"六",value:"6"}],height:32
});
}
function CreatDayElement(ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-day').css('display','block');
}
function CreatHourElement(ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-hour').css('display','block');
}
function CreatMinElement(ele) {
dig.find('input[name="jldw"]').attr('checked',false);
ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-minute').css('display','block');
}
function CreatSecElement(ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.template').css('display','none');
dig.find('.template-second').css('display','block');
}
function CreatOncElement(ele) {
dig.find('input[name="jldw"]').attr('checked',false);ele.next('input').attr('checked',true);
dig.find('.timer-content').css('display','none');
dig.find('.timer-once').css('display','block');
}
/*循环计数*/
function createData(num) {
var arry=[];
for(var i=1;i<num;i++){
if(i==1){arry.push({
value:i+'',text:i+'',selected:1
})}else{
arry.push({
value:i+'',text:i+''
})
}
}
return arry;
}
})
</script>
<div id="timertaskTimer" class="gui-div">
<table class="toolbar-table" data-options="id: 'timertaskTimerTable',herf:'kzzx/gridset/query'">
</table>
<div id="timertaskTimerTable-toolbar" class="gui-toolbar" data-options="grid:{type:'datagrid',id:'timertaskTimerTable'}">
<div class="navbar-toolbar">
<a class="toolbar-reload toolbar" href="javascript:void(0)" style="display: none"></a>
<a class="toolbar-print toolbar" href="javascript:void(0)"></a>
<a class="toolbar-export toolbar" href="javascript:void(0)"></a>
<a class="toolbar-review toolbar" href="javascript:void(0)"></a>
<a class="toolbar-add toolbar" href="javascript:void(0)"></a>
<a class="toolbar-copy toolbar" href="javascript:void(0)"></a>
<a class="toolbar-edit toolbar" href="javascript:void(0)"></a>
<a class="toolbar-delete toolbar" href="javascript:void(0)"></a>
<a class="toolbar-timertaskRun toolbar" href="javascript:void(0)"></a>
<a class="toolbar-timertaskStop toolbar" href="javascript:void(0)"></a>
<a class="toolbar-timertaskExec toolbar" href="javascript:void(0)"></a>
<a class="toolbar-timerMsgUser toolbar" href="javascript:void(0)"></a>
<a class="toolbar-setConfig toolbar" href="javascript:void(0)"></a>
<a class="toolbar-journal toolbar" href="javascript:void(0)"></a>
</div>
<div class="form-sub" style="height: auto;">
<form action="" class="query-criteria">
<div class="toolbar-search-span"><a class="toolbar-search" href="javascript:void(0)"></a></div>
<ul><li>
<div style="display: inline-block">
<span class="query-criteria-inline">
<label >预警事务名称:</label><input type="text" name="mc" class="gui-textbox query-criteria-input">
</span>
</div>
</li></ul>
</form>
</div>
</div>
</div>
<script>
$(function () {
var $div=$('#timertaskTimer');
$div.find('.toolbar-journal').iMenubutton({
text:'查看日志',
iconCls:'fa fa-eye',
onClick:journal
});
function journal(){
let n = $div.find('.toolbar-table').treegrid("getSelected")
if(n==null){alert("无法操作!");return 0}
HTTP.post('timer/timerlog/query',{
taskid:n.id,
start:n.begintime,
end:n.nexttime
},function (result) {
if(result["success"])
{
if(result.data.total)
{
gas.Dialog({
width:680,
height:400,
title:"查看日志",
href:"timer/timertask/log",
onBeforeLoad:function () {
$(this).dialog("options").queryParams={
taskid:n.id,
start:n.begintime,
end:n.nexttime
}
},
regResultHandler:function(el){
}
})
}
else{
gas.showWarning("暂无日志!")
}
}else{
gas.showError(result,"处理失败")
}
})
}
var options={
url:'timer/timertask',
queryParams:{
mc: $div.find('form input[name="mc"]').val()
},
columns:[[
{title: "id", field: "id", width: 160,hidden:true},
{title: "预警事务ID", field: "timerid", width: 160,hidden:true},
{title: "序号", field: "xh", width: 60, hidden:true},
{title: "标题", field: "mc", width: 160},
{title: "描述", field: "desc", width: 300,},
{title:"状态", field:"status",width:100,formatter:function (value) {
var map={1:"正在运行",0:"停止"};
return map[value]||"";
}},
{title: "执行方式", field:"jldw",width:200,hidden:true},
{title: "开始时间", field:"begintime",width:200,hidden:true},
{title: "上次执行时间", field:"pretime", fieldType:'ftDateTime'},
{title: "下次执行时间", field:"nexttime", fieldType:'ftDateTime'},
{title: "执行结果", field:"result",width:200},
{title: "备注", field: "bz", width: 300},
{title: "维护人编码", field: "whrid", hidden:true},
{title: "维护人", field: "whr"},
{title: "维护时间", field: "whsj", fieldType:'ftDateTime'},
{title: "创建人编码", field: "cjrid", hidden:true},
{title: "创建人", field: "cjr",hidden:true},
{title: "创建时间", field: "cjsj", hidden:true, fieldType:'ftDateTime'}
]],
dialog:{
id:'timertaskTimerEdit',
width: 960,
height: 480,
href:'timer/timertask/edit',
addGroup:[
{text:'保存',url:'timer/timertask/add',iconCls:'fa fa-plus',btnCls:'gui-btn-normal',handler:"parameterForm",
callback:function(){
var getData=DataBind.collectData($('#timertaskTimerEdit'));
var master={};
switch (getData['jldw']) {
case "year":master=getTimerData('year_',getData); break;
case "month":master=getTimerData('month_',getData); break;
case "week":master=getTimerData('week_',getData); break;
case "day":master=getTimerData('day_',getData); break;
case "hour":master=getTimerData('hour_',getData); break;
case "minute":master=getTimerData('minute_',getData);break;
case "second":master=getTimerData('second_',getData);break;
case "once":master['begintime']=getData['begintime_once'];break;
default:master=getTimerData(getData)
}
master['begintime']=getData['begintime'];
master['jldw']=getData['jldw'];
master['timerid']=getData['timerid'];
master['needlog']=getData['needlog'];
master['status']='1';
return {
parmas:{master:master,details:[]}
};
}
}],
copyGroup:
{text:'保存',url:'timer/timertask/add',iconCls:'fa fa-plus',handler:"parameterForm",btnCls:'gui-btn-save',
callback:function(){
var getData=DataBind.collectData($('#timertaskTimerEdit'));
var master={};
switch (getData['jldw']) {
case "year":master=getTimerData('year_',getData); break;
case "month":master=getTimerData('month_',getData); break;
case "week":master=getTimerData('week_',getData); break;
case "day":master=getTimerData('day_',getData); break;
case "hour":master=getTimerData('hour_',getData); break;
case "minute":master=getTimerData('minute_',getData);break;
case "second":master=getTimerData('second_',getData);break;
case "once":master['begintime']=getData['begintime_once'];break;
default:master=getTimerData(getData)
}
master['begintime']=getData['begintime'];
master['jldw']=getData['jldw'];
master['timerid']=getData['timerid'];
master['needlog']=getData['needlog'];
master['status']='1';
return {
parmas:{master:master,details:[]}
};
}
},
editGroup:{text:'更新',url:'timer/timertask/update',iconCls:'fa fa-plus',btnCls:'gui-btn-normal',
handler:"parameterForm",
callback:function(){
var getData=DataBind.collectData($('#timertaskTimerEdit'));
var master={};
switch (getData['jldw']) {
case "year":master=getTimerData('year_',getData); break;
case "month":master=getTimerData('month_',getData); break;
case "week":master=getTimerData('week_',getData); break;
case "day":master=getTimerData('day_',getData); break;
case "hour":master=getTimerData('hour_',getData); break;
case "minute":master=getTimerData('minute_',getData);break;
case "second":master=getTimerData('second_',getData);break;
case "once":master['begintime']=getData['begintime_once'];break;
default:master=getTimerData(getData)
}
master['begintime']=getData['begintime'];
master['jldw']=getData['jldw'];
master['timerid']=getData['timerid'];
master['needlog']=getData['needlog'];
master['begintime']=getData['begintime'];
master=$.extend({},$('#timertaskTimerTable').datagrid('getSelected'),master);
master['status']='1';
return {
parmas:{master:master,details:[]}
};
}
}
}
};
$div.Container(options);
$div.find(".toolbar-timertaskRun").iMenubutton({
text:"启动",
iconCls:'fa fa-rocket',
onClick:function () {
var slectedRow=$div.find(".toolbar-table").datagrid("getSelected");
var index=$div.find(".toolbar-table").datagrid('getRowIndex',slectedRow);
if(!slectedRow){
gas.showWarning('请选择一条事务进行操作')
return false;
}
HTTP.post('timer/timertask/start',slectedRow,function (result) {
if(result["success"]){
HTTP.post("timer/timertask/query",{id:slectedRow['id']},function (res) {
if(res["success"]&&res["data"]["records"]){
$div.find(".toolbar-table").datagrid('updateRow',{
index:index,
row:res["data"]["records"][0]
});
}
})
gas.showTips("操作成功")
}else{
gas.showError(result,"操作失败")
}
})
}
});
$div.find(".toolbar-timertaskStop").iMenubutton({
text:"停止",
iconCls:'fa fa-stop',
onClick:function () {
var slectedRow=$div.find(".toolbar-table").datagrid("getSelected");
var index=$div.find(".toolbar-table").datagrid('getRowIndex',slectedRow);
if(!slectedRow){
gas.showWarning("请选择一条事务进行操作")
return false;
}
HTTP.post('timer/timertask/stop',slectedRow,function (result) {
if(result["success"]){
HTTP.post("timer/timertask/query",{id:slectedRow['id']},function (res) {
if(res["success"]&&res["data"]["records"]){
$div.find(".toolbar-table").datagrid('updateRow',{
index:index,
row:res["data"]["records"][0]
});
}
})
gas.showTips("操作成功")
}else{
gas.showError(result,"操作失败")
}
})
}
});
function getTimerData(pre,json) {
return {
year:json[pre+'year']||0,month:json[pre+'month']||0,day:json[pre+'day']||0,hour:json[pre+'hour']||0,week:json[pre+'week']||0,minute:json[pre+'minute']||0,second:json[pre+'second']||0
}
}
$div.find(".toolbar-timertaskExec").iMenubutton({
text:"立即执行",
iconCls:'fa fa-stop',
onClick:function () {
var slectedRow=$div.find(".toolbar-table").datagrid("getSelected");
var index=$div.find(".toolbar-table").datagrid('getRowIndex',slectedRow);
if(!slectedRow){
gas.showWarning("请选择一条事务进行操作")
return false;
}
gas.confirm("确定要立即执行吗?", function(r){
if (r){
HTTP.post('timer/timertask/exec',slectedRow,function (result) {
if(result["success"]){
HTTP.post("timer/timertask/query",{id:slectedRow['id']},function (res) {
if(res["success"]&&res["data"]["records"]){
$div.find(".toolbar-table").datagrid('updateRow',{
index:index,
row:res["data"]["records"][0]
});
}
})
gas.showTips("操作成功")
}else{
gas.showError(result,"操作失败")
}
})
}
})
}
});
$div.find(".toolbar-timerMsgUser").iMenubutton({
text:"消息通知人员",
iconCls:"fa fa-cloud-upload",
dialog:{
width: 500,
height:600,
title:"消息通知人员",
footerIn:true,
url:true,
href:"timer/timertask/msgUserIndex",
messager:function () {
var s=$div.find(".toolbar-table").datagrid("getSelected");
if(!s){
gas.showTipsWarning("请选择一条数据");
return true
}
},
onBeforeLoad:function () {
var s=$div.find(".toolbar-table").datagrid("getSelected");
if(!s){
gas.showTipsWarning("请选择一条数据");
return false
}
$(this).dialog("options").queryParams={
taskid:s.id||''
};
},
onSaveCallback:function (opt,res) {
// $datagrid.datagrid("reload",DataBind.collectData($div))
}
}
});
$div.find(".toolbar-setConfig").iMenubutton({
text:"消息模板设置",
iconCls:"fa fa-cog",
event:"openDialog",
dialog:{
width: 400,
height: 220,
id:'timerMsgConfig',
href:'timer/timertask/msgConfigIndex',
onBeforeLoad:function () {
var s=$div.find(".toolbar-table").datagrid("getSelected");
if(!s){
gas.showTipsWarning("请选择一条数据");
return false
}
$(this).dialog("options").data={taskid:s.id};
},
buttonsGroup:[{text:'确定',iconCls:'fa fa-check',btnCls:'gui-btn-save',handler:function(){
var getData=DataBind.collectData($("#timerMsgConfig"));
HTTP.post("timer/timertask/saveTaskMsgTmpl",{id:getData['id'],tmplid:getData['tmplid'],taskid:getData['taskid']},function (res) {
if(res["success"]){
$("#timerMsgConfig").iDialog("destroy");
gas.showTips("设置成功")
}else{
gas.showError(res,"设置失败")
}
});
}}]
}
})
});
</script>
<div id="watchrz" class="gui-div ">
<table class="toolbar-table" >
</table>
</div>
<script type="text/javascript">
var $dialog=$('#watchrz');
var params=$dialog.closest(".panel-body").iDialog("options").queryParams;
let rzoptions={
url:'timer/timerlog',
queryParams:{
taskid:params.taskid,
start:params.id,
end:params.id
},
columns:[[
{title: "创建人", field: "cjr"},
{title: "创建人编码", field: "cjrid"},
{title: "创建时间", field: "cjsj", fieldType:'ftDateTime',hidden:true},
{title:"IP",field:"ip",hidden:true},
{title: "预警事务设置ID", field: "taskid",width:300,hidden:true},
{title: "开始时间", field: "kssj", fieldType:'ftDateTime'},
{title: "结束时间", field: "jssj", fieldType:'ftDateTime'},
{title:"计算机名称",field:"host",hidden:true},
{title: "执行日志", field: "log"},
]],
}
$("#watchrz").Holder(rzoptions)
</script>
\ No newline at end of file
<div id="timerMsgUser" class="e-dialog-container">
<div class="e-dialog-body">
<div class="mx-dataTable" style="bottom:0px">
<div id="msgTimerUserEditList-toolbar" class="gui-toolbar" data-options="grid:{type:'datagrid',id:'msgTimerUserEditList'}">
<a class="toolbar-impuser toolbar" href="javascript:void(0)"></a>
<a class="toolbar-deleteRow toolbar" data-event="delete" href="javascript:void(0)"></a>
</div>
<table id="msgTimerUserList" data-options="dgid:'MsgTimerUser'" style="height: 100%;width: 100%"></table>
</div>
</div>
<div class="e-dialog-footer">
<!--<a href="javascript:void(0);" class="e-dialog-ok"></a>-->
<a href="javascript:void(0);" class="e-dialog-cancel"></a>
</div>
</div>
<script>
$(function () {
var $div=$("#timerMsgUser");
var $fieldView=$("#msgTimerUserList");
var $toolbar=$("#msgTimerUserEditList-toolbar");
$toolbar.show();
var queryUrl = 'timer/timerMsgUser/queryTaskMsgUser';
// var $div=$div.parent("form"),params=$div.parent("form").dialog("options").queryParams, queryUrl = 'timer/timerMsgUser/queryTaskMsgUser';
var params=$div.parents("form").dialog("options").queryParams;
var columns = [
{title: "timerUserId", field: "timerUserId", fieldType: "ftString",hidden:true},
{title: "用户编码", field: "code", fieldType: "ftString",width:80},
{title: "用户名称", field: "name", fieldType: "ftString",width:120}
];
$fieldView.datagrid({
fitColumns:true,
columns:[new $.common.formatterCol(columns)],
pagination:false
})
loadQuery(params,queryUrl);
function loadQuery(params,url) {
HTTP.post(url,params,function (result) {
if(result["success"]){
$fieldView.datagrid("loadData",result.data.records||[])
}
})
}
function pageInit() {
$toolbar.find(".toolbar-impuser").iMenubutton({
text:"导入人员",
iconCls: 'fa fa-plus',
onClick:function () {
Userbox.dialog({
url: "timer/timerMsgUser/queryCanImpMsgUser",
title: "导入用户",
data:{taskid:params.taskid},
save: function(res){
HTTP.post("timer/timerMsgUser/importMsgUser",{taskid:params.taskid,userList:res},function (result) {
if(result.success){
gas.showTips("导入成功");
loadQuery(params,queryUrl);
}else {
gas.showTipsError(result.message||"导入失败");
}
})
},
});
}
});
$toolbar.find(".toolbar-deleteRow").iMenubutton({
text:"删除",
iconCls:"fa fa-trash",
onClick:function () {
var selectedRow=$fieldView.datagrid('getSelected');
if(selectedRow==null){
gas.showWarning("请选中一条数据进行删除")
return false;
}
gas.confirm("是否执行该操作",function () {
HTTP.post('timer/timerMsgUser/delTimerMsgUser',{id:selectedRow.timerUserId},function (result) {
if(result['success']){
var index=$fieldView.datagrid("getRowIndex",selectedRow);
$fieldView.datagrid("deleteRow",index);
}else{
gas.showError(result,"删除失败,请重新操作!")
}
})
})
}
});
}
function dataInit(){
}
function run(){
loadQuery(params,queryUrl);
}
gas.load(pageInit,dataInit,run);
})
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment