|
|
<html>
|
|
|
|
|
|
<head>
|
|
|
<title>组织结构管理</title>
|
|
|
<meta charset="UTF-8" />
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="themes/default/easyui.css" />
|
|
|
<script type="text/javascript" src="/WF/Scripts/jquery-1.11.0.min.js"></script>
|
|
|
<script type="text/javascript" src="/WF/Scripts/jquery/jquery.easyui.min.js"></script>
|
|
|
<script src="/WF/Scripts/jquery/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
|
|
|
<script src="/WF/Scripts/QueryString.js" type="text/javascript"></script>
|
|
|
<link href="/DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
|
|
|
<!-- 引入新版本的类库. -->
|
|
|
<script src="/WF/Scripts/config.js" type="text/javascript"></script>
|
|
|
<script src="/WF/Comm/Gener.js" type="text/javascript"></script>
|
|
|
|
|
|
<link href="/WF/Style/skin/css/Default.css" rel="stylesheet" type="text/css" />
|
|
|
<link href="/WF/Style/skin/adminfont/iconfont.css" rel="stylesheet" type="text/css" />
|
|
|
<!-- 引入GPM配置. -->
|
|
|
<script src="config.js"></script>
|
|
|
|
|
|
<script src="/WF/Scripts/bootstrap/bootstrap-treeview/src/js/bootstrap-treeview.js"
|
|
|
type="text/javascript"></script>
|
|
|
<link href="/WF/Scripts/bootstrap/bootstrap-treeview/src/css/bootstrap-treeview.css" rel="stylesheet"
|
|
|
type="text/css" />
|
|
|
|
|
|
<script src="/WF/Scripts/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
|
|
<link href="/WF/Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
|
|
<link href="/WF/Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" type="text/css" />
|
|
|
|
|
|
<script src="/WF/Scripts/bootstrap/bootstrap-table/src/bootstrap-table.js" type="text/javascript"></script>
|
|
|
<link href="/WF/Scripts/bootstrap/bootstrap-table/src/bootstrap-table.css" rel="stylesheet" type="text/css" />
|
|
|
<script src="/WF/Scripts/bootstrap/bootstrap-table/src/locale/bootstrap-table-zh-CN.js"
|
|
|
type="text/javascript"></script>
|
|
|
<script src="/WF/Scripts/bootstrap/BootstrapUIDialog.js" type="text/javaScript"></script>
|
|
|
<!--引入zTree树. -->
|
|
|
<link href="/WF/Scripts/zTree_v3/css/metroStyle/metroStyle.css" rel="stylesheet" type="text/css" />
|
|
|
<script src="/WF/Scripts/zTree_v3/js/jquery.ztree.all.min.js" type="text/javascript"></script>
|
|
|
<script src="/WF/Scripts/zTree_v3/js/jquery.ztree.core.js" type="text/javascript"></script>
|
|
|
<script src="/WF/Scripts/zTree_v3/js/jquery.ztree.excheck.js" type="text/javascript"></script>
|
|
|
<script src="/WF/Scripts/zTree_v3/js/jquery.ztree.exedit.js" type="text/javascript"></script>
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="/WF/Portal/icons/font-icons.min.css">
|
|
|
<link rel="stylesheet" type="text/css" href="/WF/Portal/icons/icons.css">
|
|
|
<script src="/WF/Portal/layui/layui.js"></script>
|
|
|
<link href="/WF/Portal/layui/css/layui.css" rel="stylesheet" type="text/css" />
|
|
|
<script src="./organization.js" type="text/javascript"></script>
|
|
|
<script type="text/javascript" src="/WF/Portal/js/sortjs/Sortable.min.js"></script>
|
|
|
<script src="/WF/Scripts/layui/LayuiDialog.js"></script>
|
|
|
<script src="/WF/Scripts/xss.js" type="text/javascript"></script>
|
|
|
<style type="text/css">
|
|
|
.ztree * {
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
|
|
|
.ztreeDragUL {
|
|
|
z-index: 999
|
|
|
}
|
|
|
|
|
|
.ztree li a {
|
|
|
color: #565656
|
|
|
}
|
|
|
|
|
|
.small-menu {
|
|
|
margin-top: 10px;
|
|
|
position: absolute;
|
|
|
width: 120px;
|
|
|
z-index: 99999;
|
|
|
border: 0px;
|
|
|
background: #FFF;
|
|
|
padding: 0px;
|
|
|
display: none;
|
|
|
box-shadow: 0 0 6px rgba(0, 0, 0, .2);
|
|
|
}
|
|
|
|
|
|
.small-menu div {
|
|
|
height: 38px !important;
|
|
|
padding-left: 10px;
|
|
|
margin: 0px;
|
|
|
cursor: pointer;
|
|
|
line-height: 38px
|
|
|
}
|
|
|
|
|
|
.small-menu div i {
|
|
|
padding-right: 10px;
|
|
|
}
|
|
|
|
|
|
.small-menu div:hover {
|
|
|
background: #4d49bf !important;
|
|
|
color: #fff !important
|
|
|
}
|
|
|
|
|
|
.small-menu-separator {
|
|
|
padding-bottom: 0;
|
|
|
border-bottom: 1px solid #DDD;
|
|
|
}
|
|
|
|
|
|
.small-menu div.edit A {
|
|
|
background-image: url(images/page_white_edit.png);
|
|
|
}
|
|
|
|
|
|
.small-menu div.cut A {
|
|
|
background-image: url(images/cut.png);
|
|
|
}
|
|
|
|
|
|
.small-menu div.copy A {
|
|
|
background-image: url(images/page_white_copy.png);
|
|
|
}
|
|
|
|
|
|
.small-menu div.paste A {
|
|
|
background-image: url(images/page_white_paste.png);
|
|
|
}
|
|
|
|
|
|
.small-menu div.delete A {
|
|
|
background-image: url(images/page_white_delete.png);
|
|
|
}
|
|
|
|
|
|
.small-menu div.quit A {
|
|
|
background-image: url(images/door.png);
|
|
|
}
|
|
|
|
|
|
.modal-header {
|
|
|
line-height: 38px !important;
|
|
|
height: 38px !important;
|
|
|
background: #f7f7f7 !important;
|
|
|
padding: 0px 10px !important;
|
|
|
}
|
|
|
|
|
|
.modal-header .modal-title {
|
|
|
color: #4d49bf !important;
|
|
|
font-weight: bold !important;
|
|
|
line-height: 38px !important;
|
|
|
height: 38px !important;
|
|
|
margin-top: 0px !important;
|
|
|
}
|
|
|
|
|
|
.modal-header h3 {
|
|
|
font-size: 16px;
|
|
|
color: #414141;
|
|
|
}
|
|
|
|
|
|
.modal-header #closeModal {
|
|
|
background: #f7941f !important;
|
|
|
font-size: 16px !important;
|
|
|
width: 16px !important;
|
|
|
height: 16px !important;
|
|
|
line-height: 16px !important;
|
|
|
text-align: center !important;
|
|
|
border-radius: 50% !important;
|
|
|
color: #fff !important;
|
|
|
padding: 0px !important;
|
|
|
margin: 10px !important;
|
|
|
}
|
|
|
|
|
|
.modal-header #closeModal:hover {
|
|
|
color: #fff !important;
|
|
|
background: #4d49bf !important;
|
|
|
}
|
|
|
</style>
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
var deptNo = "";
|
|
|
var webUser = new WebUser();
|
|
|
var tree = {
|
|
|
zTree: '',
|
|
|
pNode: '',
|
|
|
setting: {
|
|
|
isSimpleData: true,
|
|
|
treeNodeKey: "id",
|
|
|
treeNodeParentKey: "pid",
|
|
|
showLine: true,
|
|
|
root: {
|
|
|
isRoot: true,
|
|
|
nodes: []
|
|
|
},
|
|
|
view: {
|
|
|
dblClickExpand: false, //双击节点时,是否自动展开父节点的标识
|
|
|
showLine: true, //是否显示节点之间的连线
|
|
|
fontCss: {}, //字体样式函数
|
|
|
selectedMulti: false, //设置是否允许同时选中多个节点
|
|
|
autoExpandFirst: true
|
|
|
},
|
|
|
check: {
|
|
|
chkboxType: {
|
|
|
"Y": "ps",
|
|
|
"N": "ps"
|
|
|
},
|
|
|
chkboxType: {
|
|
|
"Y": "",
|
|
|
"N": ""
|
|
|
},
|
|
|
chkStyle: "checkbox", //复选框类型
|
|
|
enable: false //每个节点上是否显示 CheckBox
|
|
|
},
|
|
|
edit: {
|
|
|
enable: true,
|
|
|
editNameSelectAll: true,
|
|
|
showRemoveBtn: false,
|
|
|
showRenameBtn: false,
|
|
|
removeTitle: "remove",
|
|
|
renameTitle: "rename",
|
|
|
drag: {
|
|
|
// 打开复制功能,Ctrl+鼠标左键点击后拖拽
|
|
|
isCopy: false,
|
|
|
// 打开移动功能,鼠标左键点击后拖拽
|
|
|
isMove: true
|
|
|
},
|
|
|
},
|
|
|
data: {
|
|
|
simpleData: {
|
|
|
enable: true,
|
|
|
idKey: "id",
|
|
|
pIdKey: "pid",
|
|
|
rootPId: WebUser.FK_Dept,
|
|
|
}
|
|
|
},
|
|
|
callback: {
|
|
|
onClick: function (event, treeId, treeNode) {
|
|
|
deptNo = treeNode.id;
|
|
|
BindEmps();
|
|
|
},
|
|
|
// beforeDrag: zTreeBeforeDrag,
|
|
|
onDrop: zTreeOnDrop,
|
|
|
onRightClick: OnRightClick,
|
|
|
|
|
|
onExpand: function (event, treeId, treeNode) {
|
|
|
tree.pNode = treeNode;
|
|
|
tree.loadNodeByPNode();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
loadRootNode: function () { //加载根节点,pid=0
|
|
|
var zNodes = [];
|
|
|
var fk_dept = webUser.FK_Dept;
|
|
|
if (webUser.CCBPMRunModel != 0) {
|
|
|
fk_dept = webUser.OrgNo;
|
|
|
}
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.GPMPage");
|
|
|
var ens = handler.DoMethodReturnJSON("Organization_Init");
|
|
|
var zNodes = createJsonToTree(ens, fk_dept);
|
|
|
$.fn.zTree.init($("#regionZTree"), tree.setting, zNodes);
|
|
|
tree.zTree = $.fn.zTree.getZTreeObj("regionZTree");
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 该方法是点击父节点的+号后执行的,意味着执行该方法的时候树已经生成了
|
|
|
* 所以才能用tree.zTree
|
|
|
*/
|
|
|
loadNodeByPNode: function () {
|
|
|
var children = [];
|
|
|
var folder = false;
|
|
|
//获取pid = mid的数据,也就是子节点的id等于父节点的id,说明此父节点加载了子节点
|
|
|
if (!tree.zTree.getNodeByParam("pid", tree.pNode.id)) {
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.GPMPage");
|
|
|
handler.AddPara("ParentNo", tree.pNode.id);
|
|
|
var ens = handler.DoMethodReturnJSON("Organization_GetDeptsByParentNo");
|
|
|
var zNodes = createJsonToTree(ens, tree.pNode.id);
|
|
|
tree.zTree.addNodes(tree.pNode, zNodes, true);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
};
|
|
|
function zTreeOnDrop(event, treeId, treeNodes, targetNode, moveType) {
|
|
|
//targetNode为null时,即进行了拖拽行为,但是没有改变排序
|
|
|
if (targetNode == null) return;
|
|
|
var thisParentId;
|
|
|
thisParentId = treeNodes[0].pid;
|
|
|
var targetParentId;
|
|
|
//移动后父节点
|
|
|
targetParentId = targetNode.pid;
|
|
|
|
|
|
|
|
|
//判断是否为同级移动,即是否在同一级目录下拖拽
|
|
|
if (moveType != 'inner') {
|
|
|
var dept = new Entity("BP.Port.Dept", treeNodes[0].id);
|
|
|
dept.ParentNo = targetParentId;
|
|
|
dept.Update();
|
|
|
if (thisParentId == targetParentId) {
|
|
|
var tpNode = targetNode.getParentNode();
|
|
|
var nodes = tpNode.children;
|
|
|
//遍历拖拽后的该级所有结点,拼成一个id数组
|
|
|
var idArray = new Array()
|
|
|
for (var i = 0, l = nodes.length; i < l; i++) {
|
|
|
idArray[i] = nodes[i].id;
|
|
|
}
|
|
|
|
|
|
console.log(idArray)
|
|
|
//调用自己的ajax后台方法
|
|
|
|
|
|
/* var deptIDs = "xxx,xx,33,xxx,"; //deptIDs =idArray*/
|
|
|
var dept = new Entity("BP.Port.Dept", targetParentId);//pid=targetParentId
|
|
|
dept.DoMethodReturnString("DoOrder", idArray);
|
|
|
}
|
|
|
}
|
|
|
if (moveType == 'inner' && confirm('确定要将[ ' + treeNodes[0].name + ' ]移动到[ ' + targetNode.name + ' ]下?')) {
|
|
|
var dept = new Entity("BP.Port.Dept", treeNodes[0].id);
|
|
|
dept.ParentNo = targetNode.id;
|
|
|
dept.Update();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
//刷新节点
|
|
|
function refreshParentNode() {
|
|
|
var zTree = $.fn.zTree.getZTreeObj("regionZTree"),
|
|
|
type = "refresh",
|
|
|
silent = false,
|
|
|
nodes = zTree.getSelectedNodes();
|
|
|
|
|
|
/*根据 zTree 的唯一标识 tId 快速获取节点 JSON 数据对象*/
|
|
|
var parentNode = zTree.getNodeByTId(nodes[0].parentTId);
|
|
|
/*选中指定节点*/
|
|
|
zTree.selectNode(parentNode);
|
|
|
zTree.reAsyncChildNodes(parentNode, type, silent);
|
|
|
|
|
|
}
|
|
|
|
|
|
//右键菜单功能实现
|
|
|
(function ($, undefined) {
|
|
|
$.fn.popupSmallMenu = function (options) {
|
|
|
var $currMenu = $(this),
|
|
|
defaultOptions = {
|
|
|
event: null,
|
|
|
onClickItem: null
|
|
|
},
|
|
|
options = $.extend(defaultOptions, options);
|
|
|
|
|
|
var _smallMenu = {
|
|
|
popupSmallMenu: function () {
|
|
|
this._bindItemClick();
|
|
|
this._bindMenuEvent();
|
|
|
this._showMenu();
|
|
|
return $currMenu;
|
|
|
},
|
|
|
_bindMenuEvent: function () {
|
|
|
var thiz = this;
|
|
|
$currMenu.hover(function () {
|
|
|
}, function () {
|
|
|
thiz._unBindItemClick();
|
|
|
$currMenu.hide();
|
|
|
});
|
|
|
|
|
|
$currMenu.click(function () {
|
|
|
thiz._unBindItemClick();
|
|
|
$currMenu.hide();
|
|
|
});
|
|
|
},
|
|
|
_showMenu: function () {
|
|
|
if (!options.event) {
|
|
|
alert('请传入鼠标事件');
|
|
|
}
|
|
|
debugger
|
|
|
var height = options.event.clientY;
|
|
|
var height1 = $(document.body).height();
|
|
|
var width1 = $("#TreeLayout").width();
|
|
|
var DValue = height1 - height;
|
|
|
if (DValue < 230) {
|
|
|
height = options.event.clientY - 158;
|
|
|
}
|
|
|
height = height - 70;
|
|
|
var left = options.event.clientX + 10;
|
|
|
if (width1 - options.event.clientX < 120)
|
|
|
left = options.event.clientX - 120;
|
|
|
$currMenu.css({
|
|
|
top: height + "px",
|
|
|
left: left + "px",
|
|
|
display: "block"
|
|
|
});
|
|
|
},
|
|
|
_bindItemClick: function () {
|
|
|
$currMenu.find('div').each(function (index, obj) {
|
|
|
var $li = $(obj);
|
|
|
var itemIden = $li.attr('class');
|
|
|
$li.bind('click', function (event) {
|
|
|
event.stopPropagation();
|
|
|
if (options.onClickItem &&
|
|
|
typeof options.onClickItem === 'function') {
|
|
|
options.onClickItem(itemIden);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
_unBindItemClick: function () {
|
|
|
$currMenu.find('div').each(function (index, obj) {
|
|
|
$(obj).unbind();
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
return _smallMenu.popupSmallMenu();
|
|
|
}
|
|
|
})(jQuery);
|
|
|
|
|
|
//右键点击
|
|
|
function OnRightClick(event, treeId, treeNode) {
|
|
|
tree.zTree.selectNode(treeNode);
|
|
|
if (treeNode) {
|
|
|
//弹出菜单
|
|
|
$("#menu").popupSmallMenu({
|
|
|
event: event,
|
|
|
onClickItem: function (item) {
|
|
|
if (item == "moveUpDept") {
|
|
|
moveUpDept(treeNode, item);
|
|
|
} else if (item == "moveDownDept") {
|
|
|
moveDownDept(treeNode, item);
|
|
|
} else if (item == "edit") {
|
|
|
Edit(treeNode);
|
|
|
} else if (item == "newSameLevel") {
|
|
|
NewSameLevel(treeNode);
|
|
|
} else if (item == "newNextLevel") {
|
|
|
NewNextLevel(treeNode);
|
|
|
} else if (item == "delete") {
|
|
|
Delete(treeNode);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//上移部门
|
|
|
function moveUpDept(treeNode, item) {
|
|
|
var dept = new Entity(deptEnName, treeNode.id);
|
|
|
var data = dept.DoMethodReturnString("DoUp");
|
|
|
//树节点直接更新
|
|
|
var before = $("#" + treeNode.tId).prev();
|
|
|
if (before.length == 0) {
|
|
|
return;
|
|
|
}
|
|
|
$("#" + treeNode.tId).insertBefore(before);
|
|
|
}
|
|
|
|
|
|
//下移部门
|
|
|
function moveDownDept(treeNode, item) {
|
|
|
var dept = new Entity(deptEnName, treeNode.id);
|
|
|
var data = dept.DoMethodReturnString("DoDown");
|
|
|
//树节点直接更新
|
|
|
var next = $("#" + treeNode.tId).next();
|
|
|
if (next.length == 0) {
|
|
|
return;
|
|
|
}
|
|
|
$("#" + treeNode.tId).insertAfter(next);
|
|
|
}
|
|
|
|
|
|
//增加同级部门
|
|
|
function NewSameLevel(treeNode) {
|
|
|
|
|
|
if (treeNode.pid == null) {
|
|
|
alert('您不能增加同级,当前级别是最高级.');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var deptNo = null;
|
|
|
//如果部门编号的模式是自己编写的.
|
|
|
if (NewDeptNoModel == 0) {
|
|
|
deptNo = GenerNewDeptNo(treeNode.id, treeNode.pid);
|
|
|
if (deptNo == null || deptNo == undefined)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var val = prompt("请输入部门名称", "");
|
|
|
if (val == null || val == '') {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var dept = new Entity(deptEnName);
|
|
|
dept.Name = val;
|
|
|
dept.ParentNo = treeNode.pid;
|
|
|
if (deptNo != null)
|
|
|
dept.No = deptNo;
|
|
|
|
|
|
if (webUser.CCBPMRunModel != 0) {
|
|
|
var sdept = new Entity(deptEnName, treeNode.id);
|
|
|
dept.OrgNo = sdept.OrgNo;
|
|
|
}
|
|
|
dept.Insert();
|
|
|
|
|
|
//更新树节点
|
|
|
var treeObj = $.fn.zTree.getZTreeObj("regionZTree");
|
|
|
var parentNode = treeObj.getNodeByTId(treeNode.parentTId);
|
|
|
var newNode = {
|
|
|
name: val,
|
|
|
id: dept.No
|
|
|
};
|
|
|
//把这个新节点添加到当前选中的节点下,作为它的子节点
|
|
|
newNode = treeObj.addNodes(parentNode, newNode);
|
|
|
}
|
|
|
|
|
|
//增加下级部门
|
|
|
function NewNextLevel(treeNode) {
|
|
|
|
|
|
var deptNo = null;
|
|
|
//如果部门编号的模式是自己编写的.
|
|
|
if (NewDeptNoModel == 0) {
|
|
|
|
|
|
deptNo = GenerNewDeptNo(treeNode.id, treeNode.pid);
|
|
|
if (deptNo == null || deptNo == undefined)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var val = prompt("请输入部门名称", "");
|
|
|
if (val == null || val == '') {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
var dept = new Entity(deptEnName);
|
|
|
if (deptNo != null)
|
|
|
dept.No = deptNo;
|
|
|
|
|
|
dept.Name = val;
|
|
|
dept.ParentNo = treeNode.id
|
|
|
if (webUser.CCBPMRunModel != 0) {
|
|
|
var pdept = new Entity(deptEnName, treeNode.id);
|
|
|
dept.OrgNo = pdept.OrgNo
|
|
|
}
|
|
|
dept.Insert();
|
|
|
|
|
|
//更新树节点
|
|
|
var treeObj = $.fn.zTree.getZTreeObj("regionZTree");
|
|
|
|
|
|
var newNode = {
|
|
|
name: val,
|
|
|
id: dept.No
|
|
|
};
|
|
|
//var newNode = { name: val };
|
|
|
//把这个新节点添加到当前选中的节点下,作为它的子节点
|
|
|
newNode = treeObj.addNodes(treeNode, newNode);
|
|
|
}
|
|
|
|
|
|
//编辑部门
|
|
|
function Edit(treeNode) {
|
|
|
var name = $("#" + treeNode.tId + "_span").text()
|
|
|
var val = prompt("请输入部门名称", name);
|
|
|
if (val == null || val == '') {
|
|
|
//alert('必须输入名称.');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
var dept = new Entity(deptEnName, treeNode.id);
|
|
|
dept.Name = val;
|
|
|
dept.Update();
|
|
|
//更新树节点
|
|
|
$("#" + treeNode.tId + "_span").text(val);
|
|
|
}
|
|
|
|
|
|
//删除部门
|
|
|
function Delete(treeNode) {
|
|
|
if (confirm("你确定删除该部门吗?") == false)
|
|
|
return;
|
|
|
var dept = new Entity(deptEnName, treeNode.id);
|
|
|
dept.Delete();
|
|
|
//树节点删除
|
|
|
var my = document.getElementById(treeNode.tId);
|
|
|
if (my != null)
|
|
|
my.parentNode.removeChild(my);
|
|
|
}
|
|
|
|
|
|
function GenerNewDeptNo(no, parentNo) {
|
|
|
|
|
|
var alt = "请输入部门编号";
|
|
|
alt += "\t\n 1.如为空,则系统自动生成.";
|
|
|
alt += "\t\n 2.如输入已经存在的部门编码,系统就会抛出错误.";
|
|
|
alt += "\t\n 3.当前部门的编码为:" + no + ", 父节点的ID为:" + parentNo;
|
|
|
|
|
|
var deptNo = prompt(alt, "");
|
|
|
|
|
|
deptNo = deptNo.trim();
|
|
|
var reg = new RegExp("[\u4E00-\u9FA5]+");
|
|
|
if (reg.test(deptNo)) {
|
|
|
alert("不允许输入中文字符");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (deptNo == null || deptNo == '') {
|
|
|
//需要系统自动生成编号,就直接走insert();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
while (true) {
|
|
|
if (deptNo == null || deptNo == '') {
|
|
|
break;
|
|
|
} else {
|
|
|
var dept = new Entity(deptEnName);
|
|
|
dept.No = deptNo;
|
|
|
if (dept.RetrieveFromDBSources() == 0)
|
|
|
break;
|
|
|
|
|
|
deptNo = prompt('该编号已经存在,请重新输入,(点击取消让系统自动生成编号)', deptNo);
|
|
|
continue;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (deptNo == '')
|
|
|
deptNo = null;
|
|
|
|
|
|
return deptNo;
|
|
|
}
|
|
|
|
|
|
//初始化
|
|
|
$(function () {
|
|
|
$("#pageloading").show();
|
|
|
Reset(); //加载重置查询条件
|
|
|
|
|
|
tree.loadRootNode();
|
|
|
fillter(); //设置展开前三级
|
|
|
//绑定帮助信息.
|
|
|
var html = "<br><br> <h3 style='padding-left:5px'>驰骋组织结构管理</h3>";
|
|
|
|
|
|
html += "<ul>";
|
|
|
html += "<li>该组织结构可以与您的系统集成,<a href='http://ccbpm.mydoc.io/?v=5404&t=15928' target=_blank >如何集成请参考集成手册.</a></li>";
|
|
|
html += "<li>本功能维护了人员信息Port_Emp, 部门信息Port_Dept, 一人多部门(我们成为兼职Port_DeptEmp), 一人多部门多岗位(Port_DeptEmpStation)</li>";
|
|
|
html += "<li>维护部门在节点上点击右键,可以新建,保存,修改。</li>";
|
|
|
html += "</ul>";
|
|
|
html = "";
|
|
|
|
|
|
$("#Emps").html(html);
|
|
|
$("#pageloading").hide();
|
|
|
//鼠标移开时右键菜单消失
|
|
|
$(document).on('mouseleave ', '.dropdown-menu', function () {
|
|
|
$(".dropdown-menu").hide();
|
|
|
$.learunindex.destroy
|
|
|
});
|
|
|
|
|
|
// 绑定表格右键菜单
|
|
|
bindContextMenu()
|
|
|
|
|
|
//默认父节点获得父节点数据
|
|
|
const rootElement = document.querySelector('.ztree li:first-child a');
|
|
|
rootElement.click();
|
|
|
});
|
|
|
|
|
|
//设置展开前三级
|
|
|
function fillter() {
|
|
|
//获得树形图对象
|
|
|
var nodeList = tree.zTree.getNodes(); //展开第一个根节点
|
|
|
for (var i = 0; i < nodeList.length; i++) { //设置节点展开第二级节点
|
|
|
tree.zTree.expandNode(nodeList[i], true, false, true);
|
|
|
//添加默认选中获得id
|
|
|
tree.zTree.selectNode(nodeList[i]);
|
|
|
}
|
|
|
}
|
|
|
//转换ztree需要的数据格式
|
|
|
var treeJson = [];
|
|
|
|
|
|
function createJsonToTree(jsonArray, parentNo) {
|
|
|
// fix firefox bug
|
|
|
document.body.ondrop = function (event) {
|
|
|
event.preventDefault();
|
|
|
event.stopPropagation();
|
|
|
}
|
|
|
treeJson = [];
|
|
|
|
|
|
if (webUser.No == "admin") {
|
|
|
|
|
|
for (var i = 0; i < jsonArray.length; i++) {
|
|
|
var data = jsonArray[i];
|
|
|
if (data.No === "" || data.No == undefined)
|
|
|
continue;
|
|
|
treeJson.push({
|
|
|
"id": data.No,
|
|
|
"pid": data.ParentNo,
|
|
|
"name": data.Name,
|
|
|
"idx": data.Idx,
|
|
|
isParent: true,
|
|
|
parent: true,
|
|
|
spread: true,
|
|
|
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
//添加本部门的一条数据
|
|
|
$.each(jsonArray, function (i, o) {
|
|
|
if (o.No == parentNo) {
|
|
|
treeJson.push({
|
|
|
"id": o.No,
|
|
|
"pid": o.ParentNo,
|
|
|
"name": o.Name,
|
|
|
"idx": o.Idx,
|
|
|
isParent: true,
|
|
|
parent: true,
|
|
|
children: []
|
|
|
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
});
|
|
|
//循环加入本部门的所有下级部门
|
|
|
findChildren(jsonArray, parentNo);
|
|
|
}
|
|
|
return treeJson;
|
|
|
}
|
|
|
|
|
|
function findChildren(jsonArray, parentNo) {
|
|
|
|
|
|
$.each(jsonArray, function (i, o) {
|
|
|
if (o.ParentNo == parentNo) {
|
|
|
treeJson.push({
|
|
|
"id": o.No,
|
|
|
"pid": o.ParentNo,
|
|
|
"name": o.Name,
|
|
|
"idx": o.Idx,
|
|
|
children: []
|
|
|
|
|
|
});
|
|
|
findChildren(jsonArray, o.No);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//绑定人员.
|
|
|
function BindEmps() {
|
|
|
|
|
|
var dept = new Entity(deptEnName, deptNo);
|
|
|
|
|
|
var html = "";
|
|
|
html += "<div class='container'>";
|
|
|
html += "<div class='fixed-table-header'>";
|
|
|
html += "<table class='table table-hover table-striped' style='width:90%;' >";
|
|
|
html += "<tr><h5 style='margin-top: 20px;margin-bottom: 20px'><a class='layui-btn layui-btn-primary layui-border-gray layui-btn-sm' href=\"javascript:EditDept('" + dept.No + "')\" >" + dept.Name + " </a> " +
|
|
|
"<a class='layui-btn layui-btn-primary layui-border-blue layui-btn-sm' href='javascript:NewOrg()'>新建组织</a> " +
|
|
|
"<a class='layui-btn layui-btn-primary layui-border-blue layui-btn-sm' href='javascript:EditEmp()'>新建人员</a> " +
|
|
|
"<a class='layui-btn layui-btn-primary layui-border-green layui-btn-sm' href='javascript:RefEmps()'>关联人员</a> </h5></tr>";
|
|
|
html += "<thead ><tr> ";
|
|
|
html += "<th style='background-color:#F2F2F2;'>序号</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>编号</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>名称</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>主部门</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>邮件</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>电话</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>状态</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>操作</th>";
|
|
|
html += "</tr></thead>";
|
|
|
|
|
|
var emps = new Entities(empEnsName);
|
|
|
emps.Retrieve("FK_Dept", dept.No, "port_emp.Idx");
|
|
|
|
|
|
var empNos = ",";
|
|
|
html += "<tbody class='dept-sort'>";
|
|
|
for (var i = 0; i < emps.length; i++) {
|
|
|
|
|
|
var emp = emps[i];
|
|
|
html += "<tr data-id='" + emp.No + "' data-pid='" + dept.No + "' class='dept-dropdown-item' ondblclick=\"EditEmp('" + emp.No + "')\" >";
|
|
|
|
|
|
html += "<td class='Idx' >" + (i + 1) + "</td>";
|
|
|
html += "<td>" + emp.No + "</td>";
|
|
|
html += "<td><a href=\"javascript:EditEmp('" + emp.No + "')\">" + emp.Name + "</a></td>";
|
|
|
html += "<td>" + dept.Name + "</td>";
|
|
|
if (emp.Email == null || emp.Email === "")
|
|
|
html += "<td>-</td>";
|
|
|
else
|
|
|
html += "<td>" + emp.Email + "</td>";
|
|
|
if (emp.Tel == null || emp.Tel === "")
|
|
|
html += "<td>-</td>";
|
|
|
else
|
|
|
html += "<td>" + emp.Tel + "</td>";
|
|
|
|
|
|
if (emp.EmpSta == 0) {
|
|
|
html += "<td>正常</td>";
|
|
|
html += "<td><button data-id='" + emp.No + "' data-pid='" + dept.No + "' class='dept-dropdown-btn layui-btn layui-btn-primary layui-border-blue layui-btn-xs' style='width: 100%'>操作</button></td>";
|
|
|
}
|
|
|
|
|
|
if (emp.EmpSta == 1) {
|
|
|
html += "<td>禁用</td>";
|
|
|
html += "<td><button data-id='" + emp.No + "' data-pid='" + dept.No + "' class='bl-dropdown-btn layui-btn layui-btn-primary layui-border-blue layui-btn-xs' style='width: 100%'>操作</button></td>";
|
|
|
|
|
|
}
|
|
|
|
|
|
html += "</tr>";
|
|
|
empNos += emp.No + ',';
|
|
|
}
|
|
|
html += "</tbody>"
|
|
|
|
|
|
//取消人员部门岗位管理关系. @不能出现sql.
|
|
|
var deptEmps = new Entities("BP.Port.DeptEmps");
|
|
|
deptEmps.DoMethodReturnString("DelteNotInEmp");
|
|
|
var deptEmpStas = new Entities("BP.Port.DeptEmpStations");
|
|
|
deptEmpStas.DoMethodReturnString("DelteNotInEmp");
|
|
|
|
|
|
|
|
|
//查询出来兼职人员.
|
|
|
var deptEmps = new Entities("BP.Port.DeptEmps");
|
|
|
deptEmps.Retrieve("FK_Dept", deptNo);
|
|
|
|
|
|
var num = emps.length;
|
|
|
|
|
|
html += "<tbody class='part-time-sort'>";
|
|
|
for (var i = 0; i < deptEmps.length; i++) {
|
|
|
|
|
|
var deptEmp = deptEmps[i];
|
|
|
if (empNos.indexOf(',' + deptEmp.FK_Emp + ',') != -1)
|
|
|
continue;
|
|
|
|
|
|
var emp = new Entity(empEnName);
|
|
|
emp.No = deptEmp.FK_Emp;
|
|
|
emp.SetPKVal(emp.No);
|
|
|
if (emp.RetrieveFromDBSources() == 0) {
|
|
|
//if (emp.Retrieve() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
html += "<tr data-id='" + emp.No + "' data-pid='" + emp.FK_Dept + "' class='ptj-dropdown-item' ondblclick=\"EditEmp('" + emp.No + "')\" >";
|
|
|
html += "<td class='Idx' >" + num + "</td>";
|
|
|
html += "<td>" + emp.No + "</td>";
|
|
|
html += "<td><a href=\"javascript:EditEmp('" + emp.No + "')\">" + emp.Name + "</a></td>";
|
|
|
html += "<td>兼职</td>";
|
|
|
if (emp.Email == null || emp.Email === "")
|
|
|
html += "<td>-</td>";
|
|
|
else
|
|
|
html += "<td>" + emp.Email + "</td>";
|
|
|
if (emp.Tel == null || emp.Tel === "")
|
|
|
html += "<td>-</td>";
|
|
|
else
|
|
|
html += "<td>" + emp.Tel + "</td>";
|
|
|
if (emp.EmpSta == 0)
|
|
|
html += "<td>正常</td>";
|
|
|
if (emp.EmpSta == 1)
|
|
|
html += "<td>禁用</td>";
|
|
|
html += "<td><button data-id='" + emp.No + "' data-pid='" + emp.FK_Dept + "' class='ptj-dropdown-btn layui-btn layui-btn-primary layui-border-green layui-btn-sm' style='width: 100%'>兼职操作</button></td>";
|
|
|
html += "</tr>";
|
|
|
num++;
|
|
|
|
|
|
empNos += emp.No + ',';
|
|
|
}
|
|
|
html += "</tbody>"
|
|
|
|
|
|
//把WF_Emp中主部门是当前部门且禁用的查询出来
|
|
|
var wfEmps = new Entities("BP.WF.Port.WFEmps");
|
|
|
wfEmps.Retrieve("FK_Dept", deptNo, "UseSta", 0);
|
|
|
|
|
|
html += "<tbody class='blacklist-sort'>";
|
|
|
for (var i = 0; i < wfEmps.length; i++) {
|
|
|
var emp = wfEmps[i];
|
|
|
if (empNos.indexOf(',' + emp.No + ',') != -1)
|
|
|
continue;
|
|
|
html += "<tr data-id='" + emp.No + "' data-pid='" + emp.FK_Dept + "' class='bl-dropdown-item' ondblclick=\"EditEmp('" + emp.No + "')\" >";
|
|
|
html += "<td class='Idx' >" + (i + 1) + "</td>";
|
|
|
html += "<td>" + emp.No + "</td>";
|
|
|
html += "<td>" + emp.Name + "</td>";
|
|
|
html += "<td>" + dept.Name + "</td>";
|
|
|
if (emp.Email == null || emp.Email === "")
|
|
|
html += "<td>-</td>";
|
|
|
else
|
|
|
html += "<td>" + emp.Email + "</td>";
|
|
|
if (emp.Tel == null || emp.Tel === "")
|
|
|
html += "<td>-</td>";
|
|
|
else
|
|
|
html += "<td>" + emp.Tel + "</td>";
|
|
|
html += "<td><button data-id='" + emp.No + "' data-pid='" + emp.FK_Dept + "' class='bl-dropdown-btn layui-btn layui-btn-primary layui-border-red layui-btn-sm' style='width: 100%'>黑名单操作</button></td>";
|
|
|
html += "</tr>";
|
|
|
empNos += emp.No + ',';
|
|
|
}
|
|
|
html += "</tbody>";
|
|
|
html += "</table>";
|
|
|
html += "</div>";
|
|
|
html += "</div>";
|
|
|
$("#Emps").html(html);
|
|
|
bindContextMenu()
|
|
|
bindSortableJs()
|
|
|
}
|
|
|
|
|
|
function OpenChatFeiGe(toEmpNo, toEmpName, deptNo, deptName, orgNo, orgName) {
|
|
|
|
|
|
OpenChat(webUser.No, toEmpNo, toEmpName, "您好:" + toEmpName, false, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 禁用用户信息
|
|
|
* @param empNo
|
|
|
*/
|
|
|
function DoUnEnable(empNo) {
|
|
|
|
|
|
//把用户的信息禁用掉存储到WF_Emp表中
|
|
|
var emp = new Entity("BP.Port.Emp", empNo);
|
|
|
var data = emp.DoMethodReturnString("DoUnEnable");
|
|
|
alert(data);
|
|
|
BindEmps();
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 启用用户
|
|
|
* @param empNo
|
|
|
*/
|
|
|
function DoEnable(empNo) {
|
|
|
|
|
|
var wfEmp = new Entity("BP.WF.Port.WFEmp", empNo);
|
|
|
wfEmp.UseSta = 1; //启用
|
|
|
wfEmp.Save();
|
|
|
|
|
|
var emp = new Entity("BP.Port.Emp", empNo);
|
|
|
emp.EmpSta = 0
|
|
|
emp.Update();
|
|
|
BindEmps();
|
|
|
|
|
|
}
|
|
|
|
|
|
function Up(no) {
|
|
|
var emp = new Entity(empEnName, no);
|
|
|
var data = emp.DoMethodReturnString("DoUp");
|
|
|
BindEmps();
|
|
|
}
|
|
|
|
|
|
function Down(no) {
|
|
|
|
|
|
var emp = new Entity(empEnName, no);
|
|
|
var data = emp.DoMethodReturnString("DoDown");
|
|
|
BindEmps();
|
|
|
}
|
|
|
|
|
|
function EditDept(no) {
|
|
|
|
|
|
//如果是集团模式,并且是admin.
|
|
|
if (webUser.CCBPMRunModel == 1 && webUser.No == "admin") {
|
|
|
if (deptEnName == 'BP.Port.Dept')
|
|
|
deptEnName = "BP.WF.Port.Admin2Group.Dept";
|
|
|
}
|
|
|
|
|
|
//如果是单组织模式,并且是admin.
|
|
|
if (webUser.CCBPMRunModel == 0 && webUser.No == "admin") {
|
|
|
if (deptEnName == 'BP.WF.Port.Admin2Group.Dept')
|
|
|
deptEnName = "BP.Port.Dept";
|
|
|
}
|
|
|
|
|
|
var url = '/WF/Comm/En.htm?EnName=' + deptEnName + '&No=' + no + '&FK_Dept=' + deptNo;
|
|
|
OpenBootStrapModal(url, "eudlgframe", "编辑", '800', '500', "icon-edit", true, null, null);
|
|
|
}
|
|
|
|
|
|
function EditEmp(no) {
|
|
|
var orgNo = "";
|
|
|
if (webUser.CCBPMRunModel != 0) {
|
|
|
var dept = new Entity(deptEnName, deptNo);
|
|
|
orgNo = dept.OrgNo;
|
|
|
}
|
|
|
|
|
|
if (no == undefined) {
|
|
|
|
|
|
//编号生成规则: 0=手工输入自己编号 1=系统自动生成.
|
|
|
if (NewEmpNoModel == 0) {
|
|
|
|
|
|
}
|
|
|
|
|
|
var url = '/WF/Comm/En.htm?EnName=' + empEnName + '&FK_Dept=' + deptNo + (webUser.CCBPMRunModel == 1 ? '&OrgNo=' + orgNo : '');
|
|
|
OpenBootStrapModal(url, "eudlgframe", "编辑", '800', '500', "icon-edit", false, function () {
|
|
|
}, null, function () {
|
|
|
//刷新打开的页面
|
|
|
BindEmps();
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var url = '/WF/Comm/En.htm?EnName=' + empEnName + '&PKVal=' + no + '&FK_Dept=' + deptNo + (webUser.CCBPMRunModel == 1 ? '&OrgNo=' + orgNo : '');;
|
|
|
OpenBootStrapModal(url, "eudlgframe", "编辑", '800', '500', "icon-edit", false, function () {
|
|
|
}, null, function () {
|
|
|
//刷新打开的页面
|
|
|
BindEmps();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function NewOrg() {
|
|
|
|
|
|
var orgNo = window.prompt('请输入组织编号:半角字母或者下划线数字', '');
|
|
|
if (orgNo == null || orgNo == undefined)
|
|
|
return;
|
|
|
|
|
|
var orgName = window.prompt('请输入组织名称', '');
|
|
|
if (orgName == null || orgName == undefined)
|
|
|
return;
|
|
|
|
|
|
var handler = new HttpHandler("BP.Cloud.HttpHandler.Admin");
|
|
|
handler.AddPara("OrgNo", orgNo);
|
|
|
handler.AddPara("OrgName", orgName);
|
|
|
var data = handler.DoMethodReturnString("Organization_CreateOrg");
|
|
|
alert(data);
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
window.location.href = window.location.href;
|
|
|
}
|
|
|
|
|
|
function RefEmps() {
|
|
|
|
|
|
var empNo = window.prompt('请输入本组织的人员账号', '');
|
|
|
if (empNo == null || empNo == undefined)
|
|
|
return;
|
|
|
|
|
|
var myNo = webUser.OrgNo + '_' + empNo;
|
|
|
var emp = new Entity("BP.Port.Emp");
|
|
|
emp.No = myNo;
|
|
|
if (emp.RetrieveFromDBSources() == 0) {
|
|
|
alert("人员编号错误:" + empNo);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var deptEmp = new Entity("BP.Port.DeptEmp");
|
|
|
deptEmp.MyPK = deptNo + '_' + empNo;
|
|
|
if (deptEmp.RetrieveFromDBSources() == 1) {
|
|
|
alert("人员编号:" + empNo + "已经存在当前部门里面.");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
deptEmp.FK_Dept = deptNo;
|
|
|
deptEmp.OrgNo = webUser.OrgNo;
|
|
|
deptEmp.FK_Emp = empNo;
|
|
|
deptEmp.Insert();
|
|
|
|
|
|
BindEmps();
|
|
|
}
|
|
|
|
|
|
function SearchDelEmp(no, dept) {
|
|
|
if (confirm('您确定要删除该人员吗?') == false)
|
|
|
return;
|
|
|
|
|
|
var deptEmpPK = dept + "_" + no;
|
|
|
|
|
|
|
|
|
//取消人员部门管理关系
|
|
|
var en = new Entity("BP.Port.DeptEmp");
|
|
|
en.SetPKVal(deptEmpPK);
|
|
|
en.Delete();
|
|
|
var en = new Entity(empEnName, no);
|
|
|
en.Delete();
|
|
|
|
|
|
//取消人员部门岗位管理关系
|
|
|
var sql = "delete from Port_DeptEmpStation where FK_Emp='" + no + "' and FK_Dept='" + deptNo + "'";
|
|
|
DBAccess.RunSQL(sql);
|
|
|
|
|
|
SearchEmp();
|
|
|
}
|
|
|
function Del(no, dept, useSta) {
|
|
|
|
|
|
if (confirm('您确定要删除该人员吗?') == false)
|
|
|
return;
|
|
|
if ('admin' == no) {
|
|
|
alert("管理员账号不能删除");
|
|
|
return;
|
|
|
}
|
|
|
var emp = new Entity(empEnName, no);
|
|
|
if (parseInt(webUser.CCBPMRunModel) !== 0) {
|
|
|
//当前人员时主管理员不能删除
|
|
|
var org = new Entity("BP.WF.Port.AdminGroup.Org");
|
|
|
org.SetPKVal(emp.OrgNo);
|
|
|
if (org.RetrieveFromDBSources() != 0) {
|
|
|
if (org.Adminer === no) {
|
|
|
alert("管理员账号不能删除");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
var deptEmpPK = deptNo + "_" + no;
|
|
|
|
|
|
|
|
|
//取消人员部门管理关系
|
|
|
var en = new Entity("BP.Port.DeptEmp");
|
|
|
en.SetPKVal(deptEmpPK);
|
|
|
en.Delete();
|
|
|
if (useSta == 1) {
|
|
|
var en = new Entity(empEnName, no);
|
|
|
en.Delete();
|
|
|
}
|
|
|
|
|
|
if (useSta == 0) {
|
|
|
var en = new Entity("BP.WF.Port.WFEmp", no);
|
|
|
en.Delete();
|
|
|
}
|
|
|
|
|
|
//取消人员部门岗位管理关系
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.GPMPage");
|
|
|
handler.AddPara("FK_Emp", no);
|
|
|
handler.AddPara("FK_Dept", deptNo);
|
|
|
handler.DoMethodReturnString("DeptEmpStation_Dele");
|
|
|
|
|
|
|
|
|
BindEmps();
|
|
|
}
|
|
|
|
|
|
function Remove(no) {
|
|
|
|
|
|
if (confirm('您确定要从该部门中移除吗?') == false)
|
|
|
return;
|
|
|
|
|
|
var en = new Entity("BP.Port.DeptEmp");
|
|
|
en.SetPKVal(deptNo + "_" + no);
|
|
|
en.Delete();
|
|
|
|
|
|
BindEmps();
|
|
|
}
|
|
|
|
|
|
//按人员查询
|
|
|
function SearchEmp() {
|
|
|
var searchKey = $("#searchKey").val();
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.GPMPage");
|
|
|
handler.AddPara("searchKey", searchKey);
|
|
|
var emps = handler.DoMethodReturnJSON("GPM_Search");
|
|
|
|
|
|
var html = "";
|
|
|
html += "<div class='container'>";
|
|
|
html += "<div class='fixed-table-header'>";
|
|
|
html += "<table class='table table-hover table-striped' style='width:90%;' >";
|
|
|
html += "<thead ><tr> ";
|
|
|
html += "<th style='background-color:#F2F2F2;'>序号</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>编号</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>名称</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>主部门</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>邮件</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>电话</th>";
|
|
|
html += "<th style='background-color:#F2F2F2;'>操作</th>";
|
|
|
html += "</tr></thead>";
|
|
|
html += "<tbody>";
|
|
|
for (var i = 0; i < emps.length; i++) {
|
|
|
var emp = emps[i];
|
|
|
html += "<tr ondblclick=\"EditEmp('" + emp.No + "')\" >";
|
|
|
html += "<td class='Idx' >" + (i + 1) + "</td>";
|
|
|
html += "<td>" + emp.No + "</td>";
|
|
|
html += "<td><a href=\"javascript:EditEmp('" + emp.No + "')\">" + emp.Name + "</a></td>";
|
|
|
html += "<td>" + emp.deptName + "</td>";
|
|
|
if (emp.Email == null || emp.Email === "")
|
|
|
html += "<td>-</td>";
|
|
|
else
|
|
|
html += "<td>" + emp.Email + "</td>";
|
|
|
if (emp.Tel == null || emp.Tel === "")
|
|
|
html += "<td>-</td>";
|
|
|
else
|
|
|
html += "<td>" + emp.Tel + "</td>";
|
|
|
html += "<td><a href=\"javascript:SearchDelEmp('" + emp.No + "','" + emp.FK_Dept + "');\" class='cc-btn-tab btn-del'>删除</a></td>";
|
|
|
html += "</tr>";
|
|
|
}
|
|
|
html += "</tbody>";
|
|
|
html += "</table>";
|
|
|
html += "</div>";
|
|
|
html += "</div>";
|
|
|
$("#Emps").html(html);
|
|
|
}
|
|
|
|
|
|
function Reset() {
|
|
|
$("#searchKey").val("");
|
|
|
}
|
|
|
|
|
|
function EditStations() {
|
|
|
var url = "/WF/Comm/Search.htm?EnsName=" + ensOfStations;
|
|
|
// window.open(url);
|
|
|
OpenLayuiDialog(url, "", 90000, false, false, true, false, false);
|
|
|
}
|
|
|
function EditStationTypes() {
|
|
|
var url = "/WF/Comm/Search.htm?EnsName=" + ensOfStationTypes;
|
|
|
OpenLayuiDialog(url, "", 90000, false, false, true, false, false);
|
|
|
//window.open(url);
|
|
|
}
|
|
|
//二维码邀请加入.
|
|
|
function InvitedQRCode() {
|
|
|
var url = "InvitedQRCode.htm";
|
|
|
OpenLayuiDialog(url, "", 90000, false, false, true, false, false);
|
|
|
}
|
|
|
function ImpExcel() {
|
|
|
|
|
|
var url = "/App/Org/TemplateImp.htm";
|
|
|
//OpenWindowRight(url, '导入组织结构');
|
|
|
OpenLayuiDialog(url, "导入组织结构", 90000, false, false, true, false, false);
|
|
|
}
|
|
|
</script>
|
|
|
<style>
|
|
|
.panel-header,
|
|
|
.panel-body {
|
|
|
border-color: #f5f5ff
|
|
|
}
|
|
|
|
|
|
.blue-background-class {
|
|
|
background: #95B8E7 !important;
|
|
|
}
|
|
|
|
|
|
.blue-background-class > td {
|
|
|
color: white !important;
|
|
|
}
|
|
|
|
|
|
.blue-background-class > td > a {
|
|
|
color: white !important;
|
|
|
}
|
|
|
|
|
|
.blue-background-class > td > button {
|
|
|
border: 1px solid #fff !important;
|
|
|
color: white !important;
|
|
|
}
|
|
|
</style>
|
|
|
</head>
|
|
|
|
|
|
<body class="easyui-layout">
|
|
|
|
|
|
<div id="pageloading">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div data-options="region:'north',split:false" style="padding:6px 0 6px 6px;overflow:hidden">
|
|
|
|
|
|
|
|
|
<div style="float:left">
|
|
|
关键字:<input id="searchKey" name="searchKey" type="text" />
|
|
|
<button class="cc-btn-tab" id="SearchBtn" onclick="SearchEmp()">查询</button>
|
|
|
<button class="cc-btn-tab" id="ResetBtn" onclick="Reset()">重置</button>
|
|
|
</div>
|
|
|
|
|
|
<div style="float:right">
|
|
|
<!-- <button class="cc-btn-tab" id="SearchBtn" onclick="InvitedQRCode()">二维码邀请加入</button>-->
|
|
|
|
|
|
<button class="cc-btn-tab" id="SearchBtn" onclick="EditStations()">岗位</button>
|
|
|
<button class="cc-btn-tab" id="ResetBtn" onclick="EditStationTypes()">岗位类型</button>
|
|
|
<button class="cc-btn-tab" id="ResetBtn" onclick="ImpExcel()">导入</button>
|
|
|
<div id="iconIM"></div>
|
|
|
|
|
|
<!--<button class="cc-btn-tab" id="ResetBtn" onclick="Reset()">权限组</button>-->
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div id="TreeLayout" data-options="region:'west',split:false" style="width: 240px; padding: 1px; overflow: hidden;">
|
|
|
<div style="width: 100%; height: 95%; overflow: auto;">
|
|
|
<ul id="regionZTree" class="ztree" data-options="animate:false,dnd:false"></ul>
|
|
|
</div>
|
|
|
<div id="menu" class="small-menu" style="width: 120px;">
|
|
|
<div class="newSameLevel">
|
|
|
<i class="iconfont icon-zujian"></i>增加同级
|
|
|
</div>
|
|
|
|
|
|
<div class="newNextLevel">
|
|
|
<i class="iconfont icon-xianchengxielou"></i>增加子级
|
|
|
</div>
|
|
|
<div class="edit">
|
|
|
<i class="iconfont icon-bianji1"></i>修改名称
|
|
|
</div>
|
|
|
|
|
|
<div class="delete">
|
|
|
<i class="iconfont icon-guanbi"></i>删除
|
|
|
</div>
|
|
|
<div class="moveUpDept">
|
|
|
<i class="iconfont icon-shangyi"></i>上移
|
|
|
</div>
|
|
|
|
|
|
<div class="moveDownDept">
|
|
|
<i class="iconfont icon-xy"></i>下移
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div data-options="region:'center',split:true" style="width:90%;">
|
|
|
<div id="Emps">
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
</body>
|
|
|
|
|
|
</html>
|