You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
113
addons/cron/view/admin/crons.js
Executable file
113
addons/cron/view/admin/crons.js
Executable file
@ -0,0 +1,113 @@
|
||||
var mmg;
|
||||
function initGrid(){
|
||||
var h = WST.pageHeight();
|
||||
var cols = [
|
||||
{title:'计划任务名称', name:'cronName', width: 80},
|
||||
{title:'计划任务描述', name:'cronDesc', width: 150},
|
||||
{title:'上次执行时间', name:'runTime', width: 70, renderer: function(val,item,rowIndex){
|
||||
return (item['runTime']==0)?'-':item['runTime'];
|
||||
}},
|
||||
{title:'执行状态', name:'isEnable', width: 20, renderer: function(val,item,rowIndex){
|
||||
return (item['isRunSuccess']==1)?'<span class="statu-yes"><i class="fa fa-check-circle"></i> 成功</span>':'<span class="statu-no"><i class="fa fa-times-circle"></i> 失败</span>';
|
||||
}},
|
||||
{title:'下次执行时间', name:'nextTime', width: 70, renderer: function(val,item,rowIndex){
|
||||
return (item['nextTime']==0)?'-':item['nextTime'];
|
||||
}},
|
||||
{title:'作者', name:'auchor', width: 20, renderer: function(val,item,rowIndex){
|
||||
return '<a href="'+item['authorUrl']+'" target="_blank">'+item['author']+'</a>';
|
||||
}},
|
||||
{title:'计划状态', name:'isEnable', width: 20, renderer: function(val,item,rowIndex){
|
||||
return (item['isEnable']==1)?'<span class="statu-yes"><i class="fa fa-check-circle"></i> 启用</span>':'<span class="statu-wait"><i class="fa fa-ban"></i> 停用</span>';
|
||||
}},
|
||||
{title:'操作', name:'' ,width:120, align:'center', renderer: function(val,item,rowIndex){
|
||||
var h="";
|
||||
if(WST.GRANT.CRON_JHRW_04){
|
||||
h += "<a class='btn btn-blue' href='javascript:toEdit(" + item['id'] + ")'><i class='fa fa-pencil'></i>修改</a> ";
|
||||
if(item['isEnable']==0){
|
||||
h += "<a class='btn btn-green' href='javascript:changgeEnableStatus(" + item['id'] + ",1)'><i class='fa fa-check'></i>启用</a> ";
|
||||
}else{
|
||||
h += "<a class='btn btn-red' href='javascript:changgeEnableStatus(" + item['id'] + ",0)'><i class='fa fa-ban'></i>停用</a> ";
|
||||
h += '<a class="btn btn-blue" href="javascript:run(\'' + item['id'] + '\')"><i class="fa fa-refresh"></i>执行</a>';
|
||||
}
|
||||
|
||||
}
|
||||
return h;
|
||||
}}
|
||||
];
|
||||
|
||||
mmg = $('.mmg').mmGrid({height: h-115,indexCol: true, cols: cols,method:'POST',
|
||||
url: WST.AU('cron://cron/pageQuery'), fullWidthRows: true, autoLoad: true,
|
||||
plugins: [
|
||||
$('#pg').mmPaginator({})
|
||||
]
|
||||
});
|
||||
$('#headTip').WSTTips({width:90,height:35,callback:function(v){
|
||||
var diff = v?115:88;
|
||||
mmg.resize({height:h-diff})
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
function toEdit(id){
|
||||
location.href=WST.AU('cron://cron/toEdit','id='+id);
|
||||
}
|
||||
function checkType(v){
|
||||
$('.cycle').hide();
|
||||
$('.cycle'+v).show();
|
||||
}
|
||||
function run(id){
|
||||
var box = WST.confirm({content:'你确定要执行该任务吗?',yes:function(){
|
||||
var loading = WST.msg('正在执行计划任务,请稍后...',{icon: 16,time:6000000000});
|
||||
$.post(WST.AU('cron://cron/runCron'),{id:id},function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg(json.msg,{icon:1});
|
||||
layer.close(box);
|
||||
mmg.load();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
})
|
||||
}});
|
||||
}
|
||||
function edit(id){
|
||||
var params = WST.getParams('.ipt');
|
||||
params.id = id;
|
||||
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
||||
$.post(WST.AU('cron://cron/edit'),params,function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg("操作成功",{icon:1},function(){
|
||||
location.href=WST.AU('cron://cron/index');
|
||||
});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
function changgeEnableStatus(id,type){
|
||||
var msg = (type==1)?"您确定要启用该计划任务吗?":"您确定要停用该计划任务吗?"
|
||||
var box = WST.confirm({content:msg,yes:function(){
|
||||
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
||||
$.post(WST.AU('cron://cron/changeEnableStatus'),{id:id,status:type},function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg(json.msg,{icon:1});
|
||||
layer.close(box);
|
||||
mmg.load();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
109
addons/cron/view/admin/edit.html
Executable file
109
addons/cron/view/admin/edit.html
Executable file
@ -0,0 +1,109 @@
|
||||
{extend name="../../../hyhproject/admin/view/base" /}
|
||||
{block name="js"}
|
||||
<script src="__ROOT__/addons/cron/view/admin/crons.js?v={$v}" type="text/javascript"></script>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<form id="editForm">
|
||||
<table class='wst-form wst-box-top'>
|
||||
<tr>
|
||||
<th width='150'>计划任务名称:</th>
|
||||
<td style='line-height:30px;'>
|
||||
{$data['cronName']}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>计划任务描述:</th>
|
||||
<td style='line-height:30px;'>
|
||||
{$data['cronDesc']}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>定时任务网址:</th>
|
||||
<td style='line-height:30px;'>
|
||||
{$data['cronUrl']}
|
||||
</td>
|
||||
</tr>
|
||||
{if $data['cronJson']!=''}
|
||||
{volist name="$data['cronJson']" id='vj'}
|
||||
<tr>
|
||||
<th>{$vj['fieldLabel']}:</th>
|
||||
<td>
|
||||
<input type="text" id="{$vj['fieldCode']}" class="ipt" style='width:70%;' maxLength="255" value='{$vj['fieldVal']}' />
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
{/if}
|
||||
<tr>
|
||||
<th>计划时间<font color='red'></font>:</th>
|
||||
<td class='layui-form'>
|
||||
<label>
|
||||
<input type='radio' name='cronCycle' value='0' id='cronCycle0' class='ipt' onclick='javascript:checkType(0)' {if $data['cronCycle']==0}checked{/if} title='每月'/>
|
||||
</label>
|
||||
<label>
|
||||
<input type='radio' name='cronCycle' value='1' id='cronCycle1' class='ipt' onclick='javascript:checkType(1)' {if $data['cronCycle']==1}checked{/if} title='每周'/>
|
||||
</label>
|
||||
<label>
|
||||
<input type='radio' name='cronCycle' value='2' id='cronCycle2' class='ipt' onclick='javascript:checkType(2)' {if $data['cronCycle']==2}checked{/if} title='每日'/>
|
||||
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='cycle0 cycle' {if $data['cronCycle']!=0}style='display:none'{/if}>
|
||||
<th>日期<font color='red'></font>:</th>
|
||||
<td>
|
||||
<select id='cronDay' class='ipt'>
|
||||
{for start="1" end="32"}
|
||||
<option value='{$i}' {if $data['cronDay']==$i}selected{/if}>{$i}日</option>
|
||||
}
|
||||
{/for}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='cycle1 cycle' {if $data['cronCycle']!=1}style='display:none'{/if}>
|
||||
<th>星期<font color='red'></font>:</th>
|
||||
<td>
|
||||
<select id='cronWeek' class='ipt'>
|
||||
<option value='1' {if $data['cronWeek']==1}selected{/if}>星期一</option>
|
||||
<option value='2' {if $data['cronWeek']==2}selected{/if}>星期二</option>
|
||||
<option value='3' {if $data['cronWeek']==3}selected{/if}>星期三</option>
|
||||
<option value='4' {if $data['cronWeek']==4}selected{/if}>星期四</option>
|
||||
<option value='5' {if $data['cronWeek']==5}selected{/if}>星期五</option>
|
||||
<option value='6' {if $data['cronWeek']==6}selected{/if}>星期六</option>
|
||||
<option value='0' {if $data['cronWeek']==0}selected{/if}>星期日</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>小时<font color='red'></font>:</th>
|
||||
<td>
|
||||
<select id='cronHour' class='ipt'>
|
||||
<option value='-1' {if $data['cronHour']==-1}selected{/if}>每小时</option>
|
||||
{for start="0" end="24"}
|
||||
<option value='{$i}' {if $data['cronHour']==$i}selected{/if}>{$i}时</option>
|
||||
}
|
||||
{/for}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>分钟<font color='red'></font>:</th>
|
||||
<td>
|
||||
<input type="text" id="cronMinute" class="ipt" style='width:70%' maxLength="255" value='{$data['cronMinute']}' />(如多个分钟则以,分隔,-1表示每分钟)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>计划任务状态<font color='red'></font>:</th>
|
||||
<td class='layui-form'>
|
||||
<input type="checkbox" style='width:80px;' {if $data['isEnable']=='1'}checked{/if} class="ipt" name="isEnable" id='isEnable' lay-skin="switch" title="开关" value='1' lay-text="启用|停用">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' align='center'>
|
||||
<button type="button" onclick='javascript:edit({$data['id']+0})' style='margin-right:15px;' class='btn btn-primary btn-mright'><i class="fa fa-check"></i>提交</button>
|
||||
<button type="button" onclick='javascript:history.go(-1)' class='btn'><i class="fa fa-angle-double-left"></i>返回</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{/block}
|
||||
|
23
addons/cron/view/admin/list.html
Executable file
23
addons/cron/view/admin/list.html
Executable file
@ -0,0 +1,23 @@
|
||||
{extend name="../../../hyhproject/admin/view/base" /}
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
|
||||
{/block}
|
||||
{block name="js"}
|
||||
<script src="__ADMIN__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
|
||||
<script src="__ROOT__/addons/cron/view/admin/crons.js?v={$v}" type="text/javascript"></script>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<div id='alertTips' class='alert alert-success alert-tips fade in'>
|
||||
<div id='headTip' class='head'><i class='fa fa-lightbulb-o'></i>操作说明</div>
|
||||
<ul class='body'>
|
||||
<li>本功能主要提供定时任务功能,该通过用户访问页面触发实现,具有一定延时性,若用户有自行设置操作系统计划任务则不必开启本系统的计划任务。</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='wst-grid'>
|
||||
<div id="mmg" class="mmg"></div>
|
||||
<div id="pg" style="text-align: right;"></div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){initGrid()});
|
||||
</script>
|
||||
{/block}
|
Reference in New Issue
Block a user