mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
130 lines
5.8 KiB
PHP
130 lines
5.8 KiB
PHP
{extend name='table'}
|
||
|
||
{block name="button"}
|
||
<!--{if isset($isSuper) and $isSuper}-->
|
||
<a class="layui-btn layui-btn-sm layui-btn-primary" data-queue="{:url('admin/api.plugs/optimize')}">优化数据库</a>
|
||
<!--{if $iswin}-->
|
||
<button data-load='{:url("admin/api.queue/start")}' class='layui-btn layui-btn-sm layui-btn-primary'>开启后台服务</button>
|
||
<button data-load='{:url("admin/api.queue/stop")}' class='layui-btn layui-btn-sm layui-btn-primary'>关闭后台服务</button>
|
||
<!--{/if}-->
|
||
<!--{/if}-->
|
||
|
||
<!--{if auth("clean")}-->
|
||
<button data-queue='{:url("clean")}' class='layui-btn layui-btn-sm layui-btn-primary'>定时清理数据</button>
|
||
<!--{/if}-->
|
||
|
||
<!--{if auth("remove")}-->
|
||
<button data-action='{:url("remove")}' data-rule="id#{id}" data-table-id="QueueData" data-confirm="确定批量删除记录吗?" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除任务</button>
|
||
<!--{/if}-->
|
||
{/block}
|
||
|
||
{block name="content"}
|
||
<div class="think-box-shadow">
|
||
<div class="layui-row layui-col-space20 portal-block-container notselect">
|
||
<div class="layui-col-sm6 layui-col-md6 layui-col-lg3">
|
||
<div class="portal-block-item nowrap" style="background:linear-gradient(-125deg,#57bdbf,#2f9de2)">
|
||
<div class="font-w7 font-s16">等待处理</div>
|
||
<div>{$total.pre|default=0}</div>
|
||
<div>待处理的任务数量</div>
|
||
</div>
|
||
<i class="portal-block-icon layui-icon layui-icon-star"></i>
|
||
</div>
|
||
<div class="layui-col-sm6 layui-col-md6 layui-col-lg3">
|
||
<div class="portal-block-item nowrap" style="background:linear-gradient(-125deg,#ff7d7d,#fb2c95)">
|
||
<div class="font-w7 font-s16">正在处理</div>
|
||
<div>{$total.dos|default=0}</div>
|
||
<div>处理中的任务数量</div>
|
||
</div>
|
||
<i class="portal-block-icon layui-icon layui-icon-log"></i>
|
||
</div>
|
||
<div class="layui-col-sm6 layui-col-md6 layui-col-lg3">
|
||
<div class="portal-block-item nowrap" style="background:linear-gradient(-113deg,#c543d8,#925cc3)">
|
||
<div class="font-w7 font-s16">处理完成</div>
|
||
<div>{$total.oks|default=0}</div>
|
||
<div>处理完成的任务数量</div>
|
||
</div>
|
||
<i class="portal-block-icon layui-icon layui-icon-release"></i>
|
||
</div>
|
||
<div class="layui-col-sm6 layui-col-md6 layui-col-lg3">
|
||
<div class="portal-block-item nowrap" style="background:linear-gradient(-141deg,#ecca1b,#f39526)">
|
||
<div class="font-w7 font-s16">处理失败</div>
|
||
<div>{$total.ers|default=0}</div>
|
||
<div>处理失败的任务数量</div>
|
||
</div>
|
||
<i class="portal-block-icon layui-icon layui-icon-engine"></i>
|
||
</div>
|
||
</div>
|
||
|
||
{include file='queue/index_search'}
|
||
<table id="QueueData" data-url="{:sysuri()}" data-target-search="form.form-search"></table>
|
||
</div>
|
||
{/block}
|
||
|
||
{block name='script'}
|
||
<script>
|
||
$(function () {
|
||
$('#QueueData').layTable({
|
||
even: true,
|
||
sort: {field: 'loops_time desc,id', type: 'desc'},
|
||
cols: [[
|
||
{checkbox: true, fixed: 'left'},
|
||
{field: 'code', title: '任务编号', width: 140, sort: true},
|
||
{field: 'title', title: '任务名称', minWidth: 160},
|
||
{field: 'command', title: '任务指令', minWidth: 160},
|
||
{field: 'exec_time', title: '计划时间', minWidth: 170},
|
||
{
|
||
field: 'enter_time', title: '开始时间', minWidth: 180, templet: function (d) {
|
||
d.enter_time = d.enter_time || '', d.outer_time = d.outer_time || '0.0000';
|
||
if (d.enter_time.length > 12) {
|
||
return d.enter_time.substr(12) + ('<span class="color-desc">( 耗时 ' + d.outer_time + ' )</span>');
|
||
} else {
|
||
return '<span class="color-desc">未执行</span>'
|
||
}
|
||
}
|
||
},
|
||
{field: 'attempts', title: '执行次数', minWidth: 80, align: 'center', sort: true, templet: "<div>{{d.attempts||0}}</div>"},
|
||
{field: 'create_at', title: '创建时间', minWidth: 170, align: 'center'},
|
||
{toolbar: '#toolbar', title: '操作面板', align: 'left', fixed: 'right', minWidth: 270}
|
||
]]
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<script type="text/html" id="toolbar">
|
||
{{# if(d.loops_time>0){ }}
|
||
<span class="layui-badge think-bg-blue">循</span>
|
||
{{# } }}
|
||
|
||
{{# if(d.rscript===1){ }}
|
||
<span class="layui-badge layui-bg-green">复</span>
|
||
{{# }else{ }}
|
||
<span class="layui-badge think-bg-violet">单</span>
|
||
{{# } }}
|
||
|
||
{{# if(d.status===1){ }}
|
||
<span class="layui-badge layui-bg-black">等待处理</span>
|
||
{{# }else if(d.status===2){ }}
|
||
<span class="layui-badge layui-bg-green">正在处理</span>
|
||
{{# }else if(d.status===3){ }}
|
||
<span class="layui-badge layui-bg-blue">处理完成</span>
|
||
{{# }else if(d.status===4){ }}
|
||
<span class="layui-badge layui-bg-red">处理失败</span>
|
||
<!--{if auth('redo')}-->
|
||
<a class="layui-badge layui-bg-green" data-confirm="确定要重置该任务吗?" data-queue="{:url('redo')}?code={{d.code}}">
|
||
<i class="layui-icon font-s12"></i>
|
||
</a>
|
||
<!--{/if}-->
|
||
{{# } }}
|
||
|
||
<!--{if auth('remove')}-->
|
||
<a class='layui-badge layui-bg-red' data-confirm="确定要删除该任务吗?" data-action='{:url("remove")}' data-value="id#{{d.id}}">
|
||
<i class="layui-icon font-s12"></i>
|
||
</a>
|
||
<!--{/if}-->
|
||
|
||
<a class='layui-badge layui-bg-orange' onclick="$.loadQueue('{{d.code}}',false)">
|
||
<i class="layui-icon font-s12"></i>
|
||
</a>
|
||
</script>
|
||
{/block}
|