增加offence页面

This commit is contained in:
caoqianming 2021-05-08 17:09:32 +08:00
parent 694a9411d7
commit 0c8969dac6
2 changed files with 119 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,119 @@
<table id="offencetable" style="width:auto;height:100%;"></table>
<a id="downa" href="" target="_blank" style="display:none"></a>
<div id="offencetablebar" style="padding: 4px">
<div >
<form id='searchoffenceff'>
<!-- <label>巡检部门</label><input id="sxjbm" name="xjbm" editable=false /> -->
<label>提交时间</label><input name='qssj' id='sqssj' class="easyui-datebox" editable=false>-<input name='jssj' id='sjssj'
class="easyui-datebox" editable=false>
<a id="offencesearch" onclick="offencesearch()" 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 %}
{% 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="offencedetail" onclick="offencedetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查看详情</a>
</div>
</div>
<script>
$(function(){
$('#offencetable').datagrid({url:'api/inspectitem',queryParams:{a:'listyc'}});
$("#searchoffenceff").form('clear');
})
function offencesearch() {
var querydata = $('#searchoffenceff').serializeJSON();
querydata['a'] = 'listyc'
$('#offencetable').datagrid('load',querydata);
}
function reset() {
$('#searchoffenceff').form('clear')
$('#offencetable').datagrid('options').queryParams = {
a:'listyc'
}
$('#offencetable').datagrid('load');
}
$('#offencetable').datagrid({
url: '',
rownumbers: true,
singleSelect: true,
striped: true,
fitColumns: true,
method: 'get',
pagination: 'true',
pageSize: 20,
toolbar: '#offencetablebar',
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 exportxjexcel() {
var querydata = $('#searchoffenceff').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 = $('#offencetable').datagrid('getSelected');
if (row) {
var url = 'api/inspect?a=del&id=' + row.id
$.get(url,function(res){
if(res.code==1){
$('#offencetable').datagrid('reload')
}else{
$.messager.alert('提示', '没有权限!');
}
})
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
function offencedetail(){
var row = $('#offencetable').datagrid('getSelected');
if (row) {
var url = 'html/inspectitem/detail/' + row.id
opendg('查看详情',url)
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
</script>