This commit is contained in:
commit
451f9fe425
|
@ -75,7 +75,7 @@ def drquestions(companyid,path,userid):
|
|||
notinlist = []
|
||||
while sheet['c'+str(i)].value!=None:
|
||||
type = sheet['a'+str(i)].value.replace(' ', '')
|
||||
cate = sheet['b'+str(i)].value.replace(' ', '')
|
||||
cate = str(sheet['b'+str(i)]).value.replace(' ', '')
|
||||
title = sheet['c'+str(i)].value
|
||||
answer = {}
|
||||
if sheet['d'+str(i)].value:
|
||||
|
|
|
@ -1156,7 +1156,8 @@ class RiskActTask(models.Model): # 风险点排查执行记录
|
|||
user = models.ForeignKey(
|
||||
User, on_delete=models.CASCADE, null=True, blank=True)
|
||||
taskadd = models.DateTimeField(null=True, blank=True)
|
||||
taskdo = models.DateTimeField(null=True, blank=True)
|
||||
taskdo = models.DateTimeField(null=True, blank=True, verbose_name='开始执行时间')
|
||||
taskdo2 = models.DateTimeField(null=True, blank=True, verbose_name='提交时间')
|
||||
taskexpire = models.DateTimeField(null=True, blank=True)
|
||||
usable = models.IntegerField(default=1) # 1是可用,2是变更计划,0是不可用
|
||||
type = models.IntegerField(default=1) # 1是计划内,2是计划外
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
<div class="easyui-layout" style="width:100%;height:100%;">
|
||||
<div data-options="region:'west',split:true,border:false" style="width:50%;height:100%;" title="任务派发">
|
||||
<table id="riskacttasktable" style="height:100%;"></table>
|
||||
</div>
|
||||
<div data-options="region:'center',split:true,border:false" style="width:50%;height:100%;">
|
||||
<div class="easyui-layout" style="width:100%;height:100%">
|
||||
<div data-options="region:'north',border:false" style="height: 50%;" title="检查条目">
|
||||
<table id="checkitemtable" style="height:100%;"></table>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="height: 50%;" title="关联隐患">
|
||||
<table id="ctroubletable" style="height:100%;"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$('#riskacttasktable').datagrid({
|
||||
url: 'api/riskacttask?a=listalltask&table_type=2',
|
||||
singleSelect:true,
|
||||
rownumbers: true,
|
||||
fitColumns: true,
|
||||
striped: true,
|
||||
method: 'get',
|
||||
pagination: 'true',
|
||||
pageSize: 20,
|
||||
columns: [[
|
||||
{ field: 'id', hidden:true },
|
||||
{ field: 'riskact__name', title: '检查表名', width: 80 },
|
||||
{ field: 'user__name', title: '任务执行人', width: 80 },
|
||||
{ field: 'taskadd', title: '派发时间', width: 80 },
|
||||
{ field: 'taskexpire', title: '过期时间', width: 80 },
|
||||
{ field: 'usable', title: '任务状态', width: 80, formatter: function (value, row, index) {
|
||||
if(value==1){
|
||||
return '可用'
|
||||
}else if (value==0&&row.taskdo==null){
|
||||
return '过期'
|
||||
}else if(value==0&&row.taskdo!=null){
|
||||
return ''
|
||||
}else if(value==2){
|
||||
return '作废'
|
||||
}
|
||||
}, styler: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 1: return 'color:white;background-color:green'; break;
|
||||
}}},
|
||||
{ field: 'taskdo', title: '执行时间', width: 80, formatter: function (value, row, index) {
|
||||
if(row.taskdo==null){
|
||||
return '未执行';
|
||||
}else{
|
||||
return '已执行' + '-' + row.taskdo;
|
||||
}
|
||||
}, styler: function (value, row, index) {
|
||||
if(value==null){
|
||||
return 'color:red;font-weight:bold';
|
||||
}else{
|
||||
return 'color:green;font-weight:bold';
|
||||
}}
|
||||
},
|
||||
|
||||
]],
|
||||
onSelect: function (index, row) {
|
||||
$('#ctroubletable').datagrid({url:'troublehandle?a=listall&riskacttask='+row.id})
|
||||
}
|
||||
})
|
||||
$('#checkitemtable').datagrid({
|
||||
url: '',
|
||||
singleSelect:true,
|
||||
rownumbers: true,
|
||||
fitColumns: true,
|
||||
striped: true,
|
||||
method: 'get',
|
||||
pagination: 'true',
|
||||
pageSize: 20,
|
||||
columns: [[
|
||||
{ field: 'id', hidden:true },
|
||||
{ field: 'risk__name', title: '检查条目', width: 140 },
|
||||
{ field: 'dotime', title: '执行时间', width: 80 },
|
||||
{ field: 'note', title: '备注', width: 80 },
|
||||
]],
|
||||
onSelect: function (index, row) {
|
||||
$('#ctroubletable').datagrid({url:'troublehandle?a=listall&riskcheck2='+row.id})
|
||||
}
|
||||
})
|
||||
$('#ctroubletable').datagrid({
|
||||
rownumbers: true,
|
||||
singleSelect: true,
|
||||
striped: true,
|
||||
method: 'get',
|
||||
url: '',
|
||||
fitColumns: true,
|
||||
pagination: true,
|
||||
pageSize: 20,
|
||||
toolbar: '#yhtablebar',
|
||||
border: false,
|
||||
columns: [[
|
||||
{ field: 'troubleid', hidden: true },
|
||||
{ field: 'yhnum', title: '编号', width: 100 },
|
||||
{
|
||||
field: 'yhzt', title: '流程状态', width: 100, styler: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 0: return 'background-color:yellow;'; break;
|
||||
case 1: return 'background-color:yellow;'; break;
|
||||
case 2: return 'background-color:yellow;'; break;
|
||||
case 3: return 'background-color:yellow;'; break;
|
||||
case 4: return 'background-color:yellow;'; break;
|
||||
case 5: return 'background-color:yellow;'; break;
|
||||
case 6: return 'background-color:green;'; break;
|
||||
case 7: return 'background-color:yellow;'; break;
|
||||
}
|
||||
if (row.zgqx) {
|
||||
|
||||
}
|
||||
}, formatter: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 0: return '待新增'; break;
|
||||
case 1: return '待评估'; break;
|
||||
case 2: return '措施/方案待确认'; break;
|
||||
case 3: return '待整改'; break;
|
||||
case 4: return '待审核'; break;
|
||||
case 5: return '待复查'; break;
|
||||
case 6: return '已归档'; break;
|
||||
case 7: return '措施/方案待提交'; break;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'yhdj__dickeyname', title: '隐患等级', width: 80 },
|
||||
{ field: 'yhlb__dickeyname', title: '隐患类别', width: 80 },
|
||||
{ field: 'yhpg__dickeyname', title: '隐患评估', width: 80 },
|
||||
{ field: 'tbsj', title: '提交时间', width: 100 },
|
||||
]]
|
||||
});
|
||||
</script>
|
|
@ -152,6 +152,7 @@ urlpatterns = [
|
|||
path('html/offence/detail/<int:id>/', views.offencedetail),
|
||||
# 检查表
|
||||
path('html/checklist/', views.checklisthtml),
|
||||
path('html/checklisttaskdo/', views.checklisttaskdo_html),
|
||||
|
||||
path('html/safelist/', views.safelist),
|
||||
path('html/safefeedback/', views.safefeedback),
|
||||
|
|
|
@ -214,6 +214,8 @@ def riskcheck(req): # 风险点排查记录
|
|||
def taskdo(req):
|
||||
return render(req, 'taskdo.html')
|
||||
|
||||
def checklisttaskdo_html(req):
|
||||
return render(req, 'checklisttaskdo.html')
|
||||
|
||||
def task(req):
|
||||
return render(req, 'task.html')
|
||||
|
@ -8224,8 +8226,12 @@ def apiriskacttask(req):
|
|||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)
|
||||
if a == 'listalltask': # 全厂任务
|
||||
objs = RiskActTask.objects.filter(riskact__usecomp__partid=companyid, istask=1).order_by('-pk','-usable', 'riskact__group__groupid').values('riskact__group__groupname', 'riskact__area__name',
|
||||
'riskact__type__dickeyname', 'riskact__id', 'riskact__group__groupid', 'riskact__name', 'riskact__level', 'riskact__tasktype', 'taskadd', 'taskexpire', 'user__userid', 'usable', 'taskdo', 'user__name')
|
||||
objs = RiskActTask.objects.filter(riskact__usecomp__partid=companyid, istask=1).order_by('-pk','-usable', 'riskact__group__groupid')
|
||||
objs = objs.filter(riskact__table_type=req.GET.get('table_type', 1))
|
||||
objs = objs.values('riskact__group__groupname', 'riskact__area__name',
|
||||
'riskact__type__dickeyname', 'riskact__id', 'riskact__group__groupid',
|
||||
'riskact__name', 'riskact__level', 'riskact__tasktype', 'taskadd', 'taskexpire',
|
||||
'user__userid', 'usable', 'taskdo', 'user__name')
|
||||
total = objs.count()
|
||||
startnum, endnum = fenye(req)
|
||||
objs = objs[startnum:endnum]
|
||||
|
@ -8239,6 +8245,7 @@ def apiriskacttask(req):
|
|||
objs = objs.filter(taskdo_gte=req.GET.get('qssj'))
|
||||
if req.GET.get('jssj'):
|
||||
objs = objs.filter(taskdo__lte=req.GET.get('jssj'))
|
||||
objs = objs.filter(riskact__table_type=req.GET.get('table_type', 1))
|
||||
total = objs.count()
|
||||
startnum, endnum = fenye(req)
|
||||
objs = objs.order_by('-taskdo')[startnum:endnum].values('id', 'riskact__name', 'riskact__area__name', 'riskact__place',
|
||||
|
@ -8246,6 +8253,7 @@ def apiriskacttask(req):
|
|||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||
elif a == 'listalltodo': # 全厂待办任务
|
||||
objs = RiskActTask.objects.filter(istask=1, taskdo=None, usable=1)
|
||||
objs = objs.filter(riskact__table_type=req.GET.get('table_type', 1))
|
||||
total = objs.count()
|
||||
startnum, endnum = fenye(req)
|
||||
objs = objs[startnum:endnum].values('id', 'riskact__group__groupname', 'riskact__area__name', 'riskact__type__dickeyname', 'riskact__id',
|
||||
|
@ -8253,6 +8261,7 @@ def apiriskacttask(req):
|
|||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||
elif a == 'listself': # 排查记录
|
||||
a = RiskActTask.objects.filter(user__userid=userid)
|
||||
objs = objs.filter(riskact__table_type=req.GET.get('table_type', 1))
|
||||
total = a.count()
|
||||
startnum, endnum = fenye(req)
|
||||
a = a.order_by('-id')[startnum:endnum].values('id', 'riskact__level', 'riskact__name', 'riskact__area__name', 'riskact__place',
|
||||
|
@ -8262,6 +8271,7 @@ def apiriskacttask(req):
|
|||
groups = Group.objects.filter(users__userid=userid)
|
||||
objs = RiskActTask.objects.filter(
|
||||
riskact__group__in=groups, usable=1, istask=1, user=None)
|
||||
objs = objs.filter(riskact__table_type=req.GET.get('table_type', 1))
|
||||
total = objs.count()
|
||||
startnum, endnum = fenye(req)
|
||||
objs = objs[startnum:endnum].values('id', 'riskact__group__groupname', 'riskact__area__name', 'riskact__type__dickeyname', 'riskact__id',
|
||||
|
@ -8269,6 +8279,7 @@ def apiriskacttask(req):
|
|||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||
elif a == 'listmytodo2': # 我的待办
|
||||
objs = RiskActTask.objects.filter(usable=1, istask=1, user__userid=userid)
|
||||
objs = objs.filter(riskact__table_type=req.GET.get('table_type', 1))
|
||||
total = objs.count()
|
||||
startnum, endnum = fenye(req)
|
||||
objs = objs.order_by('-id')[startnum:endnum].values('id', 'riskact__group__groupname', 'riskact__area__name', 'riskact__type__dickeyname', 'riskact__id',
|
||||
|
@ -8278,10 +8289,12 @@ def apiriskacttask(req):
|
|||
groups = Group.objects.filter(users__userid=userid)
|
||||
objs = RiskActTask.objects.filter(
|
||||
riskact__group__in=groups, usable=1, user=None)
|
||||
objs = objs.filter(riskact__table_type=req.GET.get('table_type', 1))
|
||||
total = objs.count()
|
||||
return JsonResponse({"code": 1, "todonum": total})
|
||||
elif a == 'todonum2': # 我的待办统计
|
||||
objs = RiskActTask.objects.filter(usable=1, user__userid=userid,taskdo=None)
|
||||
objs = objs.filter(riskact__table_type=req.GET.get('table_type', 1))
|
||||
total = objs.count()
|
||||
return JsonResponse({"code": 1, "todonum": total})
|
||||
elif a == 'detail':
|
||||
|
|
Loading…
Reference in New Issue