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.

610 lines
24 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>待办</title>
<link href="Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" />
<link href="Style/skin/css/style.css" rel="stylesheet" type="text/css" />
<link href="Style/skin/css/animate.css" rel="stylesheet" type="text/css" />
<link href="Style/skin/font/iconfont.css" rel="stylesheet" type="text/css" />
<script src="../DataUser/JSLibData/CommonShowConfig.js"></script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox-content">
<table class="table table-striped">
<thead>
<tr id="tablet">
</tr>
</thead>
<tbody id="Table1">
</tbody>
</table>
<div class="row">
<div class="col-sm-12">
<span id="Table2"></span>
</div>
</div>
</div>
</div>
<script language="JavaScript" src="Comm/JScript.js" type="text/javascript"></script>
<script type="text/javascript" src="Scripts/bootstrap/js/jquery.min.js"></script>
<script type="text/javascript" src="Scripts/bootstrap/js/bootstrap.min.js"></script>
<script src="Scripts/QueryString.js" type="text/javascript"></script>
<script src="Scripts/config.js" type="text/javascript"></script>
<script src="Comm/Gener.js" type="text/javascript"></script>
<script src="Scripts/layui/layui/lay/modules/layer.js" type="text/javascript"></script>
<!-- 处理多语言 -->
<script src="Data/lang/load.js" type="text/javascript"></script>
<script type="text/javascript">
var webUser = null;
var keyword = null;
var data = null;
var Hide_IsTodoList = getConfigByKey("Hide_IsTodoList", false);
var Hide_TodoListSearchWay = getConfigByKey("Hide_TodoListSearchWay", "ADT");
//页面启动函数.
$(function () {
if (webUser == null)
webUser = new WebUser();
if (webUser.No == null)
return;
//授权的情况下.
if (webUser.IsAuthorize == "1") {
SetHref("AuthorTodolist.htm");
return;
}
document.title = window.lang.daiban;
var handler = new HttpHandler("BP.WF.HttpHandler.WF");
handler.AddUrlData();
handler.AddPara("OrderBy", Hide_TodoListSearchWay);
data = handler.DoMethodReturnString("Todolist_Init");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
data = cceval('(' + data + ')');
BindTable();
});
function SearchIt() {
if (keyword == null)
keyword = "";
keyword = promptGener('请输入关键字', keyword);
if (keyword == null || keyword == undefined)
keyword = null;
BindTable();
}
//初始化数据.
function BindTable() {
//获取参数FlowNos为空时显示所有的待办否则显示参数中的流程
var flowNos = GetQueryString("FK_Flow");
//获取当前时间.
var cdt = getNowFormatDate();
var timeKey = Math.random();
//设置表头.
var groupBy = GetQueryString("GroupBy");
if (groupBy == "" || groupBy == null)
groupBy = "ByNode";
var nodeIDt = GetQueryString("FK_Node");
var tablet = "";
tablet += "<th style='width:40px;'>#</th>";
// title += "<th >优先级</th>";
tablet += "<th><div style='float:left' >" + window.lang.biaoti + "</div> <div style='float:right' ><img src='./Img/Search.png' style='width:24px;' onclick='SearchIt();' />&nbsp;&nbsp;&nbsp;</div></th>";
//我的流程分布
if (flowNos != null) {
tablet += "<th>" + window.lang.liucheng + "</th>";
tablet += "<th>" + window.lang.jiedian + "</th>";
groupBy = "ByFlowOfMy";
}
if (groupBy == "ByNode") {
tablet += "<th><a href='?FK_Node=" + nodeIDt + "&GroupBy=ByFlow' >" + window.lang.liucheng + "</th>";
tablet += "<th><a href='?FK_Node=" + nodeIDt + "&GroupBy=ByStarter' >" + window.lang.fqr + "</th>";
}
if (groupBy == "ByFlow") {
tablet += "<th><a href='?FK_Node=" + nodeIDt + "&GroupBy=ByNode' >" + window.lang.jiedian + "</th>";
tablet += "<th><a href='?FK_Node=" + nodeIDt + "&GroupBy=ByStarter' >" + window.lang.fqr + "</th>";
}
if (groupBy == "ByStarter") {
tablet += "<th><a href='?FK_Node=" + nodeIDt + "&GroupBy=ByFlow' >" + window.lang.liucheng + "</th>";
tablet += "<th><a href='?FK_Node=" + nodeIDt + "&GroupBy=ByNode' >" + window.lang.jiedian + "</th>";
}
tablet += "<th>" + window.lang.fqrq + "</th>";
tablet += "<th>" + window.lang.sdrq + "</th>";
tablet += "<th>" + window.lang.qixian + "</th>";
tablet += "<th>" + window.lang.zhuangtai + "</th>";
tablet += "<th>" + window.lang.leixing + "</th>";
tablet += "<th>" + window.lang.youxianji + "</th>";
$("#tablet").html(tablet);
//生成分组的字符串.
var str = "";
var listbox = '';
for (var i = 0; i < data.length; i++) {
if (groupBy == "ByNode" || groupBy == "NodeName") {
if (str.indexOf('@' + data[i].NodeName + "_" + data[i].FK_Node + "@") == -1) {
if (flowNos == null || (flowNos != null && flowNos.indexOf(data[i].FK_Flow) != -1))
str += "@" + data[i].NodeName + "_" + data[i].FK_Node + "@";
}
}
if (groupBy == "ByFlow") {
if (str.indexOf('@' + data[i].FlowName + "@") == -1) {
if (flowNos == null || (flowNos != null && flowNos.indexOf(data[i].FK_Flow) != -1))
str += "@" + data[i].FlowName + "@";
}
}
if (groupBy == "ByStarter") {
if (str.indexOf('@' + data[i].StarterName + "@") == -1) {
if (flowNos == null || (flowNos != null && flowNos.indexOf(data[i].FK_Flow) != -1))
str += "@" + data[i].StarterName + "@";
}
}
if (groupBy == "ByFlowOfMy") {
if (str.indexOf('@' + data[i].FlowName + "@") == -1) {
if (flowNos == null || (flowNos != null && flowNos.indexOf(data[i].FK_Flow) != -1))
str += "@" + data[i].FlowName + "@";
}
}
}
var strs = str.split("@"); //生成数组.
var num = 0;
var is1 = false;
var realCount = 0;
//获取所有的流程信息
var flows = new Entities("BP.WF.GenerWorkFlows");
//循环数组.
for (var idx = 0; idx < strs.length; idx++) {
var str = strs[idx];
if (str == "" || str == null)
continue;
var nodeID = 0;
var groupName = str;
// if (groupBy == "ByFlow")
// flows.Retrieve("FlowName", groupName);
if (groupBy == "ByNode") {
groupName = str.substring(0, str.indexOf("_"));
nodeID = str.substring(str.indexOf("_") + 1, 100);
// alert(nodeID);
// flows.Retrieve("NodeName", groupName);
}
listbox += "<tr>";
listbox += "<th colspan=8 class='table-title' onclick=\"GroupBarClick('" + groupName + "')\"> <i class='fa fa-minus-square' alert='Min' id='Img" + groupName + "'></i><span>" + groupName + "</span></th> ";
var showBatch = false;
//for (var j = 0; j < flows.length; j++) {
// var AtPara = flows[j].AtPara;
// if (AtPara.indexOf("IsCanBatch=1")!=-1)
// showBatch = true;
// }
if (groupBy == "ByNode")
showBatch = true;
if (showBatch) {
// var fk_node = strs[idx].substring(strs[idx].indexOf("_") + 1);
listbox += "<th colspan=1 class='table-title' onclick=\"javascript:Batch('" + nodeID + "')\" >批处理</th> ";
}
listbox += "<th colspan=2 class='table-title'></th> ";
listbox += "</tr>";
//增加处理.
for (var i = 0; i < data.length; i++) {
var work = data[i];
if (groupBy == "ByNode" || groupBy == "NodeName") {
if (work.FK_Node != nodeID) {
continue;
}
} else if (groupBy == "ByFlow" || groupBy == "ByFlowOfMy") {
if (work.FlowName != groupName) {
continue;
}
} else if (groupBy == "ByStarter") {
if (work.StarterName != groupName) {
continue;
}
} else {
continue;
}
//当参数flowNos不为空时流程编码存在于flowNos时显示
if (flowNos != null && flowNos.indexOf(data[i].FK_Flow) == -1)
continue;
realCount++;
var newRow = "";
var title = work.Title;
if (keyword != null) {
if (title.indexOf(keyword) == -1)
continue;
title = title.replace(keyword, '<font color=red><b>' + keyword + '</b></font>');
}
var isRead = work.IsRead;
var flowNo = work.FK_Flow;
var flowName = work.FlowName;
var nodeName = work.NodeName;
var starterName = work.StarterName;
var pri = work.PRI;
var nodeID = work.FK_Node;
var fid = work.FID;
var workID = work.WorkID;
var pWorkID = work.PWorkID;
var paras = work.AtPara;
if (paras == null)
paras = "";
var mystrs = "";
// AtPara atap = new AtPara(paras);
//if (paras.c)
paras = paras.replace("'", "\\'");
while (true) {
paras = paras.replace('@', '&');
if (paras.indexOf('@') < 0) {
break;
}
}
paras = "1" + paras;
//处理授权信息.
if (work.FK_Emp != webUser.No) {
paras += "&Auther=" + work.FK_Emp;
title = "<img src='./Img/zhuichiren.png' />" + title;
}
num++;
if (is1 == true) {
listbox += "<tr id='" + groupName + num + "' >";
is1 = false;
}
else {
listbox += "<tr id='" + groupName + num + "' >";
is1 = true;
}
listbox += "<td>" + num + "</td>"; //序号.
var url = "";
if (paras.indexOf("&IsCC=1") >= 0
|| paras.indexOf("&IsAuto=1") >= 0) {
var batchUrl = './WFRpt.htm?FK_Flow=' + flowNo + '&FK_Node=' + nodeID + '&WorkID=' + workID + '&FID=' + fid;
url = "<a href='#' onclick='WinOpenFull(\"" + batchUrl + "\")'>" + data[i].Title + "</a>";
} else {
if (isRead == 0)
url = "<a href=\"javascript:OpenWork('" + flowNo + "', " + nodeID + ", " + workID + ", " + pWorkID + ", " + fid + ", '" + title + "', 0, '" + paras + "');\" ><img class=Icon align='middle' src='Img/Mail_UnRead.png' />" + title + "</a>";
else
url = "<a href=\"javascript:OpenWork('" + flowNo + "', " + nodeID + ", " + workID + ", " + pWorkID + ", " + fid + ", '" + title + "', 1, '" + paras + "');\" ><img class=Icon align='middle' src='Img/Mail_Read.png' />" + title + "</a>";
}
listbox += "<td>" + url + "</td>"; //标题
if (groupBy == "ByNode" || groupBy == "NodeName") {
listbox += "<td>" + flowName + "</td>"; //流程类别
listbox += "<td>" + starterName + "</td>"; //发起人
} else if (groupBy == "ByFlow" || groupBy == "ByFlowOfMy") {
listbox += "<td>" + nodeName + "</td>"; //节点名称
listbox += "<td>" + starterName + "</td>"; //发起人
} else if (groupBy == "ByStarter") {
listbox += "<td>" + flowName + "</td>"; //流程类别
listbox += "<td>" + nodeName + "</td>"; //节点名称
}
listbox += "<td>" + work.RDT + "</td>"; //发起时间
listbox += "<td>" + work.ADT + "</td>"; //接受时间
listbox += "<td>" + work.SDT + "</td>"; //应完成时间
//为天业解决开始节点撤销回来后,就是逾期状态.
var len = nodeID.toString().length;
var entStr = nodeID.toString().substr(len - 2);
//判断期限是否少于三天,加警告颜色
var date = new Date();
var edt = work.SDT.replace(/\-/g, "/");
edt = new Date(Date.parse(edt.replace(/-/g, "/")));
passTime = GetSpanTime(date, edt);
//判断流程是否逾期
if (date.getTime() > edt.getTime() )//&& work.WFState == 2 && entStr != "01" && work.RDT != work.SDT
//&& paras.indexOf("&IsCC=1") == -1)
{
listbox += "<td><font color=red>" + window.lang.yuqi + "</font></td>";
}
else {
if (passTime >= 0 && passTime < 2 * 24 * 3600 * 1000) {
listbox += "<td><font color='#ffac38'>" + window.lang.jinggao + "</font></td>";
} else {
listbox += "<td><font color=green>" + window.lang.zhengchang + "</font></td>";
}
}
listbox += "<td>" + GetState(work.WFState, work.Auther) + "</td>";
listbox += "<td>" + GetPRI(work.PRI) + "</td>";
//备注
//newRow += "<td width='100'><div style='width:100px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;' title='" + work.FlowNote + "'>" + work.FlowNote + "</div></td>";
listbox += "</tr>";
}
}
// $("#Table1").after("<br><br><div style='float:left;' >合计:" + data.length + "条</div> <div style='float:right;' >[<a href='TaskPoolApply.htm' >共享任务池待办</a>][<a href='TodolistOfAuth.htm' >查看授权人的待办工作</a>]</div>");
$('#Table1').html(listbox);
$("#Table2").html(window.lang.heji + ": " + realCount + " " + (realCount > 1 ? window.lang.records : window.lang.record));
var div = window.parent.document.getElementById("Todolist_EmpWorks");
if (div != null) {
div.innerHTML = realCount;
}
}
//打开工作.
function OpenWork(flowNo, nodeID, workid, pWorkID, fid, title, isRead, paras) {
JumpFlowPage("MyFlow", title, workid, flowNo, nodeID, fid, pWorkID, isRead, paras);
return;
}
/**
* 为什么写到这里? Gener.js 是一个与其他任何业务模块无关的js文件.
* 执行跳转到MyFlow/MyView页面的判断方法:
* @param {any} title
* @param {any} workid
* @param {any} fk_flow
* @param {any} fk_node
* @param {any} fid
* @param {any} pworkid
*/
function JumpFlowPage(pageType, title, workid, fk_flow, fk_node, fid, pworkid, isread, paras) {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_" + pageType);
handler.AddPara("WorkID", workid);
handler.AddPara("FK_Flow", fk_flow);
handler.AddPara("FK_Node", fk_node);
handler.AddPara("FID", fid);
handler.AddPara("PWorkID", pworkid);
handler.AddPara("IsRead", isread);
handler.AddPara("Paras", paras);
var data = null;
data = handler.DoMethodReturnString(pageType + "_Init");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
if (data.indexOf('url@') == 0) {
data = data.replace('url@', ''); //如果返回url就直接转向.
data = data.replace('?DoType=HttpHandler', '?');
data = data.replace('&DoType=HttpHandler', '');
data = data.replace('&DoMethod=MyFlow_Init', '');
data = data.replace('&HttpHandlerName=BP.WF.HttpHandler.WF_MyFlow', '');
data = data.replace('?&', '?');
var url = data;
url = url.replace('/WF//WF/', '/WF/');
if (url.indexOf("http") == -1) {
if (url.indexOf('/WF/') == -1)
url = '/WF/' + url;
url = basePath + url;
}
try {
if (window.top.vm != undefined) {
window.top.vm.openTab(title, url);
return;
}
window.open(url); //打开流程.
} catch (e) {
data = data.replace('/WF//WF/', '/WF/');
window.open(data); //打开流程.
return;
}
}
}
function Batch(fk_node) {
var node = new Entity("BP.WF.Node", fk_node);
if (node.BatchRole == 0) {
layer.alert(node.Name + "没有启用批处理功能,如需批处理,请联系管理员在节点属性->表单设置->批处理中设置");
return;
}
var url = "";
url = "./WorkOpt/Batch/BatchList.htm?FK_Node=" + fk_node;
//审核组件模式.
if (node.BatchRole == 1)
url = "./WorkOpt/Batch/WorkCheckModel.htm?FK_Node=" + fk_node;
//审核分组模式.
if (node.BatchRole == 2)
url = "./WorkOpt/Batch/GroupFieldModel.htm?FK_Node=" + fk_node;
//自定义url模式.
if (node.BatchRole == 3)
url = node.BatchSelfUrl;
SetHref(url);
}
function GetState(wfState, auther) {
switch (parseInt(wfState)) {
case 1:
return "<font color=#bc65e0>" + window.lang.caogao + "</font>";
case 2:
if (auther != null && auther != undefined && auther != "")
return "<font color=orange>window.lang.auth</font>";
return "<font color=green>" + window.lang.daiban + "</font>";
break;
case 3: //已完成.
return window.lang.ywc;
break;
case 4:
return window.lang.guaqi;
case 5:
return "<font color=red>" + window.lang.tuihui + "</font>";
case 6:
return window.lang.zhuanfa;
case 7:
return window.lang.shanchu;
case 8:
return window.lang.jiaqian;
case 11:
return window.lang.jqhf;
default:
return window.lang.other;
}
}
//获取当前时间
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 hour = date.getHours();
if (hour >= 1 && hour <= 9) {
hour = "0" + hour;
}
var minute = date.getMinutes();
if (minute >= 1 && minute <= 9) {
minute = "0" + minute;
}
//当前时间=年份-月份-日 小时:分钟
var cdt = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + hour + seperator2 + minute;
return cdt;
}
function GetSpanTime(date1, date2) {
///<summary>计算date2-date1的时间差返回使用“x天x小时x分x秒”形式的字符串表示</summary>
var date3 = date2.getTime() - date1.getTime(); //时间差秒
// if (date1.getTime() > date2.getTime())
// date3 = date1.getTime() - date2.getTime();
return date3;
}
function GetPRI(PRI) {
switch (parseInt(PRI)) {
case 0:
return "<img title='低' src='Img/PRI/0.png' />";
case 1:
return "<img title='中' src='Img/PRI/1.png' />";
break;
case 2:
return "<img title='高' src='Img/PRI/2.png' />";
break;
}
}
function GroupBarClick(groupName) {
var alt = document.getElementById('Img' + groupName).alert;
var sta = 'block';
if (alt == 'Max') {
sta = 'block';
alt = 'Min';
classname = 'fa fa-minus-square';
} else {
sta = 'none';
alt = 'Max';
classname = 'fa fa-plus-square';
}
document.getElementById('Img' + groupName).className = classname;
document.getElementById('Img' + groupName).alert = alt;
var i = 0;
for (i = 0; i <= 600; i++) {
var row = document.getElementById(groupName + i);
if (row == null || row == undefined || row.style == null)
continue;
if (sta == 'block') {
row.style.display = '';
} else {
row.style.display = sta;
}
}
}
//打开默认窗口
function WinOpenFull(url) {
layer.open({
skin: 'layer-class',
type: 2,
title: '待办',
area: ['96%', '90%'],
content: url
});
}
function WinOpenIt(url) {
var self = window.open(url);
var loop = setInterval(function () {
if (self.closed) {
clearInterval(loop);
InitPage();
InitHomeCount();
}
}, 1);
}
</script>
</body>
</html>