safesite/safesite/templates/departp.html

141 lines
6.7 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>
<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")
$(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 }}';
}
$('#infodiv').html('<p>'+name+'&nbsp;&nbsp;&nbsp;'+ date.startdate + '-' + date.enddate +'</p>')
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'){
$('#troublediv').html('<p>上报隐患共<span style="color:red;font-weight:bold">' + res.fx_count + '</span>条, 整改隐患<span style="color:red;font-weight:bold">' + res.zg_count + '</span>条.</p>')
}
else if(data.type == 'train'){
$('#traindiv').html('<p>需参加培训<span style="color:red;font-weight:bold">' + res.px_count + '</span>场, 参加并签到<span style="color:red;font-weight:bold">' + res.qd_count + '</span>场.</p>')
}
else if(data.type == 'operation'){
$('#operationdiv').html('<p>参与作业共<span style="color:red;font-weight:bold">' + res.zy_count + '</span>场, 其中身为作业负责人<span style="color:red;font-weight:bold">' + res.zyfzr_count + '</span>场.</p>')
}
else if(data.type == 'miss'){
$('#missdiv').html('<p>上报未遂事件共<span style="color:red;font-weight:bold">' + res.ws_count + '</span>件.</p>')
}
else if(data.type == 'suggest'){
$('#suggestdiv').html('<p>提出并被采纳的建议共<span style="color:red;font-weight:bold">' + res.jy_count + '</span>条, 本人处理了<span style="color:red;font-weight:bold">' + res.jycl_count + '</span>条.</p>')
}
else if(data.type == 'test'){
$('#testdiv').html('<p>共参加考试<span style="color:red;font-weight:bold">' + res.ks_count + '</span>场, 其中<span style="color:red;font-weight:bold">' + res.kstg_count + '</span>场通过.</p>')
}
else if(data.type == 'drill'){
$('#drilldiv').html('<p>共参加应急演练<span style="color:red;font-weight:bold">' + res.yl_count + '</span>场.')
}
else if(data.type == 'inspect'){
$('#inspectdiv').html('<p>共巡检设备<span style="color:red;font-weight:bold">' + res.xj_count + '</span>次, 其中<span style="color:red;font-weight:bold">' + res.xjyc_count + '</span>次发现异常.本人处理了<span style="color:red;font-weight:bold">'+ res.clyc_count+'</span>个异常</p>')
}
else if(data.type == 'cert'){
$('#certdiv').html('<p>拥有特种作业证书<span style="color:red;font-weight:bold">' + res.tz_count + '</span>张, 其中<span style="color:red;font-weight:bold">' + res.tzcq_count + '</span>张超期.</p><p>拥有安全证书<span style="color:red;font-weight:bold">'+ res.aq_count+'</span>张,其中<span style="color:red;font-weight:bold">' + res.aqcq_count + '</span>张超期.</p>')
}
}
},
error: function (errorMsg) {
//请求失败时执行该函数
//alert("汗,没有数据吧!");
}
});
}
</script>