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.
370 lines
14 KiB
Plaintext
370 lines
14 KiB
Plaintext
11 months ago
|
<!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>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<title>方向条件-按照部门计算</title>
|
||
|
<link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
|
||
|
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
|
||
|
<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 src="../../Scripts/QueryString.js" type="text/javascript"></script>
|
||
|
<script src="../../Scripts/config.js" type="text/javascript"></script>
|
||
|
<script src="../../Comm/Gener.js" type="text/javascript"></script>
|
||
|
<script src="../Admin.js" type="text/javascript"></script>
|
||
|
<script src="../../Scripts/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||
|
<link href="../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||
|
<link href="../../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" type="text/css" />
|
||
|
|
||
|
<link href="../../Style/skin/css/Default.css" rel="stylesheet" />
|
||
|
<link href="../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
|
||
|
<link href="../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
|
||
|
|
||
|
|
||
|
<script src="../../Scripts/bootstrap/bootstrap-treeview/src/js/bootstrap-treeview.js" type="text/javascript"></script>
|
||
|
<link href="../../Scripts/bootstrap/bootstrap-treeview/src/css/bootstrap-treeview.css" rel="stylesheet" type="text/css" />
|
||
|
|
||
|
<base target="_self" />
|
||
|
<script type="text/javascript">
|
||
|
var webUser = new WebUser();
|
||
|
//初始化页面函数.....
|
||
|
$(function () {
|
||
|
|
||
|
var mypk = GetQueryString("MyPK");
|
||
|
var cond = new Entity("BP.WF.Template.Cond");
|
||
|
if (mypk != null && mypk != undefined && mypk != "") {
|
||
|
cond.SetPKVal(mypk);
|
||
|
cond.RetrieveFromDBSources();
|
||
|
}
|
||
|
|
||
|
var initDepts = cond.OperatorValue.split("@");
|
||
|
|
||
|
//解析部门信息
|
||
|
//global
|
||
|
var global = window;
|
||
|
global.selectedNodes = [];
|
||
|
$.each(initDepts, function (i, o) {
|
||
|
if (initDepts[i] == "")
|
||
|
return;
|
||
|
global.selectedNodes.push({
|
||
|
"No": initDepts[i],
|
||
|
"Name": ""
|
||
|
});
|
||
|
});
|
||
|
var rootNo = "0";
|
||
|
if(webUser.CCBPMRunModel!= 0)
|
||
|
rootNo = webUser.OrgNo;
|
||
|
loadTree(rootNo);
|
||
|
|
||
|
|
||
|
//TODO 条件参数
|
||
|
var atpara = cond.AtPara;
|
||
|
if (atpara != "") {
|
||
|
var initDDL_SpecOperWay = atpara.split("@")[1].split("=")[1];
|
||
|
document.getElementById("initDDL_SpecOperWay").value = initDDL_SpecOperWay;
|
||
|
document.getElementById("DDL_SpecOperWay").value = initDDL_SpecOperWay;
|
||
|
|
||
|
var initTB_SpecOperPara = atpara.split("@")[2].split("=")[1];
|
||
|
document.getElementById("TB_SpecOperPara").value = initTB_SpecOperPara;
|
||
|
if (initDDL_SpecOperWay != 0) {
|
||
|
document.getElementById("TB_SpecOperPara").disabled = "";
|
||
|
}
|
||
|
document.getElementById("initTB_SpecOperPara").value = initTB_SpecOperPara;
|
||
|
$("#span" + initDDL_SpecOperWay).css("display", "inline-block");
|
||
|
$("#span" + initDDL_SpecOperWay).siblings().css("display", "none");
|
||
|
}
|
||
|
//条件参数 end
|
||
|
//end
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
function loadTree(rootNo) {
|
||
|
|
||
|
|
||
|
var ens = new Entities("BP.WF.Port.Depts");
|
||
|
ens.RetrieveAll();
|
||
|
var jsonTree = createJsonToTree(ens.TurnToArry(), rootNo);
|
||
|
|
||
|
//查询出来数据.
|
||
|
$('#tree').treeview({
|
||
|
data: jsonTree, // 数据源
|
||
|
showCheckbox: true, //是否显示复选框
|
||
|
highlightSelected: false, //是否高亮选中
|
||
|
animate: true,
|
||
|
onNodeChecked: function (event, node) {
|
||
|
var selectNodes = getChildNodeIdArr(node, true); //获取所有子节点
|
||
|
if (selectNodes.length > 0) { //子节点不为空,则选中所有子节点
|
||
|
$('#tree').treeview('checkNode', [selectNodes, { silent: true }]);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
},
|
||
|
onNodeUnchecked: function (event, node) {
|
||
|
|
||
|
var selectNodes = getChildNodeIdArr(node, false); //获取所有子节点
|
||
|
if (selectNodes.length > 0) { //子节点不为空,则取消选中所有子节点
|
||
|
$('#tree').treeview('uncheckNode', [selectNodes, { silent: true }]);
|
||
|
|
||
|
}
|
||
|
|
||
|
},
|
||
|
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) {
|
||
|
var list = [];
|
||
|
if(webUser.CCBPMRunModel!=0){
|
||
|
var list = jsonArray.filter(item=>item.No==parentNo);
|
||
|
if(list.length==0){
|
||
|
var dept = new Entity("BP.Port.Dept",parentNo);
|
||
|
list.push(dept);
|
||
|
}
|
||
|
}else{
|
||
|
list = jsonArray.filter(item=>item.ParentNo==parentNo);
|
||
|
}
|
||
|
$.each(list,function(idx,data){
|
||
|
var checked = false;
|
||
|
var selectedNodes = window.selectedNodes;
|
||
|
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),
|
||
|
"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) {
|
||
|
var childList = []
|
||
|
for (var i = 0; i < jsonArray.length; i++) {
|
||
|
var data = jsonArray[i];
|
||
|
if (data.ParentNo == parentNo) {
|
||
|
var checked = false;
|
||
|
var selectedNodes = window.selectedNodes;
|
||
|
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 getChildNodeIdArr(node, checked) {
|
||
|
var ts = [];
|
||
|
if (node.nodes) {
|
||
|
for (x in node.nodes) {
|
||
|
ts.push(node.nodes[x].nodeId);
|
||
|
if (node.nodes[x].nodes) {
|
||
|
var getNodeDieDai = getChildNodeIdArr(node.nodes[x]);
|
||
|
for (j in getNodeDieDai) {
|
||
|
ts.push(getNodeDieDai[j]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return ts;
|
||
|
}
|
||
|
|
||
|
|
||
|
//执行保存..CondByDept_Save
|
||
|
function Btn_Save_Click() {
|
||
|
|
||
|
var depts = ",";
|
||
|
//获取复选框选中的节点
|
||
|
var nodes = $('#tree').treeview('getChecked');
|
||
|
if (nodes.length == 0) {
|
||
|
alert("请选择部门");
|
||
|
return;
|
||
|
}
|
||
|
var deptNames ="";
|
||
|
$.each(nodes, function (i, node) {
|
||
|
depts += node.id + ",";
|
||
|
var elementId = "CB_Dept_" + node.id;
|
||
|
deptNames += node.text+",";
|
||
|
});
|
||
|
deptNames = deptNames.substring(0, deptNames.length);
|
||
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_Cond");
|
||
|
handler.AddUrlData();
|
||
|
handler.AddPara("depts", depts);
|
||
|
handler.AddPara("deptNames", deptNames);
|
||
|
handler.AddFormData();
|
||
|
var data = handler.DoMethodReturnString("CondByDept_Save");
|
||
|
|
||
|
|
||
|
if (data.indexOf('err@') >= 0) {
|
||
|
alert(data);
|
||
|
return;
|
||
|
}
|
||
|
// alert("保存成功");
|
||
|
Back();
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
function selChange() {
|
||
|
//01.如果 文本框 有初始值就赋初值
|
||
|
var idx = document.getElementById("DDL_SpecOperWay").value;
|
||
|
var idxinit = document.getElementById("initDDL_SpecOperWay").value;
|
||
|
if (idx == idxinit) {
|
||
|
document.getElementById("TB_SpecOperPara").value = document.getElementById("initTB_SpecOperPara").value;
|
||
|
}
|
||
|
else {
|
||
|
document.getElementById("TB_SpecOperPara").value = "";
|
||
|
}
|
||
|
|
||
|
//02.处理文本框样式
|
||
|
if (idx == 0) {
|
||
|
document.getElementById("TB_SpecOperPara").disabled = "disabled";
|
||
|
} else {
|
||
|
document.getElementById("TB_SpecOperPara").disabled = "";
|
||
|
}
|
||
|
//03.处理标签
|
||
|
$("#span" + idx).css("display", "inline-block");
|
||
|
$("#span" + idx).siblings().css("display", "none");
|
||
|
}
|
||
|
|
||
|
//返回.
|
||
|
function Back() {
|
||
|
var url = GetHrefUrl();
|
||
|
if (GetQueryString("CondOrAnd") == null)
|
||
|
url = url.replace('CondDept.htm', 'List.htm');
|
||
|
else {
|
||
|
url = url.replace('CondDept.htm', 'DirList.htm');
|
||
|
url = url.replace('&CondOrAnd=' + GetQueryString("CondOrAnd"), ' ');
|
||
|
|
||
|
}
|
||
|
if (url.indexOf("MyPK=") != -1) {
|
||
|
url = url.replace("&MyPK=" + GetQueryString("MyPK"), "");
|
||
|
}
|
||
|
SetHref(url);
|
||
|
|
||
|
}
|
||
|
</script>
|
||
|
<style type="text/css">
|
||
|
ul .cond li {
|
||
|
display: none;
|
||
|
line-height: 50px;
|
||
|
}
|
||
|
|
||
|
ul .cond li .active {
|
||
|
display: block;
|
||
|
}
|
||
|
|
||
|
select {
|
||
|
display: inline-block;
|
||
|
width: 200px;
|
||
|
}
|
||
|
|
||
|
.btn {
|
||
|
display: inline-block;
|
||
|
height: 20px;
|
||
|
background-color: #0099ff;
|
||
|
text-decoration: none;
|
||
|
color: #fff;
|
||
|
padding: 3px 15px;
|
||
|
margin: 10px 10px;
|
||
|
}
|
||
|
|
||
|
.lbls span {
|
||
|
width: 80px;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="container-full">
|
||
|
<div class="attrnode-bar-header">
|
||
|
<span class="pull-right">
|
||
|
<button id="Btn_Save" name="Btn_Save" onclick="Btn_Save_Click();">保存</button>
|
||
|
<button id="Btn_Back" name="Btn_Back" onclick="Back();">返回</button>
|
||
|
|
||
|
</span>
|
||
|
<strong>方向条件-按部门</strong>
|
||
|
</div>
|
||
|
<form id="cc">
|
||
|
|
||
|
<div style="position:relative;top:10px; margin: 8px; width:100%">
|
||
|
<div style="width: 100%; max-height: 600px; overflow: auto">
|
||
|
<table id="t1" class="table">
|
||
|
|
||
|
|
||
|
</table>
|
||
|
<br />
|
||
|
<div id="tree">
|
||
|
</div>
|
||
|
</div>
|
||
|
<br />
|
||
|
<div>
|
||
|
指定的操作员:<select id="DDL_SpecOperWay" name="DDL_SpecOperWay" onchange="selChange()">
|
||
|
<option selected="selected" value="0">当前操作员</option>
|
||
|
<option value="1">指定节点的操作员</option>
|
||
|
<option value="2">指定表单字段作为操作员</option>
|
||
|
<option value="3">指定操作员编号</option>
|
||
|
</select>
|
||
|
<input type="hidden" name="initDDL_SpecOperWay" id="initDDL_SpecOperWay" value=" " />
|
||
|
<input type="hidden" name="initTB_SpecOperPara" id="initTB_SpecOperPara" value=" " />
|
||
|
<br />
|
||
|
<br />
|
||
|
<span class="lbls">
|
||
|
<span id="span0">参数:</span> <span id="span1" style="display: none">
|
||
|
节点编号:
|
||
|
</span> <span id="span2" style="display: none">表单字段:</span> <span id="span3" style="display: none">操作员编号:</span>
|
||
|
</span>
|
||
|
<input id="TB_SpecOperPara" name="TB_SpecOperPara" type="text" disabled="disabled"
|
||
|
style="width: 200px;" /> 多个值请用英文“逗号”来分隔。
|
||
|
<br />
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</form>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|