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.

520 lines
20 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="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="Scripts/layui/layui/css/modules/layer/default/layer.css" rel="stylesheet" />
<style id="theme-data"></style>
<style>
/*设置表格内容过长,用省略号代替多余部分,前提:table的style属性*/
td {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.pagination {
margin: 8px 0;
display: block;
font-size: 13px;
}
.pagination .controls {
float: left;
border: 0;
padding: 7px 0 0 15px;
color: #777;
}
.btn-sm {
padding: 0 10px;
height: 26px;
line-height: 26px;
border-radius: 5px;
font-size: 14px;
}
</style>
</head>
<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" />
<!--<input type='text' placeholder="日期从" id='TB_Key' class="form-control" />
<input type='text' placeholder="到" id='TB_Key' class="form-control" />-->
</div>
<button class="btn btn-success btn-sm" 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='4%'>序号</th>
<th width='23%'>标题</th>
<th width='5%'>发起人</th>
<th width='10%'>发起日期</th>
<th width='15%'>停留节点</th>
<th width='20%'>审批人</th>
<th width='10%'>应完成日期</th>
<th width='10%'>状态</th>
<th width='5%'>操作</th>
</tr>
</thead>
<tbody id="Table1"></tbody>
</table>
<!-- 显示分页信息 -->
<div class="row" style="text-align: left;">
<ul class="pagination" id="page_nav">
</ul>
<ul class="pagination controls" id="page_info">
</ul>
<div style="clear: both;"></div>
</div>
</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.11.0.min.js"></script>
<script type="text/javascript" src="./Scripts/bootstrap/js/bootstrap.min.js"></script>
<script src="Scripts/bootstrap/bootstrap-paginator/js/bootstrap-paginator.js" type="text/javascript"></script>
<link href="Scripts/jquery/themes/default/menu.css" rel="stylesheet" />
<!-- 导入配置文件. -->
<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"></script>
<script type="text/javascript">
var webUser = new WebUser();
var pageCount = 1; //页数
var pageSize = 10; //一页显示行数
var totalNum = 0;
var pageIdx = 1;//第几页
var _tspan = GetQueryString("TSpan");
var _flowNo = GetQueryString("FK_Flow");
var keyWord = "";
$(function () {
InitPage();//初始化查询列表、
InitData();//初始化数据
Paginator(); //分页
mouseShow();//省略的展现出来
});
function InitPage() {
if (_tspan == undefined || _tspan == null || _tspan == "" || _tspan == "null") {
_tspan = "-1";
}
if (_flowNo == undefined || _flowNo == null || _flowNo == "" || _flowNo == "null") {
_flowNo = "";
}
if (_flowNo == "" && _tspan == "")
_tspan = "-1";
var handler = new HttpHandler("BP.WF.HttpHandler.WF");
handler.AddPara("TSpan", _tspan);
handler.AddPara("FK_Flow", _flowNo);
handler.AddPara("KeyWord", keyWord);
var data = handler.DoMethodReturnString("Search_Conds");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
var data = JSON.parse(data);
//时间段列表.
var tSpans = data['TSpan'];
if (_tspan == "-1")
html = "<button onclick=\"TSpan('');\" class=\"btn btn-info btn-sm\" type=\"button\">全部</button> ";
else
html = "<button onclick=\"TSpan('');\" class=\"btn btn-default btn-sm \" >全部</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 btn-sm\" >" + tSpan.Lab + "</button> ";
else
html += "<button onclick=\"TSpan('" + tSpan.IntKey + "');\" class=\"btn btn-default btn-sm\">" + tSpan.Lab + "</button> ";
}
$("#TSpan").html(html);
//流程名称列表.
var flows = data['Flows'];
if (_flowNo == null || _flowNo == "")
html = "<button onclick=\"Flows('');\" class=\"btn btn-info btn-sm\" >全部</button> ";
else
html = "<button onclick=\"Flows('');\" class=\"btn btn-default btn-sm\" >全部</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 btn-sm\" >" + en.Name + "" + en.Num + "</button> ";
else
html += "<button class=\"btn btn-default btn-sm\" onclick=\"Flows('" + en.No + "');\" >" + en.Name + "" + en.Num + "</button> ";
}
$("#Flows").html(html);
}
function InitData() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF");
handler.AddPara("TSpan", _tspan);
handler.AddPara("FK_Flow", _flowNo);
handler.AddPara("PageIdx", pageIdx);
handler.AddPara("PageSize", pageSize);
handler.AddPara("KeyWord", keyWord);
var data = handler.DoMethodReturnString("Search_Data");
if (data.indexOf("err@") != -1) {
alert(data);
return;
}
data = JSON.parse(data);
if (data.length <= 0) {
$("#Table1").html("");
return;
}
//当前登录人员的编号.
var htmlbox = '';
var realIndex = (pageIdx - 1) * pageSize;
for (var i = 0; i < data.length; i++) {
var en = data[i];
if (en.FID != 0)
continue;
++realIndex;
//审批人
var todoEmps = en.TodoEmps;
//是否可以执行当前工作?
var isCanDo = false;
if (todoEmps != null && todoEmps != undefined) {
var isHaveAdmin = todoEmps.indexOf("admin,admin") != -1 ? true : false;
todoEmps = todoEmps.replace(/admin,admin;/, '').replace(/admin,admin/, '');
var result = todoEmps.split(";");
var reg = /[a-zA-Z\,]+/;
var idx = 0;
while (result = todoEmps.match(reg)) {
if (idx == 0)
todoEmps = todoEmps.replace(result[0], '').replace(";", "");
else
todoEmps = todoEmps.replace(result[0], '、');
idx++;
}
if (isHaveAdmin == true)
todoEmps = idx == 0 ? "admin" : idx == 1 ? "、admin" : todoEmps + "admin";
if (en.TodoEmps.indexOf(webUser.No) != -1)
isCanDo = true;
}
// 获得颜色.
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 + "')\">" + 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 + "'>" + todoEmps + "</font></td>";
if (en.SDTOfNode == null)
htmlbox += "<td><font color='" + color + "'>无</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);
$("#Msg").html("");
}
//分页功能
function Paginator() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF");
handler.AddPara("TSpan", _tspan);
handler.AddPara("FK_Flow", _flowNo);
handler.AddPara("KeyWord", keyWord);
var data = handler.DoMethodReturnString("Search_Count");
if (data.indexOf("err@") != -1) {
alert(data);
return;
}
var pageCount = 0;
totalNum = parseInt(data);
if (totalNum % pageSize != 0)
pageCount = parseInt(totalNum / pageSize) + 1;
else
pageCount = parseInt(totalNum / pageSize);
if (pageCount == 0) pageCount = 1;
var options = {
bootstrapMajorVersion: 3, //版本
currentPage: pageIdx, //当前页数
totalPages: pageCount, //总页数
shouldShowPage: true, //是否显示该按钮
itemTexts: function (type, page, current) {
switch (type) {
case "first":
return "首页";
case "prev":
return "上一页";
case "next":
return "下一页";
case "last":
return "末页";
case "page":
return page;
}
}, //点击事件用于通过Ajax来刷新整个list列表
onPageClicked: function (event, originalEvent, type, page) {
pageIdx = page;
keyWord = $("#TB_Key").val();
InitData();
mouseShow();
$('#page_info').html("").append("<li class='disabled controls'>当前第" + pageIdx + "页,总共" + pageCount +
"页,总共" + totalNum + "条记录。</li>");
}
};
$('#page_nav').bootstrapPaginator(options);
$('#page_info').html("").append("<li class='disabled controls'>当前第" + pageIdx + "页,总共" + pageCount +
"页,总共" + totalNum + "条记录。</li>");
}
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) {
var webUser = new WebUser();
var url = "";
if (wfState != 3 && emps.indexOf(webUser.No) >= 0) {
url = "MyFlow.htm?WorkID=" + workid + "&FK_Flow=" + flowNo + "&FK_Node=" + nodeID;
var self = window.open(url);
var loop = setInterval(function () {
if (self.closed) {
clearInterval(loop);
InitPage(); //初始化查询列表、
InitData(); //初始化数据
Paginator(pageCount, pageIdx); //分页
InitHomeCount();
}
}, 1);
return;
} else {
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"));
}
}
//跳转url
function ToUrl(pageID) {
var url = pageID + ".htm?m=" + Math.random();
SetHref(url);
}
//关键字查询
function SearchKey() {
pageIdx = 1;
keyWord = $("#TB_Key").val();
InitPage();
InitData();
Paginator();
}
//鼠标悬浮显示
function mouseShow() {
$("td").on("mouseover", function () {
if (this.offsetWidth < this.scrollWidth) {
var that = this;
var text = $(this).text();
layer.tips("<span style='color:#000'>" + text + "</span>", that, {
tips: [1, '#FFF'],
time: 0
});
}
});
$("td").on("mouseout", function () {
layer.closeAll("tips");//关闭所有tips避免和iframe冲突
});
}
</script>
<script>
$(function () {
if (CustomerNo != "" && CustomerNo != null) {
html += "\n .btn-success{\n background-color: '#00B42A';\n}\n .btn-success:hover{\n background-color:'#00B42A' ;\n}\n .btn-success:focus{\n background-color: '#00B42A' ;\n}\n .btn-success:active{\n background-color: '#00B42A';\n}\n.btn-success:active:focus{\n background-color:'#00B42A';border-color:'#00B42A'; \n}";
}
var theme = filterXSS(localStorage.getItem("themeColorInfo"));
if (theme == "" || theme == "undefined" || theme == null) return;
var data = JSON.parse(theme);
var styleScope = document.getElementById("theme-data");
var html = styleScope.innerHTML;
html += "\n .btn-success{\n background-color: " + data.selectedMenu + " ;\n}\n .btn-success:hover{\n background-color: " + data.selectedMenu + " ;\n}\n .btn-success:focus{\n background-color: " + data.selectedMenu + " ;\n}\n .btn-success:active{\n background-color: " + data.selectedMenu + " ;\n}\n.btn-success:active:focus{\n background-color:" + data.selectedMenu + ";border-color:" + data.selectedMenu + "; \n}";
styleScope.innerHTML = filterXSS(html);
})
</script>
</body>
</html>