隐患跟踪功能完成,差统计分析
This commit is contained in:
parent
e2dad9f25f
commit
418034a5b6
|
@ -11,6 +11,10 @@
|
||||||
{% if request|has_permission:'b_troublefollowtaskset_edit' %}
|
{% if request|has_permission:'b_troublefollowtaskset_edit' %}
|
||||||
<a id="edityhgzrw" onclick="edityhgzrw()" class="easyui-linkbutton" data-options="iconCls: 'fa-pencil',
|
<a id="edityhgzrw" onclick="edityhgzrw()" class="easyui-linkbutton" data-options="iconCls: 'fa-pencil',
|
||||||
plain: true">编辑计划</a>
|
plain: true">编辑计划</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if request|has_permission:'b_troublefollowtaskset_toggle' %}
|
||||||
|
<a onclick="togglegyhgzrw()" class="easyui-linkbutton"
|
||||||
|
data-options="iconCls:'fa-pencil',plain:true">暂停/启用派发</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request|has_permission:'b_troublefollowtaskset_del' %}
|
{% if request|has_permission:'b_troublefollowtaskset_del' %}
|
||||||
<a id="delyhgzrw" onclick="delyhgzrw()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',
|
<a id="delyhgzrw" onclick="delyhgzrw()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',
|
||||||
|
@ -26,11 +30,10 @@
|
||||||
<table id="yhgzrwtable2" style="width:100%;height:100%;"></table>
|
<table id="yhgzrwtable2" style="width:100%;height:100%;"></table>
|
||||||
<div id="yhgzrwtablebar2" style="padding:4px;">
|
<div id="yhgzrwtablebar2" style="padding:4px;">
|
||||||
<div>
|
<div>
|
||||||
|
{% if request|has_permission:'b_troublefollowtask_del' %}
|
||||||
<a id="delyhgzrw2" onclick="delyhgzrw2()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',
|
<a id="delyhgzrw2" onclick="delyhgzrw2()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',
|
||||||
plain: true">删除任务</a>
|
plain: true">删除任务</a>
|
||||||
<a id="zfyhgzrw2" onclick="zfyhgzrw2()" class="easyui-linkbutton" data-options="iconCls: 'fa-remove',
|
{% endif %}
|
||||||
plain: true">作废任务</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,7 +48,6 @@
|
||||||
singleSelect: true,
|
singleSelect: true,
|
||||||
striped: true,
|
striped: true,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: '',
|
|
||||||
fitColumns: true,
|
fitColumns: true,
|
||||||
pagination: true,
|
pagination: true,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
|
@ -86,12 +88,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ field: 'gridlevel__dickeyname', title: '网格层级', width: '80px' },
|
{ field: 'gridlevel__dickeyname', title: '网格层级', width: '80px' },
|
||||||
{ field: 'user__name', title: '跟踪人', width: '80px' },
|
{ field: 'periodictask__enabled', title: '派发状态', width: '80px',
|
||||||
{ field: 'myschedule__name', title: '任务策略', width: '150px' },
|
formatter: function (value, row, index) {
|
||||||
{ field: 'last_run_at', title: '最近派发时间', width: '100px' },
|
|
||||||
{
|
|
||||||
field: 'periodictask__enabled', title: '派发状态', width: '60px',
|
|
||||||
formatter: function (value, row, index) {
|
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case true: return '正常'; break;
|
case true: return '正常'; break;
|
||||||
case false: return '暂停'; break;
|
case false: return '暂停'; break;
|
||||||
|
@ -102,8 +100,11 @@
|
||||||
case true: return 'font-weight:bold;color:green'; break;
|
case true: return 'font-weight:bold;color:green'; break;
|
||||||
case false: return 'color:red;font-weight:bold'; 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: 'count', title: '已派发次数', width: '100px' },
|
||||||
{ field: 'note', title: '执行备注', width: '200px' },
|
{ field: 'note', title: '执行备注', width: '200px' },
|
||||||
]],
|
]],
|
||||||
|
@ -123,20 +124,28 @@
|
||||||
{ field: 'id', hidden: true },
|
{ field: 'id', hidden: true },
|
||||||
{ field: 'taskadd', title: '任务派发时间', width: 100 },
|
{ field: 'taskadd', title: '任务派发时间', width: 100 },
|
||||||
{ field: 'taskexpire', title: '任务过期时间', width: 100 },
|
{ field: 'taskexpire', title: '任务过期时间', width: 100 },
|
||||||
{ field: 'desc', title: '跟踪描述', width: 200 },
|
{ field: 'desc', title: '跟踪描述', width: 200, styler: function (value, row, index) {
|
||||||
{ field: 'taskdo', title: '任务执行时间', width: 100 },
|
|
||||||
|
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) {
|
{ field: 'usable', title: '任务状态', width: 80, formatter: function (value, row, index) {
|
||||||
if(value==1){
|
if(value==1){
|
||||||
return '可用'
|
return '可执行'
|
||||||
}else if (value==0&&row.taskdo==null){
|
}else if(value==0&&row.taskdo==null){
|
||||||
return '作废'
|
return '未执行'
|
||||||
}else if(row.taskdo){
|
|
||||||
return '已执行'
|
|
||||||
}
|
}
|
||||||
}, styler: function (value, row, index) {
|
}, styler: function (value, row, index) {
|
||||||
switch (value) {
|
if(value==1){
|
||||||
case 1: return 'color:white;background-color:green'; break;
|
return 'color:white;background-color:green';
|
||||||
}}},
|
}else if(value==0&&row.taskdo==null){
|
||||||
|
return 'color:red;';
|
||||||
|
}}}
|
||||||
]]
|
]]
|
||||||
});
|
});
|
||||||
function delyhgzrw() {
|
function delyhgzrw() {
|
||||||
|
@ -223,6 +232,39 @@
|
||||||
$.messager.alert('提示', '请先选择一个任务配置!');
|
$.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('提示', '未选择数据!');
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.code == 1) {
|
if (data.code == 1) {
|
||||||
$("#girdtasksettable").datagrid('reload');
|
$("#yhgzrwtable").datagrid('reload');
|
||||||
$("#dd").dialog("close");
|
$("#dd").dialog("close");
|
||||||
} else { $.messager.alert('提示', '失败!'); }
|
} else { $.messager.alert('提示', '失败!'); }
|
||||||
$('#submitb').linkbutton('enable');
|
$('#submitb').linkbutton('enable');
|
||||||
|
|
|
@ -7836,8 +7836,7 @@ def apitroublefollowtask(req):
|
||||||
objs = objs[startnum:endnum].values('id', 'trouble__yhnum', 'trouble', 'taskadd', 'taskdo', 'taskexpire', 'desc', 'user', 'user__name', 'usable')
|
objs = objs[startnum:endnum].values('id', 'trouble__yhnum', 'trouble', 'taskadd', 'taskdo', 'taskexpire', 'desc', 'user', 'user__name', 'usable')
|
||||||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||||
elif a=='del':
|
elif a=='del':
|
||||||
data = json.loads(req.body.decode('utf-8'))
|
TroubleFollowTask.objects.filter(id=req.POST.get('id')).delete()
|
||||||
TroubleFollowTask.objects.filter(id=data['id']).delete()
|
|
||||||
return JsonResponse({'code': 1})
|
return JsonResponse({'code': 1})
|
||||||
elif a=='invalid':
|
elif a=='invalid':
|
||||||
data = json.loads(req.body.decode('utf-8'))
|
data = json.loads(req.body.decode('utf-8'))
|
||||||
|
@ -7845,6 +7844,32 @@ def apitroublefollowtask(req):
|
||||||
return JsonResponse({'code': 1})
|
return JsonResponse({'code': 1})
|
||||||
elif a=='mytodonum':
|
elif a=='mytodonum':
|
||||||
return JsonResponse({'code': 1, 'mytodonum':TroubleFollowTask.objects.filter(user__userid=userid,usable=1).count()})
|
return JsonResponse({'code': 1, 'mytodonum':TroubleFollowTask.objects.filter(user__userid=userid,usable=1).count()})
|
||||||
|
elif a=='listtodo':
|
||||||
|
objs = TroubleFollowTask.objects.filter(user__userid=userid,usable=1).order_by('-pk', '-taskadd')
|
||||||
|
total = objs.count()
|
||||||
|
startnum, endnum = fenye(req)
|
||||||
|
objs = objs[startnum:endnum].values('id', 'trouble__yhnum', 'trouble', 'taskadd', 'taskdo', 'taskexpire', 'desc', 'user', 'user__name', 'usable', 'gridlevel__dickeyname', 'trouble__yhms')
|
||||||
|
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||||
|
elif a=='listdone':
|
||||||
|
objs = TroubleFollowTask.objects.filter(user__userid=userid,usable=0).order_by('-pk', '-taskadd')
|
||||||
|
total = objs.count()
|
||||||
|
startnum, endnum = fenye(req)
|
||||||
|
objs = objs[startnum:endnum].values('id', 'trouble__yhnum', 'trouble', 'taskadd', 'taskdo', 'taskexpire', 'desc', 'user', 'user__name', 'usable', 'gridlevel__dickeyname', 'trouble__yhms')
|
||||||
|
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||||
|
elif a=='detail':
|
||||||
|
obj = TroubleFollowTask.objects.filter(id=req.GET.get('id')).values('id', 'trouble__yhnum', 'trouble', 'taskadd', 'taskdo', 'taskexpire', 'desc', 'user', 'user__name', 'usable', 'gridlevel__dickeyname', 'trouble__yhms', 'tasknote')
|
||||||
|
return HttpResponse(json.dumps(obj[0], cls=MyEncoder), content_type="application/json")
|
||||||
|
elif a=='handle':
|
||||||
|
data = json.loads(req.body.decode('utf-8'))
|
||||||
|
obj = TroubleFollowTask.objects.get(id=data['id'])
|
||||||
|
obj.desc = data.get('desc', None)
|
||||||
|
obj.taskdo = datetime.now()
|
||||||
|
obj.usable = 0
|
||||||
|
obj.save()
|
||||||
|
return JsonResponse({'code': 1})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def apiriskacttask(req):
|
def apiriskacttask(req):
|
||||||
a = req.GET.get('a')
|
a = req.GET.get('a')
|
||||||
|
|
Loading…
Reference in New Issue