diff --git a/public/panel/views/task.html b/public/panel/views/task.html index 64fc49ab..8a2ab755 100644 --- a/public/panel/views/task.html +++ b/public/panel/views/task.html @@ -16,6 +16,7 @@ Date: 2023-07-22
  • 进行中
  • 等待中
  • 已完成
  • +
  • 已失败
  • @@ -41,6 +42,12 @@ Date: 2023-07-22 移除
    +
    +
    + +
    @@ -131,8 +138,6 @@ Date: 2023-07-22 }; } }); - - // 工具条 table.on('tool(panel-task-finished)', function (obj) { let data = obj.data; if (obj.event === 'remove') { @@ -147,7 +152,6 @@ Date: 2023-07-22 , success: function (res) { if (res.code == 0) { layer.msg('移除任务:' + data.name + ' 成功!', {icon: 1, time: 1000}, function () { - // 重载表格 table.reload('panel-task-finished-table'); }); } else { @@ -158,5 +162,58 @@ Date: 2023-07-22 }); } }); + + table.render({ + elem: '#panel-task-failed' + , id: 'panel-task-failed-table' + , url: '/api/panel/task/list?status=failed' + , cols: [[ + {field: 'id', hide: true, title: 'ID', sort: true} + , {field: 'name', width: '80%', title: '任务名'} + , { + field: 'control', + title: '操作', + templet: '#panel-task-failed-control-tpl', + fixed: 'right', + align: 'center' + } + ]] + , page: true + , text: { + none: '无数据' + } + , parseData: function (res) { + return { + "code": res.code, + "msg": res.message, + "count": res.data.total, + "data": res.data.items + }; + } + }); + table.on('tool(panel-task-failed)', function (obj) { + let data = obj.data; + if (obj.event === 'remove') { + layer.confirm('确定移除该记录吗?', function (index) { + layer.close(index); + admin.req({ + url: '/api/panel/task/delete', + type: 'post', + data: { + id: data.id + } + , success: function (res) { + if (res.code == 0) { + layer.msg('移除任务:' + data.name + ' 成功!', {icon: 1, time: 1000}, function () { + table.reload('panel-task-failed-table'); + }); + } else { + layer.msg(res.message, {icon: 2, time: 1000}); + } + } + }); + }); + } + }); });