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.

382 lines
15 KiB
Plaintext

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<html>
<head>
<title>组织结构管理</title>
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="../../GPM/themes/default/easyui.css" />
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript" src="//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<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>
<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>
<style type="text/css">
.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: 20px;
margin: 0px;
border-bottom: solid 1px #CCC;
cursor: pointer;
line-height: 38px
}
.small-menu div img {
padding-right: 10px;
margin: 0px;
}
.small-menu div:hover {
background-color: #EAF2FF;
}
.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);
}
</style>
<script type="text/javascript">
var webUser = new WebUser();
var deptNo = "";
var setting = {
view: {
dblClickExpand: false, //双击节点时,是否自动展开父节点的标识
showLine: true, //是否显示节点之间的连线
fontCss: {}, //字体样式函数
selectedMulti: false //设置是否允许同时选中多个节点
},
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"
},
data: {
simpleData: {
enable: true,
idKey: "id",
pIdKey: "pid",
rootPId: ""
}
},
callback: {
onClick: function (event, treeId, treeNode) {
deptNo = treeNode.id;
BindEmps();
},
//onRightClick: OnRightClick
} //这里是节点点击事件
};
//初始化
$(function () {
$("#pageloading").show();
/**
* 1. 判断是否授予了读取通讯录的权限, 如果没有授予就转入Guide页面.
* */
if (1 == 2)
{
//没有授予通讯录的权限.
var url = "OrganizationWeiXinGuide.htm";
SetHref(url);
return;
}
var handler = new HttpHandler("BP.Cloud.HttpHandler.Admin_Org");
var ens = handler.DoMethodReturnJSON("Organization_Init");
var jsonTree = createJsonToTree(ens);
zTreeObj = $.fn.zTree.init($("#regionZTree"), setting, jsonTree);
fillter(zTreeObj); //设置展开前三级.
var org = new Entity("BP.Cloud.Org", webUser.OrgNo);
//绑定帮助信息.
var html = "<br><br><h3 style='padding-left:5px'>组织结构管理:<font color=green>" + org.Name + "</font></h3>";
html += "<ul>";
html += " <li>您的组织结构是从微信端集成过来的,组织结构的变更与微信相同,您可以为人员维护岗位.</li>";
html += " <li>同步组织结构数据: <a href='javascript:DoDTS();' ><h2>执行同步</h2></a>.</li>";
html += "</ul>";
$("#Emps").html(html);
$("#pageloading").hide();
deptNo = GetQueryString("DeptNo");
if (deptNo != null) {
BindEmps();
}
//鼠标移开时右键菜单消失
$(document).on('mouseleave ', '.dropdown-menu', function () {
$(".dropdown-menu").hide();
$.learunindex.destroy
});
LoadAddEmpImg(webUser.OrgNo)
});
//设置展开前三级
function fillter(zTreeObj) {
//获得树形图对象
var nodeList = zTreeObj.getNodes();       //展开第一个根节点
for (var i = 0; i < nodeList.length; i++) { //设置节点展开第二级节点
zTreeObj.expandNode(nodeList[i], true, false, true);
}
}
//转换ztree需要的数据格式
var treeJson = [];
function createJsonToTree(jsonArray) {
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
});
}
return treeJson;
}
function DTSDeptData() {
alert('没有完成.');
return;
}
var emps = "";
function Save() {
var handler = new HttpHandler("BP.Cloud.HttpHandler.Admin_Org");
handler.AddFormData();
var data = handler.DoMethodReturnString("Organization_SaveEmpsByWX");
alert(data);
}
function EditDeptName(deptNo, deptName) {
var val = promptGener('请输入名称', deptName);
if (val == deptName || val == null || val == undefined || val == '')
return;
var dept = new Entity("BP.Cloud.Dept", deptNo);
dept.Name = val;
dept.Update();
SetHref( "?DeptNo=" + deptNo);
}
//加载新增人员二维码
function LoadAddEmpImg(orgNo) {
var handler = new HttpHandler("BP.Cloud.HttpHandler.Root");
handler.AddPara("page", "pages/AddEmp/AddEmp");
handler.AddPara("OrgNo", orgNo);
handler.AddPara("imgName", orgNo);
var data = handler.DoMethodReturnString("CreateAddEmpWxCode");
if (data.indexOf("err@") >= 0) {
var imgUrl = "../../ImgCode/OrgAddEmps/" + orgNo + "-AddEmps/" + orgNo + ".jpg";
//$("#AddEmpImg").attr("width", window.screen.availWidth);
$("#AddEmpImg").attr("src", imgUrl);
}
else {
data = "data:image/png;base64," + data
//$("#AddEmpImg").attr("width", window.screen.availWidth);
$("#AddEmpImg").attr("src", data);
}
}
//指定部门新增人员二维码
function AddEmp(orgNo, deptNo) {
var dept = new Entity("BP.Cloud.Dept", deptNo);
var handler = new HttpHandler("BP.Cloud.HttpHandler.Root");
handler.AddPara("page", "pages/AddEmp/AddEmp");
handler.AddPara("OrgNo", orgNo);
handler.AddPara("DeptNo", deptNo);
handler.AddPara("imgName", deptNo);
var data = handler.DoMethodReturnString("CreateAddEmpWxCode");
if (data.indexOf("err@") >= 0) {
var imgUrl = "../../ImgCode/OrgAddEmps/" + orgNo + "-AddEmps/" + deptNo + ".jpg";
$("#AddEmpImg").attr("src", imgUrl);
$("#AddEmpImgText").html("增加" + dept.Name + "人员");
}
else {
data = "data:image/png;base64," + data
$("#AddEmpImg").attr("src", data);
$("#AddEmpImgText").html("增加" + dept.Name + "人员");
}
}
//绑定人员.
function BindEmps() {
var dept = new Entity("BP.Cloud.Dept", 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><lable>部门名称: <a href=\"javascript:EditDeptName('" + dept.No + "','" + dept.Name + "');\" >" + dept.Name + "</a> </lable>-<a href=\"javascript:AddEmp('" + webUser.OrgNo + "','" + dept.No + "');\" >邀请加入</a></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 += "<th style='background-color:#F2F2F2;'>位置</th>";
html += "</tr></thead>";
var handler = new HttpHandler("BP.Cloud.HttpHandler.Admin_Org");
handler.AddPara("FK_Dept", dept.No);
emps = handler.DoMethodReturnJSON("Organization_GenerEmpsByDeptNo");
var empNos = ",";
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><input type=text name='TB_" + emp.No + "' value='" + emp.Name + "' /></td>";
//显示微信通讯录的名字.
html += "<td><a href=\"javascript:EditEmp('" + emp.No + "')\">" + emp.Name + "</a></td>";
if (emp.IsMainDept == 1)
html += "<td>主部门</td>";
else
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>";
html += "<td></td>";
html += "<td> </td>";
html += "</tr>";
empNos += emp.No + ',';
}
html += "</tbody>";
html += "</table>";
html += "<input type=button id='Btn_Save' onclick='Save();' value='保存姓名' />";
html += "<input type=button id='Btn_Sav2e' onclick='DTSDeptData();' value='同步本部门数据' />";
html += "</div>";
html += "</div>";
$("#Emps").html(html);
}
</script>
<style type="text/css">
</style>
</head>
<body class="easyui-layout">
<form id="cc">
<div id="pageloading">
</div>
<div data-options="region:'west',split:true" 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>
<div data-options="region:'center',split:true" style="width:90%;">
<div id="Emps"></div>
<image id="AddEmpImg" src=""></image>
<h2 id="AddEmpImgText"></h2>
</div>
</form>
</body>
</html>