safesite/safesite/templates/inspect.html

183 lines
8.6 KiB
HTML

<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(){
var option = $('#main').attr('value')
$('#xjtable').datagrid({url:'api/inspect',queryParams:{a:option}});
$("#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: '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){
// }
// }, 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 },
]]
});
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>