You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
8.0 KiB
Plaintext

11 months ago
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>授权详细信息</title>
<link href="../../WF/Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
<link href="../../WF/Scripts/bootstrap/css/components-rounded.css" rel="stylesheet" />
<link href="../../WF/Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" />
<link href="../../WF/Scripts/bootstrap/css/themes/default/style.min.css" rel="stylesheet" />
<script type="text/javascript" src="../../WF/Scripts/QueryString.js"></script>
<script type="text/javascript" src="../../WF/Scripts/QueryString.js"></script>
<script type="text/javascript" src="../../WF/Scripts/bootstrap/js/jquery.min.js"></script>
<script type="text/javascript" src="../../WF/Scripts/bootstrap/js/jquery.cokie.min.js"></script>
<script type="text/javascript" src="../../WF/Scripts/bootstrap/js/bootstrap.min.js"></script>
<link href="../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<!--时间-->
<script src="../../WF/Comm/JS/Calendar/WdatePicker.js" type="text/javascript"></script>
<link href="../../WF/Comm/JS/Calendar/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
<!-- 导入配置文件. -->
<script type="text/javascript" src="../../WF/Scripts/config.js"></script>
<script type="text/javascript" src="../../WF/Comm/Gener.js"></script>
<script type="text/javascript" language="javascript">
//页面启动函数.
var webUser = null;
var emp = null;
$(function () {
webUser = new WebUser();
var ens = new Entities("BP.WF.Auths");
ens.Retrieve("Auther", webUser.No);
var html = "<div class='container'>";
html += "<div class='fixed-table-header '>";
html += "<table class='table table-hover table-striped ' >";
html += "<caption style='height:auto;text-indent: 0em;'> [" + webUser.No + "]授权列表 <a href='AuthorDtl.htm' >+增加授权列表</a> </caption>";
html += "<thead ><tr> ";
html += "<th style='background-color:#F2F2F2;'>序</th>";
html += "<th style='background-color:#F2F2F2;'>授权给</th>";
html += "<th style='background-color:#F2F2F2;'>授权类型</th>";
html += "<th style='background-color:#F2F2F2;'>流程</th>";
html += "<th style='background-color:#F2F2F2;'>收回日期</th>";
html += "<th style='background-color:#F2F2F2;'>状态</th>";
html += "<th colspan='2' style='background-color:#F2F2F2;text-align:center'>操作</th>";
html += "</tr></thead>";
html += "<tbody>";
var takeBackDT = "";
var num = 1;
for (var i = 0; i < ens.length; i++) {
en = ens[i];
//指定流程时,授权时间不同,可能会有多条合并流程的记录
if (en.AuthType == 2) {
if (takeBackDT.indexOf(en.TakeBackDT + ",") != -1) {
continue;
}
takeBackDT += en.TakeBackDT + ",";
}
var AuthType = en.AuthType;
var AuthTypeName;
switch (AuthType) {
case 0: AuthTypeName = '不授权'; break;
case 1: AuthTypeName = '全部流程授权'; break;
case 2: AuthTypeName = '指定流程授权'; break;
default: AuthTypeName = '空';
}
var nowDate = getNowFormatDate();
var state = "";
if (checkTime(nowDate,en.TakeBackDT)) {
state = "<lable style='color:green'>授权中</lable>";
} else {
state = "<lable style='color:red'>已收回</lable>";
}
html += "<tr>";
html += "<td>" + num + "</td>";
html += "<td>" + en.AutherToEmpName + "</td>";
html += "<td>" + AuthTypeName + "</td>";
var flowNames = "";
if (en.AuthType == 2) {
flowNames = GetFlowNames(ens, en);
html += "<td>" + flowNames + "</td>";
} else {
html += "<td></td>";
}
html += "<td>" + en.TakeBackDT + "</td>";
html += "<td>" + state + "</td>";
var MyPK = en.Auther + "_" + en.AuthType + "_" + en.AutherToEmpNo;
if (en.AuthType == 2)
html += "<td style='text-align:center'><a href=\"javascript:Del('" + MyPK + "','" + flowNames +"')\">删除</a></td>";
else
html += "<td style='text-align:center'><a href=\"javascript:Del('" + MyPK + "')\">删除</a></td>";
// html += "<td style='text-align:center'><a href='AuthorDtl.htm?UpdateInfo=1&AutherToEmpNo=" + en.AutherToEmpNo + "&AutherToEmpName=" + en.AutherToEmpName + "&AuthType=" + en.AuthType + "&TakeBackDT=" + en.TakeBackDT+"' >修改</a></td>";
html += "</tr>";
num++;
}
html += "</tbody>";
html += "</table>";
html += "</div>";
html += "</div>";
$("#docs").html(html);
});
function GetFlowNames(auths,auth) {
var items = $.grep(auths, function (item) {
return item.AuthType == 2 && auth.TakeBackDT == item.TakeBackDT;
});
var flowNames = [];
items.forEach(function (item) {
flowNames.push(item.FlowNo+"."+item.FlowName);
});
return flowNames.join(",")
}
//执行删除.
function Del(MyPK, flowNames) {
if (window.confirm('您确定要删除吗?') == false)
return;
if (flowNames == null || flowNames == "") {
var Auth = new Entity("BP.WF.Auth", MyPK);
var res = Auth.Delete();
if (res.indexOf("err@")==-1) {
alert("删除成功");
Reload();
}
else {
alert("删除失败");
}
return;
}
var auth = new Entity("BP.WF.Auth");
var isSuccess = true;;
flowNames.split(",").forEach(function (item) {
if (item != "") {
var strs = item.split(".");
var res = auth.Delete("MyPK", MyPK + "_" + strs[0]);
if (res == 0)
isSuccess = false;
}
});
if (isSuccess == false)
alert("删除失败");
Reload();
}
//获取当前时间
function getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
//当前时间=年份-月份-日 小时:分钟
var cdt = date.getFullYear() + seperator1 + month + seperator1 + strDate;
//+ " " + date.getHours() + seperator2 + date.getMinutes();
return cdt;
}
//比较时间
function checkTime(startDT,endDT) {
var startTime = startDT;
var start = new Date(startTime.replace("-", "/").replace("-", "/"));
var endTime = endDT;
var end = new Date(endTime.replace("-", "/").replace("-", "/"));
if (end < start) {
return false;
}
return true;
}
</script>
</head>
<body onkeypress="Esc()" class="gray-bg">
<form id="cc" name="cc">
<div id="docs"></div>
</form>
</body>
</html>