442 lines
18 KiB
HTML
442 lines
18 KiB
HTML
<div id="yhtablebar" style="padding:4px;">
|
||
<div>
|
||
<label>快捷查询</label>
|
||
<select id='kjcxyh' style='width:150px;'>
|
||
<option value="">请选择</option>
|
||
<option value="listself">我的隐患</option>
|
||
<option value="listtodo">待办隐患</option>
|
||
<option value="listall">全部隐患</option>
|
||
</select>
|
||
<a onclick="javascript:$('#sdg_yh').dialog('open')" class="easyui-linkbutton" data-options="iconCls: 'fa-search',plain:true">详细筛选</a>
|
||
</div>
|
||
<div>
|
||
{% load myfilter %}
|
||
{% if request|has_permission:'b_trouble_add' %}
|
||
<a id="addyh" onclick="javascript:opendg('新增隐患','addtrouble?a=addyh')">新增</a>
|
||
{% endif %}
|
||
<a id="doyh" onclick="doyh()">处理</a>
|
||
<a id="delyh" onclick="delyh()">删除</a>
|
||
<a id="duibiao" class='easyui-linkbutton' onclick="duibiao()" data-options="iconCls: 'fa-thumb-tack',plain:true">对标</a>
|
||
|
||
<a id="detailyh2" onclick="detailyh()">查看详情</a>
|
||
|
||
{% if request|has_permission:'b_trouble_import' %}
|
||
<a onclick="javascript:$('#drtroubledg').dialog('open').window('center');" class="easyui-linkbutton"
|
||
data-options="iconCls:'fa-upload',plain:true">导入待整改隐患</a>
|
||
{% endif %}
|
||
{% if request|has_permission:'b_trouble_exportdoc' %}
|
||
<a id="exportword" onclick="exportyhword()">导出Word</a>
|
||
{% endif %}
|
||
|
||
{% if request|has_permission:'b_trouble_exportxls' %}
|
||
<a id="exportexcel" onclick="exportyhexcel()">导出Excel</a>
|
||
{% endif %}
|
||
</div>
|
||
<div id="sdg_yh" class="easyui-dialog" title="筛选条件" style="width:400px;height:420px;"
|
||
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:right;">
|
||
<form id='searchyhff' style="margin-right: 10px">
|
||
<div style="margin-top:4px"><label>起始时间</label><input name='qssj' id='qssjyh' style="width:300px"></div>
|
||
<div style="margin-top:4px"><label>结束时间</label><input name='jssj' id='jssjyh' style="width:300px"></div>
|
||
<div style="margin-top:4px">
|
||
<label>流程状态</label>
|
||
<select name='yhzt' id='syhzt' style="width:300px">
|
||
<option value="">请选择</option>
|
||
<option value="0">待新增</option>
|
||
<option value="1">待评估</option>
|
||
<option value="7">措施/方案待提交</option>
|
||
<option value="2">措施/方案待确认</option>
|
||
<option value="3">待整改</option>
|
||
<option value="4">待审核</option>
|
||
<option value="5">待复查</option>
|
||
<option value="6">已归档</option>
|
||
</select>
|
||
</div>
|
||
<div style="margin-top:4px"><label>隐患大类</label><input name='yhlx' id="syhlx" style="width:300px;" /></div>
|
||
<div style="margin-top:4px"><label>隐患类别</label><input name='yhlb' id="syhlb" style="width:300px;" /></div>
|
||
<div style="margin-top:4px"><label>检查类型</label><input name='jclx' id="sjclx" style="width:300px;" /></div>
|
||
<div style="margin-top:4px"><label>隐患评估</label><input name='yhpg' id="syhpg" style="width:300px;" /></div>
|
||
<div style="margin-top:4px"><label>发现部门</label><input id="sfxbm" name="fxbm" style="width:300px;" /></div>
|
||
<div style="margin-top:4px"><label>发现人</label><input name="fxrname" style="width:300px" class="easyui-textbox"/></div>
|
||
<div style="margin-top:4px"><label>整改部门</label><input id="szgbm" name="zgbm" style="width:300px" /></div>
|
||
</form>
|
||
</div>
|
||
<div id='southdiv' data-options="region:'south'" style="height:44px;text-align:center;padding:4px">
|
||
<a id="yhsearch" onclick="yhsearch()">查询</a>
|
||
<a id="searchreset" onclick="reset()" class="easyui-linkbutton">重置</a>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<table id="yhtable" style="width:100%;height:100%;"></table>
|
||
<div id="drtroubledg" class="easyui-dialog" title="导入隐患" style="width:400px;height:200px;"
|
||
data-options="iconCls:'fa-upload',resizable:true,modal:true,closed:true,border:false">
|
||
<p style="color:red;margin-left: 10px">请按模板录入后导入</p>
|
||
<p style="margin-left: 10px"><a href="/static/safesite/muban/trouble.xlsx" target="_blank">点击下载模板</a></p>
|
||
<p style="margin-left: 10px">录入完成后点击下方按钮上传文件</p>
|
||
<input type="file" id="drfile" name="" accept=".xls,.xlsx" style="margin-left: 10px" />
|
||
</div>
|
||
<!-- <a id="downa" href="" target="_blank" style="display:none"></a> -->
|
||
<script>
|
||
$(function () {
|
||
// var option = $('#main').attr('value')
|
||
var searchStr = sessionStorage.getItem("trouble");
|
||
|
||
var queryParams = {'a':'listall'}
|
||
if(searchStr){
|
||
var lls = JSON.parse(searchStr)
|
||
queryParams = Object.assign(queryParams, lls)
|
||
}
|
||
$('#yhtable').datagrid({ url: 'troublehandle', queryParams: queryParams });
|
||
$("#searchyhff").form('clear');
|
||
})
|
||
|
||
$('#yhtable').datagrid({
|
||
rownumbers: true,
|
||
singleSelect: true,
|
||
striped: true,
|
||
method: 'get',
|
||
url: '',
|
||
fitColumns: true,
|
||
pagination: true,
|
||
pageSize: 20,
|
||
toolbar: '#yhtablebar',
|
||
border: false,
|
||
columns: [[
|
||
{ field: 'troubleid', hidden: true },
|
||
{ field: 'yhnum', title: '编号', width: 100 },
|
||
{
|
||
field: 'yhzt', title: '流程状态', width: 100, 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: 'todouser__name', title: '下一步处理人', width: 80 },
|
||
{ field: 'yhdj__dickeyname', title: '隐患等级', width: 80 },
|
||
{ field: 'yhlb__dickeyname', title: '隐患类别', width: 80 },
|
||
{ field: 'yhpg__dickeyname', title: '隐患评估', width: 80 },
|
||
{ field: 'fxr__name', title: '发现人', width: 80 },
|
||
{ field: 'yhms', title: '隐患描述', width: 150 },
|
||
{ field: 'todouser__userid', hidden: true },
|
||
{ field: 'sybzt', hidden: true },
|
||
{
|
||
field: 'shresult', title: '隐患状态', width: 100, styler: function (value, row, index) {
|
||
switch (value) {
|
||
case 1: return ''; break;
|
||
case 2: return 'color:red;font-weight:bold'; break;
|
||
case 3: return 'color:red;font-weight:bold'; break;
|
||
case 4: return 'color:orange;font-weight:bold'; break;
|
||
case 6: return 'color:orange;font-weight:bold'; break;
|
||
}
|
||
let zgqx = new Date(row.zgqx);
|
||
if (new Date() > zgqx && row.yhzt == 3) {
|
||
return 'color:red;font-weight:bold'
|
||
}
|
||
}, formatter: function (value, row, index) {
|
||
switch (value) {
|
||
case 1: return ''; break;
|
||
case 2: return '审核未通过'; break;
|
||
case 3: return '复查未通过'; break;
|
||
case 4: return '已修改'; break;
|
||
case 5: return '评估未通过'; break;
|
||
case 6: return '未采纳'; break;
|
||
}
|
||
let zgqx = new Date(row.zgqx);
|
||
if (new Date() > zgqx && row.yhzt == 3) {
|
||
return '超期未整改'
|
||
}
|
||
}
|
||
},
|
||
{ field: 'tbsj', title: '提交时间', width: 100 },
|
||
]]
|
||
});
|
||
$('#kjcxyh').combobox({
|
||
editable: false,
|
||
onSelect: function (node) {
|
||
if (node.value != '') {
|
||
$('#yhtable').datagrid({ url: 'troublehandle', queryParams: { a: node.value } });
|
||
}
|
||
|
||
}
|
||
})
|
||
$('#wdyh').linkbutton({
|
||
iconCls: 'icon-man',
|
||
plain: true
|
||
});
|
||
$('#detailyh2').linkbutton({
|
||
iconCls: 'fa-info-circle',
|
||
plain: true
|
||
});
|
||
$('#yhsearch').linkbutton({
|
||
iconCls: 'fa-search',
|
||
});
|
||
$('#exportword').linkbutton({
|
||
iconCls: 'fa-download',
|
||
plain: true
|
||
});
|
||
$('#exportexcel').linkbutton({
|
||
iconCls: 'fa-download',
|
||
plain: true
|
||
});
|
||
$('#addyh').linkbutton({
|
||
iconCls: 'fa-plus',
|
||
plain: true
|
||
});
|
||
$('#delyh').linkbutton({
|
||
iconCls: 'fa-trash',
|
||
plain: true
|
||
});
|
||
$('#doyh').linkbutton({
|
||
iconCls: 'fa-flash',
|
||
plain: true
|
||
});
|
||
$("#qssjyh").datebox({
|
||
editable: false
|
||
});
|
||
$("#jssjyh").datebox({
|
||
editable: false
|
||
});
|
||
$("#syhzt").combobox({
|
||
editable: false
|
||
});
|
||
$("#syhlb").combobox({
|
||
editable: false
|
||
});
|
||
$("#sfxr").combobox({
|
||
editable: false
|
||
});
|
||
$("#syhlx").combobox({
|
||
url: 'getdicclass?dicid=15',
|
||
editable: false,
|
||
onSelect: function (node) {
|
||
$('#syhlb').combobox({
|
||
url: 'getdickey?dicclass=' + node.value + '&a=combobox',
|
||
editable: false,
|
||
});
|
||
}
|
||
});
|
||
$("#sjclx").combobox({
|
||
url: 'getdickey?dicclass=14&a=combobox',
|
||
valueField: 'value',
|
||
textField: 'text',
|
||
editable: false,
|
||
});
|
||
$("#syhpg").combobox({
|
||
url: 'getdickey?dicclass=19&a=combobox',
|
||
editable: false,
|
||
});
|
||
// $.get('parthandle?a=tree',function(res){
|
||
// var data = convert(res);
|
||
// $('#sfxbm,#szgbm').combotree();
|
||
// $("#sfxbm").combotree('loadData',data);
|
||
// $("#szgbm").combotree('loadData',data);
|
||
// })
|
||
$("#sfxbm").combotree({
|
||
url: 'parthandle?a=tree',
|
||
editable: false,
|
||
loadFilter: function (rows) {
|
||
return convert(rows);
|
||
},
|
||
});
|
||
$("#szgbm").combotree({
|
||
url: 'parthandle?a=tree',
|
||
editable: false,
|
||
loadFilter: function (rows) {
|
||
return convert(rows);
|
||
},
|
||
});
|
||
function detailyh() {
|
||
var row = $('#yhtable').datagrid('getSelected');
|
||
if (row) {
|
||
url = 'troublehandle?a=detailhtml&troubleid=' + row.troubleid
|
||
opendg('查看详情', url)
|
||
}
|
||
else { $.messager.alert('提示', '请选择一行数据!'); }
|
||
}
|
||
|
||
function exportyhword() {
|
||
var row = $('#yhtable').datagrid('getSelected');
|
||
if (row) {
|
||
$.ajax({
|
||
type: "GET",
|
||
url: 'troublehandle?a=exportword&troubleid=' + row.troubleid,
|
||
datatype: "json",
|
||
async: false,
|
||
beforeSend: function () {
|
||
loading()
|
||
},
|
||
success: function (data) {
|
||
removeLoading();
|
||
if (data.code == 1) {
|
||
//$('#downa').attr('href', downloadurl);
|
||
//document.getElementById("downa").click();
|
||
window.open(data.downloadurl);
|
||
}
|
||
else {
|
||
$.messager.alert('提示', '导出Word失败!');
|
||
}
|
||
},
|
||
complete: function (XMLHttpRequest, textStatus) {
|
||
},
|
||
error: function () {
|
||
}
|
||
});
|
||
}
|
||
else { $.messager.alert('提示', '请选择一行数据!'); }
|
||
}
|
||
function yhsearch() {
|
||
var querydata = $('#searchyhff').serializeJSON();
|
||
querydata.a = 'listall'
|
||
$('#sdg_yh').dialog('close')
|
||
$('#yhtable').datagrid('load', querydata);
|
||
|
||
}
|
||
function reset() {
|
||
$('#searchyhff').form('clear')
|
||
$('#yhtable').datagrid('options').queryParams={
|
||
a:'listall'
|
||
}
|
||
$('#yhtable').datagrid('load');
|
||
|
||
}
|
||
function exportyhexcel() {
|
||
var querydata = $('#searchyhff').serializeJSON();
|
||
let url = 'troublehandle?a=exportexcel&' + parseParams(querydata)
|
||
window.open(url);
|
||
// $('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
|
||
}
|
||
function delyh() {
|
||
var row = $('#yhtable').datagrid('getSelected');
|
||
if (row) {
|
||
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
||
if (r) {
|
||
$.ajax({
|
||
type: "POST",
|
||
url: 'troublehandle?a=del',
|
||
data: { 'troubleid': row.troubleid },
|
||
datatype: "json",
|
||
beforeSend: function () { },
|
||
success: function (data) {
|
||
if (data.code == 1) {
|
||
$("#yhtable").datagrid('reload');
|
||
}
|
||
else {
|
||
$.messager.alert('提示', '流程已进行,您无权删除!');
|
||
}
|
||
},
|
||
});
|
||
}
|
||
});
|
||
}
|
||
else { $.messager.alert('提示', '请选择一条数据!'); }
|
||
}
|
||
function doyh() {
|
||
var row = $('#yhtable').datagrid('getSelected');
|
||
if (row) {
|
||
if (row.yhzt != 6) {
|
||
if ($("#userindex").attr('userid') == row.todouser__userid) {
|
||
if (row.yhzt == 0) {
|
||
opendg('编辑隐患', 'addtrouble?a=edityh&troubleid=' + row.troubleid)
|
||
} else {
|
||
var troubleid = row.troubleid;
|
||
var yhzt = row.yhzt;
|
||
var url = 'accesstrouble?troubleid=' + troubleid + '&yhzt=' + yhzt;
|
||
opendg('处理隐患', url)
|
||
}
|
||
} else { $.messager.alert('提示', '该条您无权操作!'); }
|
||
|
||
|
||
} else { $.messager.alert('提示', '无需处理!'); }
|
||
}
|
||
else { $.messager.alert('提示', '请选择一条数据!'); }
|
||
|
||
}
|
||
function duibiao() {
|
||
var row = $('#yhtable').datagrid('getSelected');
|
||
if (row) {
|
||
loading('正在比对,请稍等..');
|
||
$.post('api/duibiao', { 'yhms': row.yhms }, function (result, status) {
|
||
if (result.code = 1) {
|
||
html = '<p style="color:red;margin-left: 10px">根据您的描述,搜索到以下安标结果:</p>'
|
||
for (var j = 0, len = result.data.length; j < len; j++) {
|
||
html = html + '<p style="margin-left: 10px;margin-right: 10px">' + result.data[j] + '</p>'
|
||
}
|
||
$("<div/>").dialog({
|
||
title: '对标结果',
|
||
width: 800,
|
||
height: 400,
|
||
closed: false,
|
||
cache: false,
|
||
content: html,
|
||
modal: true,
|
||
border: false,
|
||
onClose: function () {
|
||
$(this).dialog('close');
|
||
}
|
||
});
|
||
}
|
||
removeLoading()
|
||
});
|
||
}
|
||
else { $.messager.alert('提示', '请选择一行数据!'); }
|
||
}
|
||
document.getElementById('drfile').onchange = function () {
|
||
var fileObj = this.files[0];
|
||
var url = 'drapi?a=todotrouble'
|
||
var form = new FormData();
|
||
form.append("upfile", fileObj); // 文件对象
|
||
xhr = new XMLHttpRequest(); // XMLHttpRequest 对象
|
||
xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
|
||
xhr.send(form)
|
||
$('#drtroubledg').dialog('close')
|
||
loading('导入中。。');
|
||
xhr.onload = function (evt) { //服务断接收完文件返回的结果
|
||
var data = JSON.parse(evt.target.responseText);
|
||
removeLoading();
|
||
if (data.code == 1) {
|
||
$.messager.alert('提示', '上传成功!', 'info', function () {
|
||
$("#yhtable").datagrid('reload');
|
||
});
|
||
}
|
||
else if (data.code == 2) {
|
||
$.messager.alert('警告', data.msg, 'info', function () {
|
||
$("#yhtable").datagrid('reload');
|
||
});
|
||
}
|
||
else {
|
||
$.messager.alert('提示', '失败!文件内容有误');
|
||
}
|
||
document.getElementById('drfile').value = '';
|
||
|
||
}; //请求完成
|
||
xhr.onerror = function (evt) { $.messager.alert('提示', '失败!文件内容有误'); document.getElementById('drfile').value = ''; }; //请求失败
|
||
}
|
||
</script>
|
||
|
||
</body>
|
||
|
||
</html> |