|
|
<!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>
|
|
|
<link href="../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
|
|
|
<link href="../Scripts/bootstrap/css/components-rounded.css" rel="stylesheet" />
|
|
|
<link href="../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" />
|
|
|
<link href="../Scripts/bootstrap/css/themes/default/style.min.css" rel="stylesheet" />
|
|
|
<link href="../Scripts/bootstrap/bootstrap-treeview/src/css/bootstrap-treeview.css" rel="stylesheet" />
|
|
|
<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 type="text/javascript" src="../Scripts/bootstrap/bootstrap-treeview/src/js/bootstrap-treeview.js"></script>
|
|
|
<script type="text/javascript" src="../Scripts/commonYangYH.js"></script>
|
|
|
<script src="../Scripts/QueryString.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/bootstrap/js/jquery.cokie.min.js" type="text/javascript"></script>
|
|
|
<script type="text/javascript" src="../Scripts/config.js"></script>
|
|
|
<script src="../Comm/Gener.js" type="text/javascript"></script>
|
|
|
<script type="text/javascript" src="../Scripts/bootstrap/js/jstree.js"></script>
|
|
|
<link href="../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
|
|
|
<link href="../../DataUser/Style/ccbpm.css" rel="Stylesheet" />
|
|
|
<!--
|
|
|
杨玉慧.
|
|
|
|
|
|
1. 初始化的标记是 ?DoType=Accepter_Init&FK_Node=xxxx&ToNode=0&WorkID=xxxxx. 参数: WorkID
|
|
|
返回的是 节点列表 Nodes, 部门列表 Depts, 人员列表 Emps
|
|
|
|
|
|
2, 用户选择一个节点,标记是 DoType=Accepter_Save&FK_Node=xxx&WorkID=xxx&ToNode=xxxx&SelectEmps=zhangsan,lisi.
|
|
|
返回的是: 保存结果.
|
|
|
-->
|
|
|
<style type="text/css">
|
|
|
* {
|
|
|
list-style: none;
|
|
|
text-align: left;
|
|
|
}
|
|
|
|
|
|
body .table tbody tr td {
|
|
|
line-height: 18px;
|
|
|
}
|
|
|
|
|
|
.portlet-body, .portlet-title {
|
|
|
background: #f4f9ff !important;
|
|
|
border-bottom: 0px;
|
|
|
}
|
|
|
|
|
|
.customthr tr:nth-child(2n) {
|
|
|
background: #d4e6fe;
|
|
|
}
|
|
|
|
|
|
.customthr tr:nth-child(2n+1) {
|
|
|
background: #f4f9ff;
|
|
|
}
|
|
|
|
|
|
.customthr thead tr {
|
|
|
background: #d4e6fe !important;
|
|
|
}
|
|
|
|
|
|
input[type=text], select {
|
|
|
border-radius: 15px !important;
|
|
|
border: #2884fa 1px solid !important;
|
|
|
margin: 8px 0px !important;
|
|
|
line-height: 25px;
|
|
|
padding-left: 6px;
|
|
|
}
|
|
|
|
|
|
#txbSearchVal {
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
|
|
|
.form_tree {
|
|
|
background: #f4f9ff;
|
|
|
}
|
|
|
|
|
|
.form_tree #orgTxt {
|
|
|
border-radius: 15px 0px 0px 15px !important;
|
|
|
margin: 0px !important;
|
|
|
}
|
|
|
|
|
|
.form_tree .input-group-addon {
|
|
|
border-radius: 0px 15px 15px 0px !important;
|
|
|
}
|
|
|
|
|
|
#groupTable #dt ul {
|
|
|
font-weight: normal;
|
|
|
background: #d4e6fe;
|
|
|
}
|
|
|
|
|
|
#groupTable #dt > li {
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
#searchS {
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
|
|
|
#searchS div {
|
|
|
height: 40px;
|
|
|
line-height: 40px;
|
|
|
text-align: left;
|
|
|
float: left;
|
|
|
}
|
|
|
</style>
|
|
|
<script type="text/javascript">
|
|
|
var doType = GetQueryString("DoType");
|
|
|
var isFrameCross = GetQueryString("isFrameCross");
|
|
|
var isSimplate = false;
|
|
|
var IsSend = GetQueryString("IsSend"); //是否发送?该参数是ToNodes.htm 带回来的.
|
|
|
$(function () {
|
|
|
if (IsSend == null || IsSend == undefined || IsSend == "")
|
|
|
IsSend = "1";
|
|
|
if (IsSend == "0")
|
|
|
$("#Btn_Send").hide();
|
|
|
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
|
|
|
handler.AddUrlData(); //这里是获得Url的参数.
|
|
|
var data = handler.DoMethodReturnString("AccepterOfDept_Init");
|
|
|
|
|
|
//对返回值处理,如果是info 仅仅提示信息.
|
|
|
if (data.indexOf('info@') == 0) {
|
|
|
data = data.replace('info@@', '');
|
|
|
data = data.replace('info@', '');
|
|
|
alert(data);
|
|
|
Close(true);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//如果有错误,直接提示错误.
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
alert(data);
|
|
|
Close(false);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
data = JSON.parse(data);
|
|
|
}
|
|
|
catch (err) {
|
|
|
alert("转换JSON 失败" + err + data);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//获得三个数据源.
|
|
|
var depts = data.Depts; //部门集合. 这个集合也可能为空,如果为空就不要分组.
|
|
|
var selected = data.Selected; //已经选择的人员集合.
|
|
|
|
|
|
//是否是单选? =0 是多选 =1 是单选.
|
|
|
isSimplate = data.Selector[0].IsSimpleSelector ==0?true:false;
|
|
|
|
|
|
var jsonTree = createJsonToTree(depts, depts[0].ParentNo,selected);
|
|
|
$('#tree').treeview({
|
|
|
data: jsonTree, // 数据源
|
|
|
showCheckbox: isSimplate, //是否显示复选框
|
|
|
highlightSelected: !isSimplate, //是否高亮选中
|
|
|
nodeIcon: 'glyphicon',
|
|
|
emptyIcon: '', //没有子节点的节点图标
|
|
|
multiSelect: false,
|
|
|
|
|
|
onNodeSelected: function (event, node) {
|
|
|
var tree = $('#tree');
|
|
|
if (node.state.expanded) {
|
|
|
//处于展开状态则折叠
|
|
|
tree.treeview('collapseNode', node.nodeId);
|
|
|
} else {
|
|
|
//展开
|
|
|
tree.treeview('expandNode', node.nodeId);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
//树形结构转换
|
|
|
var treeJson = [];
|
|
|
function createJsonToTree(jsonArray, parentNo,selectedNodes) {
|
|
|
for (var i = 0; i < jsonArray.length; i++) {
|
|
|
var data = jsonArray[i];
|
|
|
if (data.ParentNo == parentNo) {
|
|
|
var checked = false;
|
|
|
var sel = $.grep(selectedNodes, function (obj) {
|
|
|
return data.No == obj.No;
|
|
|
});
|
|
|
|
|
|
if (sel.length > 0) {
|
|
|
checked = true;
|
|
|
}
|
|
|
treeJson.push({
|
|
|
"id": data.No,
|
|
|
"text": data.Name,
|
|
|
"nodes": creatTreeChildern(jsonArray, data.No,selectedNodes),
|
|
|
"state": { checked: checked, disabled: false }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
function _(treeArray) {
|
|
|
$.each(treeArray, function (i, o) {
|
|
|
if ($.isArray(o.nodes)) {
|
|
|
if (o.nodes.length == 0) {
|
|
|
o.nodes = undefined;
|
|
|
} else {
|
|
|
_(o.nodes);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
_(treeJson);
|
|
|
return treeJson;
|
|
|
}
|
|
|
|
|
|
function creatTreeChildern(jsonArray, parentNo,selectedNodes) {
|
|
|
var childList = []
|
|
|
for (var i = 0; i < jsonArray.length; i++) {
|
|
|
var data = jsonArray[i];
|
|
|
if (data.ParentNo == parentNo) {
|
|
|
var checked = false;
|
|
|
var sel = $.grep(selectedNodes, function (obj) {
|
|
|
return data.No == obj.No;
|
|
|
});
|
|
|
|
|
|
if (sel.length > 0) {
|
|
|
checked = true;
|
|
|
}
|
|
|
childList.push({
|
|
|
"id": data.No,
|
|
|
"text": data.Name,
|
|
|
"nodes": creatTreeChildern(jsonArray, data.No),
|
|
|
"state": { checked: checked, disabled: false }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return childList;
|
|
|
}
|
|
|
|
|
|
|
|
|
//复选框全选反选
|
|
|
function selectAll() {
|
|
|
var obj = $("#selectAll");
|
|
|
if (obj != null && obj != undefined && obj.prop("checked")) {
|
|
|
$("input:checkbox").each(function () {
|
|
|
$(this).prop("checked", true);
|
|
|
});
|
|
|
} else {
|
|
|
$("input:checkbox").each(function () {
|
|
|
$(this).prop("checked", false);
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
//确定【选择接收人并发送】 / 保存. Accepter_Save Accepter_Send
|
|
|
function SendNode() {
|
|
|
|
|
|
//生成选择的人员.
|
|
|
var nodes = $('#tree').treeview('getChecked');
|
|
|
if(isSimplate == false)
|
|
|
nodes = $('#tree').treeview('getSelected');
|
|
|
var selectedDepts = [];
|
|
|
for (var i = 0; i < nodes.length; i++) {
|
|
|
|
|
|
selectedDepts.push(nodes[i].id);
|
|
|
}
|
|
|
selectedDepts = selectedDepts.join(';');
|
|
|
if (selectedDepts == '' || selectedDepts == null) {
|
|
|
alert('请选择部门.');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$("#Msg").html("<font color=green><center>正在发送请稍候...</center></font>");
|
|
|
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
|
|
|
handler.AddUrlData();
|
|
|
handler.AddPara("SelectDepts", encodeURI(selectedDepts));
|
|
|
var data = handler.DoMethodReturnString("AccepterOfDept_Send");
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
alert(data);
|
|
|
return;
|
|
|
}
|
|
|
if (isFrameCross == 0) {
|
|
|
if (window.parent != null && window.parent.WindowCloseReloadPage != null && typeof window.parent.WindowCloseReloadPage === "function") {
|
|
|
window.parent.WindowCloseReloadPage(data);
|
|
|
} else {
|
|
|
if (typeof WindowCloseReloadPage != 'undefined' && WindowCloseReloadPage instanceof Function)
|
|
|
WindowCloseReloadPage(data);
|
|
|
}
|
|
|
} else {
|
|
|
ChildrenPostMessage(data, "WindowCloseReloadPage");
|
|
|
}
|
|
|
|
|
|
|
|
|
data = data.replace("'MyFlowInfo", "'../MyFlowInfo");
|
|
|
data = data.replace("'MyFlow.htm", "'../MyFlow.htm");
|
|
|
data = data.replace("'MyFlow.htm", "'../MyFlow.htm");
|
|
|
|
|
|
data = data.replace("'WFRpt", "'../WFRpt");
|
|
|
data = data.replace("'WFRpt", "'../WFRpt");
|
|
|
|
|
|
data = data.replace("'./Img", "'../Img");
|
|
|
data = data.replace("'./Img", "'../Img");
|
|
|
data = data.replace("'./Img", "'../Img");
|
|
|
data = data.replace("'./Img", "'../Img");
|
|
|
data = data.replace("'./Img", "'../Img");
|
|
|
|
|
|
if (data.indexOf("UnSend.htm") == -1) {
|
|
|
data = data.replace("'./WorkOpt/", "");
|
|
|
data = data.replace("'./WorkOpt/", "");
|
|
|
data = data.replace("'./WorkOpt/", "");
|
|
|
}
|
|
|
|
|
|
data = data.replace('@', '<br/>@');
|
|
|
data = data.replace(/@/g, '<br/> @');
|
|
|
data = data.replace('<br/><br/> ', '');
|
|
|
//console.log(data);
|
|
|
|
|
|
if ("Accepter_Save" == doType) {
|
|
|
if (isFrameCross == 0) {
|
|
|
if (window.parent != null && window.parent.returnWorkWindowClose != null) {
|
|
|
window.parent.returnWorkWindowClose(data);
|
|
|
} else if (window.opener != undefined && window.opener.returnWorkWindowClose != undefined) {
|
|
|
window.opener.returnWorkWindowClose(data);
|
|
|
} else if (window.parent != undefined && window.parent.AccepterHtmlSave != undefined) {
|
|
|
//表单树使用
|
|
|
window.parent.AccepterHtmlSave(data);
|
|
|
} else {
|
|
|
$('body').append($('<div>' + data + '</div>'));
|
|
|
$('#btnSave').attr('disabled', true);
|
|
|
}
|
|
|
} else {
|
|
|
ChildrenPostMessage(data, "returnWorkWindowClose");
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
window.opener.document.getElementById("acc_link_" + ToNode).innerHTML = "选择接受人员" + "<span style='color:black;'>(" + getSaveName + ")</span>";
|
|
|
} catch (e) {
|
|
|
}
|
|
|
window.close();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (isFrameCross == 0) {
|
|
|
if (window.parent != null && window.parent.returnWorkWindowClose != null) {
|
|
|
window.parent.returnWorkWindowClose(data);
|
|
|
} else if (window.opener != undefined && window.opener.returnWorkWindowClose != undefined) {
|
|
|
window.opener.returnWorkWindowClose(data);
|
|
|
} else {
|
|
|
$('body').append($('<div>' + data + '</div>'));
|
|
|
$('#btnSave').attr('disabled', true);
|
|
|
}
|
|
|
} else {
|
|
|
ChildrenPostMessage(data, "returnWorkWindowClose");
|
|
|
}
|
|
|
$(".foot").hide();
|
|
|
}
|
|
|
|
|
|
//取消【选择接收人并发送】
|
|
|
function Close(flag, selectEmps) {
|
|
|
if (selectEmps == null || selectEmps == undefined)
|
|
|
selectEmps = "取消"
|
|
|
if (isFrameCross == 0) {
|
|
|
if (window.parent != null && window.parent.returnWorkWindowClose != null) {
|
|
|
window.parent.returnWorkWindowClose(selectEmps);
|
|
|
if (flag == true)
|
|
|
window.parent.close();
|
|
|
else
|
|
|
window.close();
|
|
|
} else if (window.opener != undefined && window.opener.returnWorkWindowClose != undefined) {
|
|
|
window.opener.returnWorkWindowClose(selectEmps);
|
|
|
if (flag == true)
|
|
|
window.opener.close();
|
|
|
else
|
|
|
window.close();
|
|
|
} else {
|
|
|
window.close();
|
|
|
}
|
|
|
} else {
|
|
|
ChildrenPostMessage(selectEmps, "returnWorkWindowClose");
|
|
|
if (flag == true)
|
|
|
window.parent.close();
|
|
|
else
|
|
|
window.close();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div style="margin-bottom:45px;">
|
|
|
<div id="selected">
|
|
|
</div>
|
|
|
<div id="tree">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="position: fixed;background:#f5f5f5; left:0; padding:8px; text-align:right; border-top:solid 1px #ccc; bottom: 0; right: 0;" class="foot">
|
|
|
<button onclick="SendNode();" id="Btn_Send" class="layui-btn layui-btn-primary">
|
|
|
<!--<img src="../Img/Btn/Send.png" />--> 发送
|
|
|
</button>
|
|
|
|
|
|
<button onclick="Close();" id="btnCancel" class="layui-btn layui-btn-primary">
|
|
|
<!--<img src="../Img/Btn/Close.png" />--> 关闭
|
|
|
</button>
|
|
|
</div>
|
|
|
<br />
|
|
|
<center>
|
|
|
<div id="Msg">
|
|
|
</div>
|
|
|
</center>
|
|
|
</body>
|
|
|
</html>
|