safesite/safesite/templates/inspectitem.html

167 lines
7.1 KiB
HTML

<table id="ycitemtable" style="width:auto;height:100%;"></table>
<a id="downa" href="" target="_blank" style="display:none"></a>
<div id="ycitemtablebar" style="padding: 4px">
<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="异常待处理">异常待处理</option>
<option value="异常已处理">异常已处理</option>
</select>
<a id="xjycsearch" onclick="xjycsearch()" class="easyui-linkbutton" data-options="iconCls: 'fa-search'">查询</a>
<a id="xjycreset" 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 %}
{% 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 %} -->
<a id="xjdetail2" onclick="xjdetail2()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查看详情</a>
</div>
</div>
<script>
$(function(){
var searchStr = sessionStorage.getItem("inspectitem");
var queryParams = {'a':'listyc'}
if(searchStr){
var lls = JSON.parse(searchStr)
queryParams = Object.assign(queryParams, lls)
sessionStorage.removeItem("inspectitem")
}
$('#ycitemtable').datagrid({url:'api/inspectitem',queryParams:queryParams});
$("#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){
$('#ycitemtable').datagrid({url:'api/inspect',queryParams:{a:node.value}});
}
}
});
function xjycsearch() {
var querydata = $('#searchxjff').serializeJSON();
querydata['a'] = 'listyc'
$('#ycitemtable').datagrid('load',querydata);
}
function reset() {
$('#searchxjff').form('clear')
$('#ycitemtable').datagrid('options').queryParams = {
a:'listyc'
}
$('#ycitemtable').datagrid('load');
}
$('#ycitemtable').datagrid({
url: '',
rownumbers: true,
singleSelect: true,
striped: true,
fitColumns: true,
method: 'get',
pagination: 'true',
pageSize: 20,
toolbar: '#ycitemtablebar',
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: 'inspect__user__name', title: '巡检人', width: 80 },
{ field: 'todouser__name', title: '处理人', width: 80 },
{ field: 'inspect__creattime', title: '提交时间', width: 100 },
]]
});
function xjdetail(){
var row = $('#ycitemtable').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 = $('#ycitemtable').datagrid('getSelected');
if (row) {
var url = 'api/inspect?a=del&id=' + row.id
$.get(url,function(res){
if(res.code==1){
$('#ycitemtable').datagrid('reload')
}else{
$.messager.alert('提示', '没有权限!');
}
})
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
function xjdetail2(){
var row = $('#ycitemtable').datagrid('getSelected');
if (row) {
var url = 'html/inspectitem/detail/' + row.id
opendg('查看详情',url)
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
</script>