feat: checktask 增加查询条件

This commit is contained in:
caoqianming 2024-07-27 22:45:53 +08:00
parent 76453f81a8
commit 590d44bf6f
3 changed files with 62 additions and 6 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.8 on 2024-07-27 22:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('safesite', '0396_auto_20220304_1648'),
]
operations = [
migrations.AddField(
model_name='riskacttask',
name='imgs',
field=models.TextField(blank=True, null=True, verbose_name='现场图片'),
),
]

View File

@ -1,14 +1,41 @@
<div class="easyui-layout" style="width:100%;height:100%;" title="任务列表"> {% comment %} <div class="easyui-layout" style="width:100%;height:100%;" title="任务列表"> {% endcomment %}
<!-- <div data-options="region:'west',split:true,border:false" style="width:50%;height:100%;" title="任务列表"> --> <!-- <div data-options="region:'west',split:true,border:false" style="width:50%;height:100%;" title="任务列表"> -->
<table id="risktasktable" style="height:100%;"></table>
<!-- </div> --> <!-- </div> -->
<!-- <div data-options="region:'center',title:'执行情况',split:true,border:false" style="width:50%;height:100%;"> <!-- <div data-options="region:'center',title:'执行情况',split:true,border:false" style="width:50%;height:100%;">
<table id="tasktable" style="height:100%;"></table> <table id="tasktable" style="height:100%;"></table>
</div> --> </div> -->
{% comment %} </div> {% endcomment %}
<table id="risktasktable" style="height:100%;"></table>
<div id="risktasktablebar" style="padding:6px;height:auto">
<div>
<form id='searchrisktaskff'>
<label>执行人</label>
<input id="zxr" name="user__name" style="width:180px;" class="easyui-textbox"/>
{% comment %} <label>起始时间</label><input name='qssj' style="width:180px"
class="easyui-datebox" editable=false>
<label>结束时间</label><input name='jssj' style="width:180px"
class="easyui-datebox" editable=false> {% endcomment %}
<a onclick="searchrisktask()" class="easyui-linkbutton" data-options="iconCls: 'fa-search',plain:true">查询</a>
<a id="taskdodetail" onclick="taskdodetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查看详情</a>
</form>
</div>
</div> </div>
<script> <script>
function taskdodetail(){
var row = $('#risktasktable').datagrid('getSelected');
if (row) {
var url = 'html/taskdo/detail/' + row.id
opendg('查看详情',url,1000)
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
function searchrisktask() {
var querydata = $('#searchrisktaskff').serializeJSON();
$('#risktasktable').datagrid('load',querydata);
}
$('#risktasktable').datagrid({ $('#risktasktable').datagrid({
url: 'api/riskacttask?a=listalltask', url: 'api/riskacttask?a=listalltask',
singleSelect:true, singleSelect:true,
@ -18,14 +45,15 @@
method: 'get', method: 'get',
pagination: 'true', pagination: 'true',
pageSize: 20, pageSize: 20,
toolbar: '#risktasktablebar',
columns: [[ columns: [[
{ field: 'riskact__name', title: '风险点名称', width: 80 }, { field: 'riskact__name', title: '风险点名称', width: 80 },
{ field: 'user__name', title: '任务执行人', width: 80 }, { field: 'user__name', title: '任务执行人', width: 50 },
{ field: 'riskact__area__name', title: '区域', width: 100 }, { field: 'riskact__area__name', title: '区域', width: 60 },
//{ field: 'num', title: '风险数量', width: 80 }, //{ field: 'num', title: '风险数量', width: 80 },
{ field: 'taskadd', title: '任务开始时间', width: 80 }, { field: 'taskadd', title: '任务开始时间', width: 80 },
{ field: 'taskexpire', title: '任务过期时间', width: 80 }, { field: 'taskexpire', title: '任务过期时间', width: 80 },
{ field: 'usable', title: '任务状态', width: 80, formatter: function (value, row, index) { { field: 'usable', title: '任务状态', width: 50, 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){
@ -39,7 +67,7 @@
switch (value) { switch (value) {
case 1: return 'color:white;background-color:green'; break; case 1: return 'color:white;background-color:green'; break;
}}}, }}},
{ field: 'taskdo', title: '执行时间', width: 80, formatter: function (value, row, index) { { field: 'taskdo', title: '执行时间', width: 100, formatter: function (value, row, index) {
if(row.taskdo==null){ if(row.taskdo==null){
return '未执行'; return '未执行';
}else{ }else{

View File

@ -8378,6 +8378,12 @@ def apiriskacttask(req):
if a == 'listalltask': # 全厂任务 if a == 'listalltask': # 全厂任务
objs = RiskActTask.objects.filter(riskact__usecomp__partid=companyid, istask=1).order_by('-pk','-usable', 'riskact__group__groupid') 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.filter(riskact__table_type=req.GET.get('table_type', 1))
if req.GET.get('user__name'):
objs = objs.filter(user__name__contains=req.GET.get('user__name'))
if req.GET.get('riskact'):
objs = objs.filter(riskact=req.GET.get('riskact'))
if req.GET.get('taskset'):
objs = objs.filter(taskset=req.GET.get('taskset'))
objs = objs.values('riskact__group__groupname', 'riskact__area__name', objs = objs.values('riskact__group__groupname', 'riskact__area__name',
'riskact__type__dickeyname', 'riskact__id', 'riskact__group__groupid', 'riskact__type__dickeyname', 'riskact__id', 'riskact__group__groupid',
'riskact__name', 'riskact__level', 'riskact__tasktype', 'taskadd', 'taskexpire', 'riskact__name', 'riskact__level', 'riskact__tasktype', 'taskadd', 'taskexpire',
@ -8482,6 +8488,8 @@ def apiriskcheck2(req):
obj.taskdo = nowtime obj.taskdo = nowtime
obj.usable = 0 obj.usable = 0
obj.note = data['note'] if 'note' in data else None obj.note = data['note'] if 'note' in data else None
if 'imgs' in data and data['imgs']:
obj.imgs = '?'.join(data['imgs'])
obj.save() obj.save()
else: else:
obj = RiskActTask() obj = RiskActTask()
@ -8490,6 +8498,8 @@ def apiriskcheck2(req):
obj.istask = 0 obj.istask = 0
obj.taskdo = nowtime obj.taskdo = nowtime
obj.note = data['note'] if 'note' in data else None obj.note = data['note'] if 'note' in data else None
if 'imgs' in data and data['imgs']:
obj.imgs = '?'.join(data['imgs'])
obj.save() obj.save()
has_trouble = False has_trouble = False
for i in checkrisks: for i in checkrisks: