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.

417 lines
14 KiB
Plaintext

<!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>
<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>
<button class="btn btn-success" type="button" onclick="javascript:New();">
<i class="fa fa-new"></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 class="table table-striped">
<thead id="Table2">
<tr>
<th>
#
</th>
<th>
标题
</th>
<th>
单据名
</th>
<th>
制单日期
</th>
<th>
编辑日期
</th>
<th width='60'>
状态
</th>
<th width='60'>
操作
</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 ens = new Entities("BP.CCBill.GenerBills");
ens.Retrieve("Starter", webUser.No);
_Html = "";
//当前登录人员的编号.
var userNo = webUser.No;
var todoEmpsName = "";
htmlbox = '';
var realIndex = 0;
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
realIndex++;
var FrmID = en.FrmID;
workid = en.WorkID;
var isCanDo = true;
//获得icon.
var icon = GenerICON(isCanDo, en.BillState);
// 获得颜色.
var color = GenerColor(en.BillState, isCanDo);
htmlbox += "<tr >";
htmlbox += "<td class=Idx>" + realIndex + "</td>";
htmlbox += "<td><a href=\"javascript:OpenIt('" + en.BillState + "','" + en.WorkID + "','" + en.FrmID + "')\">" + en.Title + "</td>";
htmlbox += "<td><font color='" + color + "'><a href=\"javascript:OpenFrm('" + en.FrmID + "')\" >" + en.FrmName + "</a></font></td>";
htmlbox += "<td><font color='" + color + "'>" + en.RDT.substring(5) + "</font></td>";
htmlbox += "<td><font color='" + color + "'>" + en.RDT.substring(5) + "</font></td>";
htmlbox += "<td><font color='" + color + "'>" + GetBillState(en.BillState, isCanDo) + "</font></td>";
htmlbox += "<td><font color='" + color + "'>" + GenerOper(en.WorkID, en.BillState, en.FrmID, en.FK_Node, en.FID, isCanDo) + "</font></td>";
htmlbox += "<td><font color='" + color + "'><a href=\"javascript:Delete('" + workid + "')\">删除</a></font></td>";
htmlbox += "</tr>";
}
$("#Table1").html(htmlbox);
$("#List").append(_Html);
$("#Msg").html("");
//$("#LV_Search").listview('refresh');
});
function OpenFrm(frmID) {
var url = "SearchBill.htm?FrmID=" + frmID;
WinOpenFull(url);
}
function GenerOper(workID, BillState, frmID, nodeID, fid, isCanDo) {
if (BillState == 3)
return "";
if (BillState == 2 && isCanDo == true)
return " - ";
if (BillState == 3)
return "<a href=''>轨迹</a>";
if (BillState == 2)
return "<a href=\"javascript:UnSend('" + frmID + "','" + nodeID + "','" + workID + "','" + fid + "');\" >撤销</a>";
var url = "WFRpt.htm?WorkID=" + workID + "&FrmID=" + frmID;
return "<a href=\"javascript:WinOpen('" + url + "');\" >轨迹</a>";
}
function New(workid) {
var frmID = GetQueryString("FrmID");
var url = "MyBill.htm?FK_MapData=" + frmID + "&FrmID=" + frmID;
SetHref(url);
}
function Delete(workid) {
if (confirm("您确定要撤销吗?") == false)
return;
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
handler.AddPara("FrmID", GetQueryString("FrmID"));
handler.AddPara("WorkID", workid);
var data = handler.DoMethodReturnString("MyBill_Delete");
if (data.indexOf('err@') == 0) {
alert(data);
}
Reload();
}
function GenerColor(BillState, isCanDo) {
if (BillState == 100) {
return "green";
}
if (BillState == 1) {
return "yellow";
}
return "";
if (isCanDo == true && BillState != 3)
return "red";
if (BillState == 5) {
return "yellow";
}
if (BillState == 2)
return "";
return "";
}
function GetBillState(BillState, isCanDo) {
if (BillState == 1) {
return "草稿";
}
if (BillState == 2) {
return "编辑中";
}
if (BillState == 100) {
return "归档";
}
return "其他";
if (isCanDo == true && BillState != 3)
return "待办";
if (BillState == 5) {
return "退回";
}
if (BillState == 3) {
return "已完成";
}
if (BillState == 2)
return "运行中";
return "其他";
}
function GenerICON(isCanDo, BillState) {
if (BillState == 3)
icon = "../Img/BillState/Complete.png"; //已经完成.
else if (BillState == 2)
icon = "../Img/BillState/Runing.png"; //运行中.
else if (BillState == 5)
icon = "../Img/BillState/ReturnSta.png"; //退回.
else
icon = "../Img/BillState/Etc.png"; //其他.
if (isCanDo == true && BillState != 3)
icon = "../Img/BillState/Todo.png"; //其他.
return icon;
}
function OpenIt(BillState, workid, frmID, nodeID, emps, userNo) {
var url = "";
url = "MyBill.htm?WorkID=" + workid + "&FrmID=" + frmID + "&FK_MapData=" + frmID;
//window.location.href = filterXSS(url);
WinOpen(url);
return;
layer.open({
skin: 'layer-class',
type: 2,
title: '我的流程',
area: ['96%', '90%'],
content: url
});
}
function TSpan(tspan) {
var frmID = GetQueryString("FrmID");
if (frmID == null) {
if (tspan == '')
SetHref('?1=1' + "&FrmID=" + GetQueryString("FrmID"));
else
SetHref('?TSpan=' + tspan + "&FrmID=" + GetQueryString("FrmID"));
}
else {
if (tspan == '')
SetHref('?FrmID=' + frmID);
else
SetHref('?FrmID=' + frmID + '&TSpan=' + tspan);
}
}
function Flows(billState) {
var tspan = GetQueryString("TSpan");
var frmID = GetQueryString("FrmID");
if (tspan == null) {
SetHref('?FrmID=' + frmID + "&BillState=" + billState);
}
else {
if (frmID == "")
SetHref('?TSpan=' + tspan + "&FrmID=" + frmID + "&BillState=" + billState);
else
SetHref('?FrmID=' + frmID + '&TSpan=' + tspan + "&BillState=" + billState);
}
}
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.CCBill.WF_CCBill");
handler.AddPara("TB_KWds", val);
var data = handler.DoMethodReturnString("SearchData_Init");
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>标题</th>";
tableHtml += "<th>制单日期</th>";
tableHtml += "<th>单据编号</th>";
tableHtml += "<th>操作员</th>";
tableHtml += "<th width='90'>编辑日期</th>";
tableHtml += "<th width='60'>状态</th>";
tableHtml += "<th width='50'>操作</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.BillState);
// 获得颜色.
var color = GenerColor(en.BillState, 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.BillState + "','" + en.WorkID + "','" + en.FrmID + "','" + en.FK_Node + "','" + en.TodoEmps + "','" + userNo + "')\"><img src=" + icon + " border=0 width='18px;' />" + en.Title + "</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 + "'>" + 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 + "'>" + GetBillState(en.BillState, isCanDo) + "</font></td>";
htmlboxs += "<td><font color='" + color + "'>" + GenerOper(en.WorkID, en.BillState, en.FrmID, 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>