This commit is contained in:
caoqianming 2020-06-21 20:02:47 +08:00
parent 888808470a
commit bfb9380f4d
6 changed files with 216 additions and 42 deletions

View File

@ -175,6 +175,9 @@
.icon-zeren {
background: url('icons/zeren.png') no-repeat center center;
}
.icon-inspectitem {
background: url('icons/inspectitem.png') no-repeat center center;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

View File

@ -102,51 +102,52 @@
{ field: 'id', title: 'ID', hidden: true },
{ field: 'user__ubelongpart__partname', title: '巡检部门', width: 100 },
{ field: 'user__name', title: '巡检人', width: 80 },
{ field: 'type__dickeyname', title: '巡检类型', width: 80 },
{ field: 'equipment__num', title: '编号', width: 80 },
{ field: 'equipment__name', title: '设备名称', width: 80 },
{ field: 'equipment__area__name', title: '区域', width: 80 },
{ field: 'state', title: '设备状态', width: 80 , styler: function (value, row, index) {
if (value == 1) {
return 'background-color:green;color:white';
}else{ return 'background-color:red;'; }
}, formatter: function (value, row, index) {
if (value == 1) {
return '正常';
}else{return '异常'}
}
},
{ field: 'trouble__yhzt', title: '隐患处理', width: 80 , 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){
// { field: 'state', title: '设备状态', width: 80 , styler: function (value, row, index) {
// if (value == 1) {
// return 'background-color:green;color:white';
// }else{ return 'background-color:red;'; }
// }, formatter: function (value, row, index) {
// if (value == 1) {
// return '正常';
// }else{return '异常'}
// }
// },
// { field: 'trouble__yhzt', title: '隐患处理', width: 80 , 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: 'content', title: '巡检结论', width: 200 , formatter: function (value, row, index) {
if(value==null){
return row.trouble__yhms
}
}},
// }
// }, 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: 'content', title: '巡检结论', width: 200 , formatter: function (value, row, index) {
// if(value==null){
// return row.trouble__yhms
// }
// }},
{ field: 'creattime', title: '提交时间', width: 100 },
]]

View File

@ -0,0 +1,161 @@
<table id="xjtable" style="width:auto;height:100%;"></table>
<a id="downa" href="" target="_blank" style="display:none"></a>
<div id="xjtablebar" style="padding: 4px">
<!-- <div >
<label>快捷查询</label>
<select id='kjcxxj' style='width:150px'>
<option value="">请选择</option>
<option value="listself">我的巡检</option>
<option value="listall">全部记录</option>
</select>
<a onclick="javascript:$('#sdg_xj').dialog('open')" class="easyui-linkbutton" data-options="iconCls: 'fa-search',plain:true">详细筛选</a>
</div> -->
<div >
<!-- <a id="xjdetail" onclick="xjdetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查看详情</a> -->
<!-- {% load myfilter %}
{% if request|has_permission:'b_inspect_exportxls' %}
<a id="exportxjexcel" onclick="exportxjexcel()" class="easyui-linkbutton" data-options="iconCls: 'fa-download',plain:true">导出Excel</a>
{% endif %}
{% if request|has_permission:'b_inspect_del' %}
<a id="delxj" onclick="delxj()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% endif %} -->
</div>
<div id="sdg_xj" class="easyui-dialog" title="筛选条件" style="width:400px;height:300px;"
data-options="iconCls:'fa-search',resizable:true,modal:true,closed:true,border:false">
<div class="easyui-layout" style="width:100%;height:100%;">
<div data-options="region:'center'" style="height:100%;text-align:center">
<form id='searchxjff'>
<div style="margin-top:6px"><label>巡检部门</label><input id="sxjbm" name="xjbm" style="width:300px;"
editable=false /></div>
<div style="margin-top:6px"><label>巡检人</label><input id="sxjr" name="xjr" style="width:300px;" class="easyui-combobox"
editable=false /></div>
<div style="margin-top:6px"><label>起始时间</label><input name='qssj' id='sqssj' style="width:300px"
class="easyui-datebox" editable=false></div>
<div style="margin-top:6px"><label>结束时间</label><input name='jssj' id='sjssj' style="width:300px"
class="easyui-datebox" editable=false></div>
<div style="margin-top:6px"><label>设备状态</label>
<select name='state' id='sstate' style="width:300px" class="easyui-combobox" editable=false>
<option value="">请选择</option>
<option value="1">正常</option>
<option value="0">异常</option>
</select>
</div>
</form>
</div>
<div id='southdiv' data-options="region:'south'" style="height:46px;text-align:center;padding:6px">
<a id="xjsearch" onclick="xjsearch()" class="easyui-linkbutton" data-options="iconCls: 'fa-search'">查询</a>
</div>
</div>
</div>
</div>
<script>
$(function(){
$('#xjtable').datagrid({url:'api/inspectitem',queryParams:{a:'listyc'}});
$("#searchxjff").form('clear');
})
$("#sxjbm").combotree({
url: 'parthandle?a=tree',
editable: false,
loadFilter: function (roxj) {
return convert(roxj);
},
formatter: function (node) {
var s = node.text;
if (node.children) {
s += '&nbsp;<span style=\'color:blue\'>(' + node.children.length + ')</span>';
}
return s;
},
onSelect: function (node) {
$('#sxjr').combobox({ url: 'getuser?partid=' + node.id + '&a=combobox', })
}
});
$('#kjcxxj').combobox({
editable:false,
onSelect: function (node) {
if(node.value != 0){
$('#xjtable').datagrid({url:'api/inspect',queryParams:{a:node.value}});
}
}
});
function xjsearch() {
var querydata = $('#searchxjff').serializeJSON();
querydata['a'] = 'listsearch'
$("#sdg_xj").dialog("close");
$('#xjtable').datagrid('load',querydata);
}
$('#xjtable').datagrid({
url: '',
rownumbers: true,
singleSelect: true,
striped: true,
fitColumns: true,
method: 'get',
pagination: 'true',
pageSize: 20,
toolbar: '#xjtablebar',
border:false,
columns: [[
{ field: 'id', title: 'ID', hidden: true },
{ field: 'inspect__equipment__num', title: '设备编号', width: 80 },
{ field: 'inspect__equipment__name', title: '设备名称', width: 80 },
{ field: 'checkitem__name', title: '异常项目', width: 100 },
// { field: 'state', title: '设备状态', width: 80 , styler: function (value, row, index) {
// if (value == 1) {
// return 'background-color:green;color:white';
// }else{ return 'background-color:red;'; }
// }, formatter: function (value, row, index) {
// if (value == 1) {
// return '正常';
// }else{return '异常'}
// }
// },
{ field: 'state', title: '处理状态', width: 80 , styler: function (value, row, index) {
switch (value) {
case '正常': return 'background-color:green;color:white'; break;
case '异常待处理': return 'background-color:red;color:white'; break;
case '异常已处理': return 'background-color:green;color:white'; break;
}
}
},
// { field: 'content', title: '巡检结论', width: 200 , formatter: function (value, row, index) {
// if(value==null){
// return row.trouble__yhms
// }
// }},
{ field: 'todouser__name', title: '处理人', width: 80 },
{ field: 'inspect__creattime', title: '提交时间', width: 100 },
]]
});
function xjdetail(){
var row = $('#xjtable').datagrid('getSelected');
if (row) {
var url = 'misshtml/detail/' + row.missid
opendg('查看详情',url)
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
function exportxjexcel() {
var querydata = $('#searchxjff').serializeJSON();
console.log(querydata)
let url = 'api/inspect?a=exportexcel&'+parseParams(querydata)
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
}
function delxj(){
var row = $('#xjtable').datagrid('getSelected');
if (row) {
var url = 'api/inspect?a=del&id=' + row.id
$.get(url,function(res){
if(res.code==1){
$('#xjtable').datagrid('reload')
}else{
$.messager.alert('提示', '没有权限!');
}
})
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
</script>

View File

@ -75,6 +75,7 @@ urlpatterns = [
path('html/area/add',views.areaadd),
path('html/area/edit/<int:id>/',views.areaedit),
path('html/equipment',views.equipment),
path('html/inspectitem',views.inspectitem),
path('html/inspect',views.inspect),
path('html/risk',views.risk),
path('html/riskact/add',views.riskactadd),

View File

@ -211,6 +211,8 @@ def risk(req):
def inspect(req):
return render(req, 'inspect.html')
def inspectitem(req):
return render(req, 'inspectitem.html')
def equipment(req):
return render(req, 'equipment.html')
@ -6841,7 +6843,13 @@ def apiinspectitem(req):
startnum, endnum = fenye(req)
objs = objs.order_by('-id')[startnum:endnum].values('id', 'state', 'inspect', 'checkitem', 'inspect__equipment__name', 'checkitem__name','inspect__user__name', 'inspect__creattime', 'inspect__equipment__num', 'inspect__type__dickeyname','todouser__name')
return HttpResponse(transjson(total, objs), content_type="application/json")
elif a == 'listall':#我已处理的异常
elif a == 'listyc':#全部异常
objs = InspectItem.objects.filter(inspect__usecomp__partid=companyid).exclude(state='正常')
total = objs.count()
startnum, endnum = fenye(req)
objs = objs.order_by('-id')[startnum:endnum].values('id', 'state', 'inspect', 'checkitem', 'inspect__equipment__name', 'checkitem__name','inspect__user__name', 'inspect__creattime', 'inspect__equipment__num', 'inspect__type__dickeyname','todouser__name')
return HttpResponse(transjson(total, objs), content_type="application/json")
elif a == 'listall':#全部
objs = InspectItem.objects
if req.GET.get('inspect'):
objs = objs.filter(inspect__id=req.GET.get('inspect'))