diff --git a/safesite/templates/troublefollow.html b/safesite/templates/troublefollow.html index 7315aa00..3773642e 100644 --- a/safesite/templates/troublefollow.html +++ b/safesite/templates/troublefollow.html @@ -11,6 +11,10 @@ {% if request|has_permission:'b_troublefollowtaskset_edit' %} 编辑计划 + {% endif %} + {% if request|has_permission:'b_troublefollowtaskset_toggle' %} + 暂停/启用派发 {% endif %} {% if request|has_permission:'b_troublefollowtaskset_del' %} + {% if request|has_permission:'b_troublefollowtask_del' %} 删除任务 - 作废任务 - + {% endif %} @@ -45,7 +48,6 @@ singleSelect: true, striped: true, method: 'get', - url: '', fitColumns: true, pagination: true, pageSize: 20, @@ -86,12 +88,8 @@ } }, { field: 'gridlevel__dickeyname', title: '网格层级', width: '80px' }, - { field: 'user__name', title: '跟踪人', width: '80px' }, - { field: 'myschedule__name', title: '任务策略', width: '150px' }, - { field: 'last_run_at', title: '最近派发时间', width: '100px' }, - { - field: 'periodictask__enabled', title: '派发状态', width: '60px', - formatter: function (value, row, index) { + { field: 'periodictask__enabled', title: '派发状态', width: '80px', + formatter: function (value, row, index) { switch (value) { case true: return '正常'; break; case false: return '暂停'; break; @@ -102,8 +100,11 @@ case true: return 'font-weight:bold;color:green'; break; case false: return 'color:red;font-weight:bold'; break; } - } - }, + } + }, + { field: 'user__name', title: '跟踪人', width: '80px' }, + { field: 'myschedule__name', title: '任务策略', width: '150px' }, + { field: 'last_run_at', title: '最近派发时间', width: '100px' }, { field: 'count', title: '已派发次数', width: '100px' }, { field: 'note', title: '执行备注', width: '200px' }, ]], @@ -123,20 +124,28 @@ { field: 'id', hidden: true }, { field: 'taskadd', title: '任务派发时间', width: 100 }, { field: 'taskexpire', title: '任务过期时间', width: 100 }, - { field: 'desc', title: '跟踪描述', width: 200 }, - { field: 'taskdo', title: '任务执行时间', width: 100 }, + { field: 'desc', title: '跟踪描述', width: 200, styler: function (value, row, index) { + + return 'font-weight:bold;color:green'; + + }}, + { field: 'taskdo', title: '任务执行时间', width: 100, styler: function (value, row, index) { + + return 'font-weight:bold;color:green'; + + } }, { field: 'usable', title: '任务状态', width: 80, formatter: function (value, row, index) { if(value==1){ - return '可用' - }else if (value==0&&row.taskdo==null){ - return '作废' - }else if(row.taskdo){ - return '已执行' + return '可执行' + }else if(value==0&&row.taskdo==null){ + return '未执行' } }, styler: function (value, row, index) { - switch (value) { - case 1: return 'color:white;background-color:green'; break; - }}}, + if(value==1){ + return 'color:white;background-color:green'; + }else if(value==0&&row.taskdo==null){ + return 'color:red;'; + }}} ]] }); function delyhgzrw() { @@ -223,6 +232,39 @@ $.messager.alert('提示', '请先选择一个任务配置!'); } } + function togglegyhgzrw() { + var row = $('#yhgzrwtable').datagrid('getSelected'); + if (row) { + var msg = '确定启动派发吗?' + if(row.periodictask__enabled){ + msg = '确定暂停派发吗?' + } + $.messager.confirm('提示', msg, function (r) { + if (r) { + $.ajax({ + type: "GET", + url: 'api/gridtaskset?a=toggle&id=' + row.id, + datatype: "json", + beforeSend: function () { }, + success: function (data) { + $("#yhgzrwtable").datagrid('reload'); + }, + + complete: function (XMLHttpRequest, textStatus) { + }, + + error: function () { + + } + }); + } + } + ); + } + else { + $.messager.alert('提示', '未选择数据!'); + } + }