This commit is contained in:
caoqianming 2021-05-06 22:01:01 +08:00
commit d8097d9d9d
4 changed files with 185 additions and 51 deletions

View File

@ -179,16 +179,11 @@
function detailtask() {
var row = $('#jobtab').datagrid('getSelected');
if (row) {
$.get('api/checkproject?a=jobdetail&id=' + row.id, function (res) {
var data = res.data
console.log(data)
if (data.taskstate == 1) {
$.messager.alert('提示', '该任务还没有执行完,请去执行任务!');
}
else
opendg('任务详情','html/detailjob/'+row.id.toString())
});
// $.get('api/checkproject?a=jobdetail&id=' + row.id, function (res) {
// var data = res.data
// opendg('任务详情','html/detailjob/'+row.id.toString())
// });
}
else {

View File

@ -0,0 +1,141 @@
<div style=" overflow-y:auto; width:100%; height:100%">
<form id='ff' style="margin-top:20px;margin-left:10px;">
<label>查看</label>
<input class="easyui-datebox" id="startdate" name="startdate" data-options="prompt:'起始日期'"></input>
<input class="easyui-datebox" id="enddate" name="enddate" data-options="prompt:'结束日期'"></input>
<input id="username" class="easyui-textbox" readonly value="">
<input type="hidden" name="userid" id="userid" value="" />
<a href="#" class="easyui-linkbutton" onclick="choseuser('user')">选择员工</a>
<a href="#" class="easyui-linkbutton" onclick="startSearch();"
data-options="{ iconCls: 'fa-search', plain: true }">查询</a>
<a href="#" class="easyui-linkbutton" onclick="ExportWord();"
data-options="{ iconCls: 'fa-download', plain: true }">导出</a>
</form>
<div id="exportdiv" style="text-align: center;">
<div style="width: 90%; height: 100%; margin: 0px auto; font-size: 17px;">
<div style="width: 98%; margin: 0px auto;">
<h3 style="font-size: 18px; width: 100%; text-align: center; margin-top: 10px;">个人安全数据统计</h3>
<div style="text-align: right;" id="createdate"></div>
<p style="text-indent: 40px; padding: 5px;">
感谢您为公司的安全生产付出的一份力,以下是您的安全数据清单。
<span id="span_timerange"></span>
</p>
</div>
<div id="infodiv">
</div>
<div id="troublediv">
</div>
<div id="traindiv">
</div>
<div id="riskdiv">
</div>
<div id="operationdiv">
</div>
<div id="missdiv">
</div>
<div id="suggestdiv">
</div>
<div id="testdiv">
</div>
<div id="drilldiv">
</div>
<div id="inspectdiv">
</div>
<div id="certdiv">
</div>
</div>
</div>
</div>
<script type="text/javascript">
var arrs = new Array("trouble","train","operation", "miss", "suggest", "test", "drill", "inspect", "cert")
$(function () {
for(var i=0;i<arrs.length;i++){
var querydata = {type:arrs[i]}
beginsearch(querydata)
}
})
function aaa(x) {
if (x == "user") {
$('#userid').attr('value', top.$('#in').val());
$('#username').textbox('setValue', top.$('#in').attr('show'));
}
}
function startSearch(){
var date = $('#ff').serializeJSON()
var name = $('#username').textbox('getValue')
if(name==""){
name = '{{ user.name }}';
}
$('#infodiv').html('<p>'+name+'&nbsp;&nbsp;&nbsp;'+ date.startdate + '-' + date.enddate +'</p>')
for(var i=0;i<arrs.length;i++){
var querydata = $('#ff').serializeJSON()
querydata.type = arrs[i];
beginsearch(querydata)
}
}
function ExportWord(e) {
$("#exportdiv").wordExport('个人安全数据');
}
function beginsearch(data) {
$.ajax({
type: "get",
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
url: "api/countsafe/", //请求发送
data: data,
dataType: "json", //返回数据形式为json
success: function (res) {
//请求成功时执行该函数内容data即为服务器返回的json对象
if(res){
if(data.type == 'trouble'){
$('#troublediv').html('<p>上报隐患共<span style="color:red;font-weight:bold">' + res.fx_count + '</span>条, 整改隐患<span style="color:red;font-weight:bold">' + res.zg_count + '</span>条.</p>')
}
else if(data.type == 'train'){
$('#traindiv').html('<p>需参加培训<span style="color:red;font-weight:bold">' + res.px_count + '</span>场, 参加并签到<span style="color:red;font-weight:bold">' + res.qd_count + '</span>场.</p>')
}
else if(data.type == 'operation'){
$('#operationdiv').html('<p>参与作业共<span style="color:red;font-weight:bold">' + res.zy_count + '</span>场, 其中身为作业负责人<span style="color:red;font-weight:bold">' + res.zyfzr_count + '</span>场.</p>')
}
else if(data.type == 'miss'){
$('#missdiv').html('<p>上报未遂事件共<span style="color:red;font-weight:bold">' + res.ws_count + '</span>件.</p>')
}
else if(data.type == 'suggest'){
$('#suggestdiv').html('<p>提出并被采纳的建议共<span style="color:red;font-weight:bold">' + res.jy_count + '</span>条, 本人处理了<span style="color:red;font-weight:bold">' + res.jycl_count + '</span>条.</p>')
}
else if(data.type == 'test'){
$('#testdiv').html('<p>共参加考试<span style="color:red;font-weight:bold">' + res.ks_count + '</span>场, 其中<span style="color:red;font-weight:bold">' + res.kstg_count + '</span>场通过.</p>')
}
else if(data.type == 'drill'){
$('#drilldiv').html('<p>共参加应急演练<span style="color:red;font-weight:bold">' + res.yl_count + '</span>场.')
}
else if(data.type == 'inspect'){
$('#inspectdiv').html('<p>共巡检设备<span style="color:red;font-weight:bold">' + res.xj_count + '</span>次, 其中<span style="color:red;font-weight:bold">' + res.xjyc_count + '</span>次发现异常.本人处理了<span style="color:red;font-weight:bold">'+ res.clyc_count+'</span>个异常</p>')
}
else if(data.type == 'cert'){
$('#certdiv').html('<p>拥有特种作业证书<span style="color:red;font-weight:bold">' + res.tz_count + '</span>张, 其中<span style="color:red;font-weight:bold">' + res.tzcq_count + '</span>张超期.</p><p>拥有安全证书<span style="color:red;font-weight:bold">'+ res.aq_count+'</span>张,其中<span style="color:red;font-weight:bold">' + res.aqcq_count + '</span>张超期.</p>')
}
}
},
error: function (errorMsg) {
//请求失败时执行该函数
//alert("汗,没有数据吧!");
}
});
}
</script>

View File

@ -2,15 +2,23 @@
<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'>
<div >
<form id='searchxjff'>
<!-- <label>巡检部门</label><input id="sxjbm" name="xjbm" editable=false /> -->
<label>巡检人</label><input id="sxjr" name="xjr" class="easyui-textbox"/>
<label>发现时间</label><input name='qssj' id='sqssj' class="easyui-datebox" editable=false>-<input name='jssj' id='sjssj'
class="easyui-datebox" editable=false>
<label>设备状态</label>
<select name='state' id='sstate' style="width:100px" class="easyui-combobox" editable=false>
<option value="">请选择</option>
<option value="listself">我的巡检</option>
<option value="listall">全部记录</option>
<option value="异常待处理">异常待处理</option>
<option value="异常已处理">异常已处理</option>
</select>
<a onclick="javascript:$('#sdg_xj').dialog('open')" class="easyui-linkbutton" data-options="iconCls: 'fa-search',plain:true">详细筛选</a>
</div> -->
<a id="xjsearch" onclick="xjsearch()" class="easyui-linkbutton" data-options="iconCls: 'fa-search'">查询</a>
<a id="searchreset" onclick="reset()" class="easyui-linkbutton">重置</a>
</form>
</div>
<div >
<!-- <a id="xjdetail" onclick="xjdetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查看详情</a> -->
<!-- {% load myfilter %}
@ -21,36 +29,8 @@
<a id="delxj" onclick="delxj()" class="easyui-linkbutton" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% endif %} -->
<a id="xjdetail2" onclick="xjdetail2()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查看详情</a>
</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>
<a id="searchreset" onclick="reset()" class="easyui-linkbutton">重置</a>
</div>
</div>
</div>
</div>
<script>
$(function(){
@ -84,14 +64,13 @@
});
function xjsearch() {
var querydata = $('#searchxjff').serializeJSON();
querydata['a'] = 'listsearch'
$("#sdg_xj").dialog("close");
querydata['a'] = 'listyc'
$('#xjtable').datagrid('load',querydata);
}
function reset() {
$('#searchxjff').form('clear')
$('#xjtable').datagrid('options').queryParams = {
a:'listall'
a:'listyc'
}
$('#xjtable').datagrid('load');
@ -135,6 +114,7 @@
// return row.trouble__yhms
// }
// }},
{ field: 'inspect__user__name', title: '巡检人', width: 80 },
{ field: 'todouser__name', title: '处理人', width: 80 },
{ field: 'inspect__creattime', title: '提交时间', width: 100 },

View File

@ -7256,6 +7256,24 @@ def apiinspectitem(req):
return HttpResponse(transjson(total, objs), content_type="application/json")
elif a == 'listyc':#全部异常
objs = InspectItem.objects.filter(inspect__usecomp__partid=companyid).exclude(state='正常')
if req.GET.get("state", None):
objs = objs.filter(state=req.GET.get('state'))
if req.GET.get("qssj", None):
objs = objs.filter(inspect__creattime__gte=req.GET.get("qssj"))
if req.GET.get("jssj", None):
objs = objs.filter(inspect__creattime__lte=req.GET.get("jssj"))
# xjbm = req.GET.get('xjbm',None)
xjr = req.GET.get('xjr',None)
if xjr:
objs = objs.filter(inspect__user__name__contains=xjr)
# if xjbm or xjr:
# if xjr:
# objs = objs.filter(inspect__user__userid=xjr)
# else:
# parts = Partment.objects.filter(partid=xjbm) | Partment.objects.filter(
# partlink__contains=','+xjbm+',')
# objs = objs.filter(inspect__user__ubelongpart__in=parts)
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')