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.

155 lines
5.0 KiB
Plaintext

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>任务分配</title>
<script type="text/javascript" src="../Scripts/QueryString.js"></script>
<script type="text/javascript" src="../Scripts/bootstrap/js/jquery.min.js"></script>
<link href="../../DataUser/Style/ccbpm.css" rel="Stylesheet" />
<!-- 引用通用的js文件. -->
<script type="text/javascript" src="../Scripts/config.js"></script>
<script type="text/javascript" src="../Comm/Gener.js"></script>
<script type="text/javascript" language="javascript">
var workID = GetQueryString("WorkID");
var nodeID = GetQueryString("FK_Node");
if (nodeID == undefined || nodeID == null)
nodeID = GetQueryString("NodeID");
var gwls = null;
$(function () {
var gwf = new Entity("BP.WF.GenerWorkFlow", workID);
nodeID = gwf.FK_Node;
//查询出来数据.
gwls = new Entities("BP.WF.GenerWorkerLists");
gwls.Retrieve("WorkID", workID, "FK_Node", gwf.FK_Node);
//有可能是分合流.
if (gwls.length == 0)
gwls.Retrieve("FID", workID, "FK_Node", gwf.FK_Node);
var html = "";
html += "<ul>";
for (var i = 0; i < gwls.length; i++) {
var gwl = gwls[i];
if (gwl.IsEnable == 1)
html += "<li style='list-style-type:none;'><label><input checked='checked' type=checkbox value='' id='" + gwl.FK_Emp + "' >" + gwl.FK_Emp + "," + gwl.EmpName + "</label></li>";
else
html += "<li style='list-style-type:none;'><label><input type=checkbox value='' id='" + gwl.FK_Emp + "' >" + gwl.FK_Emp + "," + gwl.EmpName + "</label></li>";
}
html += "</ul>";
$("#info").html(html);
});
function Save() {
//获取所有未选中checkbox
var notChecked = $("input:checkbox").not("input:checked");
/*
这里因为WF_GenerWorkerlist为多主键(WorkID\FK_Node\FK_Emp),使用一下方法获取对象报错
var newgwl = new Entity("BP.WF.GenerWorkerList");
newgwl.Retrieve();//报错
所有就先获取集合,然后在通过集合的对象进行实例化了,如下
*/
gwls = new Entities("BP.WF.GenerWorkerLists");
if (notChecked.size() != 0) {
var todoEmps = "";
$.each(notChecked, function () {
gwls.Retrieve("WorkID", workID, "FK_Node", nodeID, "FK_Emp", $(this).attr('id'));
var newgwl = new Entity("BP.WF.GenerWorkerList", gwls[0]);
newgwl.IsEnable = "0";
newgwl.Update();
todoEmps += newgwl.FK_Emp + "," + newgwl.FK_EmpText + ";";
});
var gwf = new Entity("BP.WF.GenerWorkFlow", workID);
gwf.TodoEmps = todoEmps;
gwf.Update();
}
//保存状态与路径.
var webUser = new WebUser();
var rm = new Entity("BP.WF.RememberMe");
rm.FK_Emp = webUser.No;
rm.FK_Node = nodeID;
rm.SetPKVal(rm.FK_Node + "_" + rm.FK_Emp);
rm.MyPK = rm.FK_Node + "_" + rm.FK_Emp;
var obj = "";
var objExt = "";
//查询出来数据.
gwls = new Entities("BP.WF.GenerWorkerLists");
gwls.Retrieve("WorkID", workID, "FK_Node", nodeID);
//有可能是分合流.
if (gwls.length == 0)
gwls.Retrieve("FID", workID, "FK_Node", nodeID);
for (var i = 0; i < gwls.length; i++) {
var gwl = gwls[i];
if (gwl.IsEnable == 0)
continue;
obj += gwl.FK_Emp + "@";
objExt += gwl.EmpName + "&nbsp;&nbsp;";
}
rm.Objs = obj;
rm.ObjsExt = objExt;
//生成如下两个变量.
var emps = "";
var empExts = "";
for (var i = 0; i < gwls.length; i++) {
var gwl = gwls[i];
emps += gwl.FK_Emp + "@";
var empInfo = gwl.FK_Emp + "," + gwl.EmpName;
if (obj.indexOf(gwl.FK_Emp) != -1)
empExts += empInfo;
else
empExts += empInfo;
}
rm.Emps = emps;
rm.EmpsExt = empExts;
rm.Save(); //执行保存.
alert("分配成功");
window.close();
}
</script>
</head>
<body>
<form id="cc">
<center>
<h3>工作分配</h3>
<div style="text-align:left">
<div id="info"></div>
</div>
<input type=button value='执行分配' class="btn-default" onclick='Save()' />
</center>
</form>
</body>
</html>