safesite/safesite/templates/personalp.html

296 lines
12 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>
<table border="1" style="margin: auto">
<tr>
<th>指标</th>
<th id="pname" width="400px">本人</th>
</tr>
<tr>
<th>上报隐患</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('trouble', 'fxr', 'qssj', 'jssj')" id="troublediv1">0</a>
</th>
</tr>
<tr>
<th>整改隐患</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('trouble', 'zgr', 'qssj', 'jssj')" id="troublediv2">0</a>
</th>
</tr>
<tr>
<th>参加培训</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('train', 'participant', 'qssj', 'jssj')" id="traindiv1">0</a>
</th>
</tr>
<tr>
<th>参与作业</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('operation', 'zyry', 'qssj', 'jssj')" id="operationdiv1">0</a>
</th>
</tr>
<tr>
<th>作业负责人</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('operation', 'zyfzr', 'qssj', 'jssj')" id="operationdiv2">0</a>
</th>
</tr>
<tr>
<th>上报未遂</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('miss', 'misser', 'qssj', 'jssj')" id="missdiv1">0</a>
</th>
</tr>
<tr>
<th>提出建议</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('suggest', 'jyr', 'qssj', 'jssj')" id="suggestdiv1">0</a>
</th>
</tr>
<tr>
<th>处理建议</th>
<th >
<a href="javascript:void(0);" onclick="goDetail('suggest', 'clr', 'qssj', 'jssj')" id="suggestdiv2">0</a>
</th>
</tr>
<tr>
<th>参加考试</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('examtest', 'user', 'starttime1', 'starttime2')" id="testdiv1">0</a>
</th>
</tr>
<tr>
<th>通过考试</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('examtest', 'user_tg', 'starttime1', 'starttime2')" id="testdiv2">0</a>
</th>
</tr>
<tr>
<th>参加演练</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('drill', 'participant', 'qssj', 'jssj')" id="drilldiv1">0</a>
</th>
</tr>
<tr>
<th>巡检设备</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('inspect', 'xjr', 'qssj', 'jssj')" id="inspectdiv1">0</a>
</th>
</tr>
<tr>
<th>发现设备异常</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('inspect', 'xjr_0', 'qssj', 'jssj')" id="inspectdiv2">0</a>
</th>
</tr>
<tr>
<th>处理设备异常</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('inspectitem', 'todouser_0', 'qssjx', 'jssjx')" id="inspectdiv3">0</a>
</th>
</tr>
<tr>
<th>有效安全证书</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('safecert', 'user', 'qssj', 'jssj')" id="certdiv1">0</a>
</th>
</tr>
<tr>
<th>有效作业证书</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('socert', 'user', 'qssj', 'jssj')" id="certdiv2">0</a>
</th>
</tr>
</table>
<!-- <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")
var useridx = '{{ user.userid }}';
var namex = '{{user.name}}'
$('#pname').html(namex)
var querydatax = {}
$(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 }}';
}
$('#pname').html(name + '&nbsp;&nbsp;&nbsp;' + date.startdate + '至' + date.enddate)
if(date.userid){
useridx = date.userid
}
querydatax = date
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') {
$('#troublediv1').html(res.fx_count)
$('#troublediv2').html(res.zg_count)
}
else if (data.type == 'train') {
$('#traindiv1').html(res.px_count)
}
else if (data.type == 'operation') {
$('#operationdiv1').html(res.zy_count)
$('#operationdiv2').html(res.zyfzr_count)
}
else if (data.type == 'miss') {
$('#missdiv1').html(res.ws_count)
}
else if (data.type == 'suggest') {
$('#suggestdiv1').html(res.jy_count)
$('#suggestdiv2').html(res.jycl_count)
}
else if (data.type == 'test') {
$('#testdiv1').html(res.ks_count)
$('#testdiv2').html(res.kstg_count)
}
else if (data.type == 'drill') {
$('#drilldiv1').html(res.yl_count)
}
else if (data.type == 'inspect') {
$('#inspectdiv1').html(res.xj_count)
$('#inspectdiv2').html(res.xjyc_count)
$('#inspectdiv3').html(res.clyc_count)
}
else if (data.type == 'cert') {
$('#certdiv1').html(res.aq_count)
$('#certdiv2').html(res.tz_count)
}
}
},
error: function (errorMsg) {
//请求失败时执行该函数
//alert("汗,没有数据吧!");
}
});
}
function goDetail(k1, k2, k3, k4) {
var options = {
'trouble': ['事故隐患', '/troublehtml'],
'operation': ['作业许可', '/html/operation'],
'train': ['线下培训', '/trainhtml'],
'miss': ['未遂事件', '/misshtml'],
'suggest': ['合理化建议', '/html/suggest'],
'drill': ['应急演练', '/drillhtml'],
'examtest': ['在线考试', '/html/examtest'],
'inspect': ['巡检记录', '/html/inspect'],
'inspectitem': ['异常处理', '/html/inspectitem'],
'safecert':['安全资格证书', '/html/safecert'],
'socert':['特种作业证书', '/socerthtml']
}
var myquerydata={}
if(querydatax.startdate){
myquerydata[k3]= querydatax.startdate
}
if(querydatax.enddate){
myquerydata[k4]= querydatax.enddate
}
myquerydata[k2] = useridx
var title = options[k1][0]
if ($('#tt').tabs('exists', title)) {
sessionStorage.setItem(k1, JSON.stringify(myquerydata))
$('#tt').tabs('select', title);
var tab = $('#tt').tabs('getSelected');
tab.panel('refresh');
} else {
$('#tt').tabs('add', {
title: title,
href: options[k1][1],
closable: true,
});
}
}
</script>