index.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. {extend name='main'}
  2. {block name="button"}
  3. <!--{if isset($isSuper) and $isSuper}-->
  4. <a class="layui-btn layui-btn-sm layui-btn-primary" data-queue="{:url('admin/api.plugs/optimize')}">优化数据库</a>
  5. <!--{if $iswin}-->
  6. <button data-load='{:url("admin/api.queue/start")}' class='layui-btn layui-btn-sm layui-btn-primary'>开启后台服务</button>
  7. <button data-load='{:url("admin/api.queue/stop")}' class='layui-btn layui-btn-sm layui-btn-primary'>关闭后台服务</button>
  8. <!--{/if}-->
  9. <!--{/if}-->
  10. <!--{if auth("clean")}-->
  11. <button data-queue='{:url("clean")}' class='layui-btn layui-btn-sm layui-btn-primary'>定时清理数据</button>
  12. <!--{/if}-->
  13. <!--{if auth("remove")}-->
  14. <button data-action='{:url("remove")}' data-rule="id#{key}" data-confirm="确定批量删除记录吗?" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除任务</button>
  15. <!--{/if}-->
  16. {/block}
  17. {block name="content"}
  18. <div class="think-box-shadow">
  19. <div class="layui-row layui-col-space20 portal-block-container notselect">
  20. <div class="layui-col-sm6 layui-col-md6 layui-col-lg3">
  21. <div class="portal-block-item nowrap" style="background:linear-gradient(-125deg,#57bdbf,#2f9de2)">
  22. <div>等待处理</div>
  23. <div>{$total.pre|default=0}</div>
  24. <div>待处理的任务数量</div>
  25. </div>
  26. <i class="portal-block-icon layui-icon layui-icon-star"></i>
  27. </div>
  28. <div class="layui-col-sm6 layui-col-md6 layui-col-lg3">
  29. <div class="portal-block-item nowrap" style="background:linear-gradient(-125deg,#ff7d7d,#fb2c95)">
  30. <div>正在处理</div>
  31. <div>{$total.dos|default=0}</div>
  32. <div>处理中的任务数量</div>
  33. </div>
  34. <i class="portal-block-icon layui-icon layui-icon-log"></i>
  35. </div>
  36. <div class="layui-col-sm6 layui-col-md6 layui-col-lg3">
  37. <div class="portal-block-item nowrap" style="background:linear-gradient(-113deg,#c543d8,#925cc3)">
  38. <div>处理完成</div>
  39. <div>{$total.oks|default=0}</div>
  40. <div>处理完成的任务数量</div>
  41. </div>
  42. <i class="portal-block-icon layui-icon layui-icon-release"></i>
  43. </div>
  44. <div class="layui-col-sm6 layui-col-md6 layui-col-lg3">
  45. <div class="portal-block-item nowrap" style="background:linear-gradient(-141deg,#ecca1b,#f39526)">
  46. <div>处理失败</div>
  47. <div>{$total.ers|default=0}</div>
  48. <div>处理失败的任务数量</div>
  49. </div>
  50. <i class="portal-block-icon layui-icon layui-icon-engine"></i>
  51. </div>
  52. </div>
  53. {include file='queue/index_search'}
  54. <table class="layui-table" lay-skin="line" lay-even>
  55. {notempty name='list'}
  56. <thead>
  57. <tr>
  58. <th class='list-table-check-td think-checkbox'>
  59. <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
  60. </th>
  61. <th class='text-left nowrap'>任务信息</th>
  62. <th class='text-left nowrap'>任务时间</th>
  63. <th class='text-left nowrap'>任务状态</th>
  64. </tr>
  65. </thead>
  66. {/notempty}
  67. <tbody>
  68. {foreach $list as $key=>$vo}
  69. <tr>
  70. <td class='list-table-check-td think-checkbox'>
  71. <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
  72. </td>
  73. <td class='text-left nowrap'>
  74. 任务编号:{$vo.code|default=''}<br>
  75. 任务名称:{$vo.title|default=''}<br>
  76. 任务指令:{$vo.command|default=''}
  77. </td>
  78. <td class='text-left nowrap'>
  79. 计划时间:{$vo.exec_time|format_datetime} {if isset($vo.exec_pid) and $vo.exec_pid>0}( 进程 <b class="color-blue">{$vo.exec_pid|default='-'}</b> ){/if}<br>
  80. {if $vo.enter_time>0 and $vo.outer_time>0} 执行时间:{$vo.enter_time|format_datetime}( 耗时 <b class="color-blue">{:sprintf("%.4f",$vo.outer_time-$vo.enter_time)}</b> 秒 ){elseif $vo.status eq 2} 执行时间:{$vo.enter_time|format_datetime}( 任务执行中 ){else}执行时间:<span class="color-desc">任务还没有执行,等待执行...</span>{/if}<br>
  81. 创建时间:{$vo.create_at|format_datetime} {if isset($vo.loops_time) and $vo.loops_time > 0}( 每 <b class="color-blue">{$vo.loops_time|default='0'}</b> 秒执行,共 <b class="color-blue">{$vo.attempts}</b> 次){else}( 共执行 <b class="color-blue">{$vo.attempts}</b> 次 ) {/if}
  82. </td>
  83. <td class='text-left nowrap'>
  84. <div class="margin-bottom-5">
  85. <!--{if isset($vo.loops_time) and $vo.loops_time > 0}-->
  86. <span class="layui-badge layui-bg-orange">循</span>
  87. <!--{/if}-->
  88. <!--{if $vo.rscript eq 1}-->
  89. <span class="layui-badge layui-bg-green">复</span>
  90. <!--{else}-->
  91. <span class="layui-badge layui-bg-blue">单</span>
  92. <!--{/if}-->
  93. <!--{if $vo.status eq 1}-->
  94. <span class="layui-badge layui-bg-black">等待处理</span>
  95. <!--{elseif $vo.status eq 2}-->
  96. <span class="layui-badge layui-bg-green">正在处理</span>
  97. <!--{elseif $vo.status eq 3}-->
  98. <span class="layui-badge layui-bg-blue">处理完成</span>
  99. <!--{elseif $vo.status eq 4 and auth('redo')}-->
  100. <span class="layui-badge layui-bg-red">处理失败</span>
  101. <a class="layui-badge layui-bg-green" data-confirm="确定要重置该任务吗?" data-queue="{:url('redo')}?code={$vo.code}">
  102. <i class="layui-icon font-s12">&#xe669;</i>
  103. </a>
  104. <!--{/if}-->
  105. <!--{if auth("remove")}-->
  106. <a class='layui-badge layui-bg-red' data-confirm="确定要删除该任务吗?" data-action='{:url("remove")}' data-value="id#{$vo.id}">
  107. <i class="layui-icon font-s12">&#xe640;</i>
  108. </a>
  109. <!--{/if}-->
  110. <a class='layui-badge layui-bg-orange' onclick="$.loadQueue('{$vo.code}',false)">
  111. <i class="layui-icon font-s12">&#xe705;</i>
  112. </a>
  113. </div>
  114. <div class="color-desc">{$vo.exec_desc|raw|default="没有获取到状态描述"}</div>
  115. </td>
  116. </tr>
  117. {/foreach}
  118. </tbody>
  119. </table>
  120. {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
  121. </div>
  122. {/block}