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.

416 lines
17 KiB
Plaintext

11 months ago
<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>
$(function () {
var webUser = new WebUser();
var orgNo = webUse.OrgNo;
var handler = new HttpHandler("BP.Cloud.HttpHandler.App_Org");
var data = handler.DoMethodReturnString("OrganizationWX_Init");
ajaxConfig();
});
function ajaxConfig() {
var url = GetHrefUrl().split('#')[0];
url = url.replace(/&/g, '%26');
$.ajax({
type: "post",
dataType: "json",
data: {
url: url
},
url: "getconfig.html",
success: function (obj) {
//微信注入权限接口
wx.config({
beta: true,// 必须这么写否则wx.invoke调用形式的jsapi会有问题
debug: true,// 开启调试模式,调用的所有api的返回值会在客户端alert出来若要查看传入的参数可以在pc端打开参数信息会通过log打出仅在pc端时才会打印。
appId: obj.appId, // 必填企业微信的corpID
timestamp: obj.timestamp,// 必填,生成签名的时间戳
nonceStr: obj.nonceStr,// 必填,生成签名的随机串
signature: obj.signature,// 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList: [// 必填需要使用的JS接口列表凡是要调用的接口都需要传进来
'onMenuShareAppMessage', 'onMenuShareTimeline'
]
});
// config信息验证后会执行ready方法所有接口调用都必须在config接口获得结果之后config是一个客户端的异步操作所以如果需要在页面加载时就调用相关接口则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口则可以直接调用不需要放在ready函数中。
wx.ready(function () {
wx.onMenuShareAppMessage({
title: '${pro.wxtitle}', // 分享标题
desc: "${pro.wxdesc}", // 分享描述
imgUrl: 'http://www.yaoshihang.cn/${pro.imgurl}',
link: GetHrefUrl().split('#')[0],
type: 'link' // 分享类型,music、video或link不填默认为link
});
wx.onMenuShareTimeline({
title: '${pro.wxtitle}', // 分享标题
link: GetHrefUrl().split('#')[0], // 分享链接该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: 'http://www.yaoshihang.cn/${pro.imgurl}'
});
wx.checkJsApi({
jsApiList: [
'onMenuShareAppMessage', 'onMenuShareTimeline'
],
success: function (res) {
//alert(res.errMsg);
}
});
});
wx.error(function (res) {
// config信息验证失败会执行error函数如签名过期导致验证失败具体错误信息可以打开config的debug模式查看也可以在返回的res参数中查看对于SPA可以在这里更新签名。
// alert("errorMSG:"+res);
});
},
error: function () {
//alert("系统请求异常!");
}
});
}
</script>
<script type="text/javascript">
(async () => {
if (/MicroMessenger/i.test(navigator.userAgent)) {
await config(configParams)
}
await agentConfig(agentConfigParams)
// 注意: 只有 agentConfig 成功回调后WWOpenData 才会注入到 window 对象上面
WWOpenData.bindAll(document.querySelectorAll('ww-open-data'))
})()
function config(config) {
return new Promise((resolve, reject) => {
wx.config(config)
wx.ready(resolve)
wx.error(reject)
})
}
function agentConfig(config) {
return new Promise((success, fail) => {
wx.agentConfig({ ...config, success, fail })
})
}
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 () {
return;
$("#pageloading").show();
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 webUser = new WebUser();
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>";
if (org.RegFrom == 0) {
html += "<ul>";
html += "<li>本功能维护了人员信息Port_Emp, 部门信息Port_Dept, 一人多部门(我们成为兼职Port_DeptEmp), 一人多部门多岗位(Port_DeptEmpStation)</li>";
html += "<li>维护部门在节点上点击右键,可以新建,保存,修改。</li>";
html += "</ul>";
}
if (org.RegFrom == 1) {
html += "<ul>";
html += "<li>您的组织结构是从微信端集成过来的,组织结构的变更与微信相同,您可以为人员维护岗位.</li>";
html += "<li>同步组织结构数据: <a href='javascript:DoDTS();' >执行同步</a>.</li>";
html += "</ul>";
}
if (org.RegFrom == 2) {
html += "<ul>";
html += "<li>您的组织结构是从钉钉端集成过来的,组织结构的变更与钉钉相同,您可以为人员维护岗位.</li>";
html += "<li>同步组织结构数据: <a href='javascript:DoDTS();' >执行同步</a>.</li>";
html += "</ul>";
}
$("#Emps").html(html);
$("#pageloading").hide();
//鼠标移开时右键菜单消失
$(document).on('mouseleave ', '.dropdown-menu', function () {
$(".dropdown-menu").hide();
$.learunindex.destroy
});
});
//设置展开前三级
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;
}
var emps = "";
function Save() {
var handler = new HttpHandler("BP.Cloud.HttpHandler.Admin_Org");
handler.AddFormData();
var data = handler.DoMethodReturnString("Organization_SaveEmpsByWX");
alert(data);
}
//绑定人员.
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><h5>" + dept.Name + "<button id='Btn_Save' onclick='Save();' >保存姓名</button> </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 += "<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 id='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 += "</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>
</div>
</form>
</body>
</html>