|
@@ -22,7 +22,7 @@
|
|
|
<table id="dataTable" class="table table-bordered table-hover">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th>任务名称</th> <th>创建时间</th> <th>创建人</th> <th>描述</th> <th>操作</th>
|
|
|
+ <th>任务名称</th> <th>创建时间</th> <th>创建人</th> <th>描述</th><th>运行状态</th> <th>操作</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
</table>
|
|
@@ -62,11 +62,18 @@ $(function () {
|
|
|
}},
|
|
|
{ "data": "s_username"},
|
|
|
{ "data": "s_descript","width":"25%"},
|
|
|
- {"data":"_id","width":"25%",render:function(val,a,row,pos){
|
|
|
+ { "data": "runstatus",render:function(val){
|
|
|
+ if(val){
|
|
|
+ return "<i class='fa fa-fw fa-circle text-green'></i>运行中"
|
|
|
+ }else{
|
|
|
+ return "<i class='fa fa-fw fa-circle text-danger'></i>未启动"
|
|
|
+ }
|
|
|
+ }},
|
|
|
+ { "data":"_id","width":"25%",render:function(val,a,row,pos){
|
|
|
tmp = '<div>'+
|
|
|
'<a class="btn btn-sm btn-primary opr" opr="edit" row="'+pos.row+'" >编辑</a> '+
|
|
|
- '<a class="btn btn-sm btn-success opr" opr="start">启动</a> '+
|
|
|
- '<a class="btn btn-sm btn-info opr" opr="stop">停止</a> '+
|
|
|
+ '<a class="btn btn-sm btn-success opr" opr="start" onclick="start(\''+row._id+'\')">启动</a> '+
|
|
|
+ '<a class="btn btn-sm btn-info opr" opr="stop" onclick="stop(\''+row._id+'\')">停止</a> '+
|
|
|
'<a class="btn btn-sm btn-warning opr" opr="test">测试</a>'+
|
|
|
'</div>';
|
|
|
return tmp
|
|
@@ -143,4 +150,28 @@ $(function () {
|
|
|
})
|
|
|
|
|
|
})
|
|
|
+function start(_id){
|
|
|
+ showConfirm("确定启动?", function() {
|
|
|
+ $.ajax({
|
|
|
+ url:"/admin/task/start",
|
|
|
+ type:"post",
|
|
|
+ data:{"_id":_id},
|
|
|
+ success:function(r){
|
|
|
+ window.location.reload()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+}
|
|
|
+function stop(_id){
|
|
|
+ showConfirm("确定启动?", function() {
|
|
|
+ $.ajax({
|
|
|
+ url:"/admin/task/stop",
|
|
|
+ type:"post",
|
|
|
+ data:{"_id":_id},
|
|
|
+ success:function(r){
|
|
|
+ window.location.reload()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+}
|
|
|
</script>
|