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.

477 lines
16 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" />
</head>
<style>
/*设置表格内容过长,用省略号代替多余部分,前提:table的style属性*/
td {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox-content">
<div class="row search-padding">
<div class="col-md-8 col-sm-8">
<div id="TSpan"></div>
</div>
<div class="col-md-4 col-sm-4 pull-right">
<div class="form-inline">
<div class="form-group">
<input type='text' placeholder="请输入关键词" id='TB_Key' class="form-control" />
</div>
<button class="btn btn-success" type="button" onclick="javascript:SearchKey();"><i class="fa fa-search"></i> 查询</button>
</div>
</div>
</div>
<div class="row search-padding">
<div class="col-md-12 col-sm-12">
<div id="Flows"> </div>
</div>
</div>
<table style="table-layout:fixed" class="table table-striped">
<thead id="Table2">
<tr>
<th width='30px'>#</th>
<th width='380px'>标题</th>
<th width='80px'>发起人</th>
<th width='120px'>发起日期</th>
<th width='120px'>停留节点</th>
<th width='280px'>审批人</th>
<th width='90px'>应完成日期</th>
<th width='60px'>状态</th>
<th width='60px'>操作</th>
</tr>
</thead>
<tbody id="Table1"></tbody>
</table>
</div>
</div>
<script type="text/javascript" src="Scripts/QueryString.js"></script>
<script type="text/javascript" src="Scripts/QueryString.js"></script>
<script type="text/javascript" src="Scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="Scripts/bootstrap/js/jquery.min.js"></script>
<script type="text/javascript" src="Scripts/bootstrap/js/jquery.cokie.min.js"></script>
<!-- 导入配置文件. -->
<script type="text/javascript" src="Scripts/config.js"></script>
<script type="text/javascript" src="Comm/Gener.js"></script>
<script src="Scripts/layui/layui/lay/modules/layer.js" type="text/javascript"></script>
<script type="text/javascript">
var webUser = null;
$(function () {
webUser = new WebUser();
if (webUser.No == null)
return;
var url = "";
var _tspan = GetQueryString("TSpan");
if (_tspan == undefined || _tspan == null || _tspan == "" || _tspan == "null") {
_tspan = "-1";
}
var _flowNo = GetQueryString("FK_Flow");
if (_flowNo == undefined || _flowNo == null || _flowNo == "" || _flowNo == "null") {
_flowNo = "";
}
if (_flowNo == "" && _tspan == "")
_tspan = "-1";
var handler = new HttpHandler("BP.WF.HttpHandler.CCMobile");
handler.AddPara("TSpan", _tspan);
handler.AddPara("FK_Flow", _flowNo);
var data = handler.DoMethodReturnString("Search_Init");
if (data.indexOf('err@') == 0) {
$("#Msg").html(data);
return;
}
var data = JSON.parse(data);
//时间段列表.
var tSpans = data['TSpan'];
if (_tspan == "-1")
html = "<button onclick=\"TSpan('');\" class=\"btn btn-info\" type=\"button\">全部</button> ";
else
html = "<button onclick=\"TSpan('');\" class=\"btn btn-default \" >全部</button> ";
for (var i = 0; i < tSpans.length; i++) {
var tSpan = tSpans[i];
if (_tspan == tSpan.IntKey)
html += "<button onclick=\"TSpan('" + tSpan.IntKey + "');\" class=\"btn btn-info\" >" + tSpan.Lab + "</button> ";
else
html += "<button onclick=\"TSpan('" + tSpan.IntKey + "');\" class=\"btn btn-default \">" + tSpan.Lab + "</button> ";
}
$("#TSpan").html(html);
//流程名称列表.
var flows = data['Flows'];
if (_flowNo == null || _flowNo == "")
html = "<button onclick=\"Flows('');\" class=\"btn btn-info\" >全部</button> ";
else
html = "<button onclick=\"Flows('');\" class=\"btn btn-default \" >全部</button> ";
for (var i = 0; i < flows.length; i++) {
var en = flows[i];
if (_flowNo == en.No)
html += "<button onclick=\"Flows('" + en.No + "');\" class=\"btn btn-info\" >" + en.Name + "" + en.Num + "</button> ";
else
html += "<button class=\"btn btn-default \" onclick=\"Flows('" + en.No + "');\" >" + en.Name + "" + en.Num + "</button> ";
}
$("#Flows").html(html);
// 流程实例列表.
var ens = data['WF_GenerWorkFlow'];
_Html = "";
//当前登录人员的编号.
var userNo = webUser.No;
var todoEmpsName = "";
htmlbox = '';
var realIndex = 0;
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
if (en.FID != 0)
continue;
realIndex++;
var fk_flow = en.FK_Flow,
fk_node = en.FK_Node,
workid = en.WorkID,
fid = en.FID,
isRead = en.IsRead,
paras = en.AtPara;
if (paras == null || paras == "") {
paras = "";
}
else {
if (paras.indexOf("IsCC=1") > -1) {
paras = "IsCC=1";
} else {
paras = "";
}
}
todoEmpsName = en.TodoEmps;
if (todoEmpsName != null)
todoEmpsName = en.TodoEmps.substr(todoEmpsName.indexOf(',') + 1);
//是否可以执行当前工作?
var isCanDo = false;
if (en.TodoEmps != null) {
if (en.TodoEmps.indexOf(webUser.No) != -1)
isCanDo = true;
}
//获得icon.
var icon = GenerICON(isCanDo, en.WFState);
// 获得颜色.
var color = GenerColor(en.WFState, isCanDo);
htmlbox += "<tr >";
htmlbox += "<td class=Idx>" + realIndex + "</td>";
htmlbox += "<td><a href=\"javascript:OpenIt('" + en.WFState + "','" + en.WorkID + "','" + en.FK_Flow + "','" + en.FK_Node + "','" + en.TodoEmps + "','" + userNo + "')\">" + en.Title + "</td>";
htmlbox += "<td><font color='" + color + "'>" + en.StarterName + "</font></td>";
htmlbox += "<td><font color='" + color + "'>" + en.RDT.substring(5) + "</font></td>";
htmlbox += "<td><font color='" + color + "'>" + en.NodeName + "</font></td>";
htmlbox += "<td ><font color='" + color + "'>" + todoEmpsName + "</font></td>";
if (en.SDTOfNode == null)
htmlbox += "<td><font color='" + color + "'>" + en.RDT.substring(5) + "</font></td>";
else
htmlbox += "<td><font color='" + color + "'>" + en.SDTOfNode.substring(5) + "</font></td>";
htmlbox += "<td><font color='" + color + "'>" + GetWFState(en.WFState, isCanDo) + "</font></td>";
htmlbox += "<td><font color='" + color + "'>" + GenerOper(en.WorkID, en.WFState, en.FK_Flow, en.FK_Node, en.FID, isCanDo) + "</font></td>";
htmlbox += "</tr>";
}
$("#Table1").html(htmlbox);
$("#List").append(_Html);
$("#Msg").html("");
//$("#LV_Search").listview('refresh');
});
function GenerOper(workID, wfState, flowNo, nodeID, fid, isCanDo) {
if (wfState == 3)
return "";
if (wfState == 2 && isCanDo == true)
return "";
if (wfState == 3)
return "<a href=''>轨迹</a>";
if (wfState == 2)
return "<a href=\"javascript:UnSend('" + flowNo + "','" + nodeID + "','" + workID + "','" + fid + "');\" >撤销</a>";
var url = "WFRpt.htm?WorkID=" + workID + "&FK_Flow=" + flowNo + "&FK_Node=" + nodeID;
return "<a href=\"javascript:WinOpen('" + url + "');\" >轨迹</a>";
}
function UnSend(flowNo, nodeID, workid, fid) {
if (confirm("您确定要撤销吗?") == false)
return;
var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt_OneWork");
handler.AddPara("FK_Node", nodeID);
handler.AddPara("FK_Flow", flowNo);
handler.AddPara("WorkID", workid);
handler.AddPara("FID", fid);
var data = handler.DoMethodReturnString("OP_UnSend");
alert(data);
Reload();
}
function GenerColor(wfState, isCanDo) {
if (isCanDo == true && wfState != 3)
return "red";
if (wfState == 5) {
return "yellow";
}
if (wfState == 3) {
return "green";
}
if (wfState == 2)
return "";
return "";
}
function GetWFState(wfState, isCanDo) {
if (isCanDo == true && wfState != 3)
return "待办";
if (wfState == 5) {
return "退回";
}
if (wfState == 3) {
return "已完成";
}
if (wfState == 2)
return "运行中";
return "其他";
}
function GenerICON(isCanDo, wfState) {
if (wfState == 3)
icon = "./Img/WFState/Complete.png"; //已经完成.
else if (wfState == 2)
icon = "./Img/WFState/Runing.png"; //运行中.
else if (wfState == 5)
icon = "./Img/WFState/ReturnSta.png"; //退回.
else
icon = "./Img/WFState/Etc.png"; //其他.
if (isCanDo == true && wfState != 3)
icon = "./Img/WFState/Todo.png"; //其他.
return icon;
}
function OpenIt(wfState, workid, flowNo, nodeID, emps, userNo) {
var url = "";
url = "MyView.htm?WorkID=" + workid + "&FK_Flow=" + flowNo + "&FK_Node=" + nodeID;
layer.open({
skin: 'layer-class',
type: 2,
title: '我的流程',
area: ['96%', '90%'],
content: url
});
}
function TSpan(tspan) {
var flowNo = GetQueryString("FK_Flow");
if (flowNo == null) {
if (tspan == '')
SetHref('?1=1');
else
SetHref('?TSpan=' + tspan);
}
else {
if (tspan == '')
SetHref('?FK_Flow=' + flowNo);
else
SetHref('?FK_Flow=' + flowNo + '&TSpan=' + tspan);
}
}
function Flows(flowNo) {
var tspan = GetQueryString("TSpan");
if (tspan == null) {
if (flowNo == "")
SetHref('?1=1');
else
SetHref('?FK_Flow=' + flowNo);
}
else {
if (flowNo == "")
SetHref('?TSpan=' + GetQueryString("TSpan"));
else
SetHref('?FK_Flow=' + flowNo + '&TSpan=' + GetQueryString("TSpan"));
}
}
function ToUrl(pageID) {
var url = pageID + ".htm?m=" + Math.random();
SetHref(url);
}
function SearchKey() {
var val = $("#TB_Key").val();
if (val == null || val == undefined || val == "") {
alert("请输入关键字,单据编号,标题。。。");
return;
}
var handler = new HttpHandler("BP.WF.HttpHandler.WF_RptSearch");
handler.AddPara("TB_KWds", val);
var data = handler.DoMethodReturnString("KeySearch_Query");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
//转化成json.
data = JSON.parse(data);
if (data.length <= 0) {
alert('未查询出来数据');
return;
}
var tableHtml = "";
tableHtml += "<tr>";
tableHtml += "<th>Idx</th>";
tableHtml += "<th width='380px'>标题</th>";
tableHtml += "<th width='80px'>发起人</th>";
tableHtml += "<th width='120px'>发起日期</th>";
tableHtml += "<th width='120px'>流程</th>";
tableHtml += "<th width='120px'>停留节点</th>";
tableHtml += "<th width='160px'>审批人</th>";
tableHtml += "<th width='90px'>应完成日期</th>";
tableHtml += "<th width='60px'>状态</th>";
tableHtml += "<th width='60px'>操作</th>";
// tableHtml += "<th>参与人</th>";
tableHtml += "</tr>";
var user = new WebUser();
var userNo = user.No;
htmlboxs = "";
data.forEach(function (en, index) {
var tr = "";
//是否可以执行当前工作?
var isCanDo = false;
if (en.TodoEmps.indexOf(webUser.No) != -1)
isCanDo = true;
//图片.
var icon = GenerICON(isCanDo, en.WFState);
// 获得颜色.
var color = GenerColor(en.WFState, isCanDo);
var todoEmpsName = en.TodoEmps;
todoEmpsName = en.TodoEmps.substr(todoEmpsName.indexOf(',') + 1);
htmlboxs += "<tr>";
htmlboxs += "<td class=Idx>" + (index + 1) + "</td>";
htmlboxs += "<td><a href=\"javascript:OpenIt('" + en.WFState + "','" + en.WorkID + "','" + en.FK_Flow + "','" + en.FK_Node + "','" + en.TodoEmps + "','" + userNo + "')\"><img src=" + icon + " border=0 width='18px;' />" + en.Title + "</td>";
htmlboxs += "<td><font color='" + color + "'>" + en.StarterName + "</font></td>";
htmlboxs += "<td><font color='" + color + "'>" + en.RDT.substring(5) + "</font></td>";
htmlboxs += "<td><font color='" + color + "'>" + en.FlowName + "</font></td>";
htmlboxs += "<td><font color='" + color + "'>" + en.NodeName + "</font></td>";
htmlboxs += "<td><font color='" + color + "'>" + todoEmpsName + "</font></td>";
if (en.TDTime == null)
htmlboxs += "<td><font color='" + color + "'>" + en.RDT.substring(5) + "</font></td>";
else
htmlboxs += "<td><font color='" + color + "'>" + en.TDTime.substring(5) + "</font></td>";
htmlboxs += "<td><font color='" + color + "'>" + GetWFState(en.WFState, isCanDo) + "</font></td>";
htmlboxs += "<td><font color='" + color + "'>" + GenerOper(en.WorkID, en.WFState, en.FK_Flow, en.FK_Node, en.FID, isCanDo) + "</font></td>";
// html += "<td><font color='" + color + "'>" + en.Emps + "</font></td>";
htmlboxs += "</tr>";
});
$("#Table2").html(tableHtml);
$("#Table1").html(htmlboxs);
}
</script>
</body>
</html>