软测单独项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
9.1 KiB

11 months ago
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>站内成绩排名</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
<link rel="stylesheet" href="../../css/public.css" media="all" />
<link rel="stylesheet" href="../../css/ztree/metro/ztree.css">
<script src="../../js/jquery-2.1.3.min.js" type="text/javascript"></script>
<script src="../../js/jquery.cookie.js" type="text/javascript"></script>
</head>
<body>
<!--<div id="trees" style=" position:absolute; top:0; bottom:0px; left:0; width:250px; min-height:500px; overflow-y:auto;">
<blockquote class="layui-elem-quote title">机构目录</blockquote>
<ul id="ztree" class="ztree"></ul>
</div>-->
<blockquote class="layui-elem-quote quoteBox">
<form class="layui-form">
<div class="layui-inline">
<div class="layui-input-inline" style="width: 300px;">
<select id="ORG_ID" lay-filter="ORG_ID" lay-search="" lay-verify="required">
<option value="">---请选择机构---</option>
</select>
</div>
<div class="layui-input-inline" style="width: 300px;">
<input type="text" class="layui-input" id="searchTime" placeholder="请选择日期" />
</div>
<a class="layui-btn search_btn" data-type="reload">搜索</a>
</div>
</form>
</blockquote>
<div class="layui-tab layui-tab-brief">
<ul class="layui-tab-title" id="SubjectUL">
</ul>
<div class="layui-tab-content" style="height: 650px;overflow-y: auto;" id="SubjectDiv">
</div>
</div>
<script src="../../js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script>
layui.config({
base: '../../js/'
}).use(['element', 'layer', 'table', 'laydate', 'form'], function () {
var layer = parent.layer === undefined ? layui.layer : top.layer,
$ = layui.jquery,
table = layui.table,
element = layui.element,
form = layui.form,
laydate = layui.laydate;
var OrgId = JSON.parse(window.sessionStorage.getItem("userInfo")).OrgID;
//var OrgId = "9668E5E778854EC3939246D6B6A9EFC1";
//获取当前日期区间(间隔30天)
function getFormatDate() {
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var premonth = date.getMonth() < 10 ? "0" + (date.getMonth()) : date.getMonth();
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
return year + "-" + premonth + "-" + day + " - " + year + "-" + month + "-" + day;
}
laydate.render({
elem: '#searchTime',
type: 'date',
value: getFormatDate(),
range: true
});
//初始化树
$.ajax({
type: "post",
url: "../../ashx/SysEmpHandler.ashx",
data: { Action: "OrgDeptTree", OrgId: OrgId },
dataType: "json",
success: function (result) {
var orgStr = "";
result.data.forEach(function (obj, index, arr) {
if (obj.TYPE == "org")
orgStr += "<option value='" + obj.ID + "'>" + obj.NAME + "</option>";
});
$("#ORG_ID").append(orgStr);
form.render('select');
$("#ORG_ID").siblings("div.layui-form-select").find('dl').find("dd[lay-value='" + OrgId + "']").click();
form.render('select');
var _orgid = $("#ORG_ID").val();
var startTime = "", endTime = "";
var searchTime = $("#searchTime").val();
if (searchTime) {
if (searchTime.indexOf(" - ") != -1) {
startTime = searchTime.split(" - ")[0]
endTime = searchTime.split(" - ")[1];
}
}
getScoreList(_orgid, startTime, endTime);
}
});
//搜索【此功能需要后台配合,所以暂时没有动态效果演示】
$(".search_btn").on("click", function () {
var _orgid = $("#ORG_ID").val();
var startTime = "", endTime = "";
var searchTime = $("#searchTime").val();
if (searchTime) {
if (searchTime.indexOf(" - ") != -1) {
startTime = searchTime.split(" - ")[0]
endTime = searchTime.split(" - ")[1];
}
}
getScoreList(_orgid, startTime, endTime);
});
function getScoreList(_orgid, _startTime, _endTime) {
if (_orgid == null) {
_orgid = $("#ORG_ID").val();
} if (_startTime == null) {
var searchTime = $("#searchTime").val();
if (searchTime) {
if (searchTime.indexOf(" - ") != -1) {
_startTime = searchTime.split(" - ")[0]
}
}
} if (_endTime == null) {
var searchTime = $("#searchTime").val();
if (searchTime) {
if (searchTime.indexOf(" - ") != -1) {
_endTime = searchTime.split(" - ")[1]
}
}
}
console.log("_orgid:" + _orgid + ",_startTime:" + _startTime + ",_endTime:" + _endTime);
if (_orgid == null || _orgid == "") _orgid = OrgId;
$.ajax({
type: "post",
async: false,
url: "../../ashx/TPlanHandler.ashx",
data: { Action: "GetSubject", OrgId: OrgId },
dataType: "json",
success: function (result) {
$("#SubjectUL").html("");
$("#SubjectDiv").html("");
var data = result.data;
for (var i = 0; i < data.length; i++) {
if (i == 0) {
$("#SubjectUL").append("<li class=\"layui-this\">" + data[i].NAME + "</li>");
} else {
$("#SubjectUL").append("<li>" + data[i].NAME + "</li>");
}
$.ajax({
type: "post",
async: false,
url: "../../ashx/TScoreHandler.ashx",
data: { Action: "GetScoreBySubjectid", subjectid: data[i].ID, OrgId: _orgid, startTime: _startTime, endTime: _endTime, company: data[i].UNITOFMEASUREMEN },
dataType: "json",
success: function (res) {
var data2 = res.data;
var tableHtml = "<table class=\"layui-table\"><colgroup><col width=\"80\"><col width=\"250\"><col width=\"250\"><col width=\"250\"><col width=\"250\"><col width=\"250\"><col></colgroup><thead><tr><th>名次</th><th>姓名</th><th>所属机构</th><th>成绩</th><th>评分</th><th>参训日期</th></tr></thead><tbody style=\"height:500px\">";
for (var y = 0; y < data2.length; y++) {
tableHtml += "<tr><td>" + (y + 1) + "</td><td>" + data2[y].USERS_NAME + "</td><td>" + data2[y].ORG_NAME + "</td><td>" + data2[y].RESULT + "</td><td>" + data2[y].ACHIEVEMENT + "</td><td>" + data2[y].TRAINIGDATE + "</td></tr>";
}
tableHtml += "</tbody></table>";
if (i == 0) {
$("#SubjectDiv").append("<div class=\"layui-tab-item layui-show\">" + tableHtml + "</div>");
} else {
$("#SubjectDiv").append("<div class=\"layui-tab-item\">" + tableHtml + "</div>");
}
}
})
}
}
});
}
})
</script>
</body>
</html>