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.

189 lines
6.7 KiB
Plaintext

<!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>
<script type="text/javascript" src="/WF/Scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/WF/Scripts/jquery/jquery.easyui.min.js"></script>
<script src="/WF/Scripts/QueryString.js" type="text/javascript"></script>
<link href="../layuiadmin/layui/css/modules/layer/default/layer.css" rel="stylesheet" />
<script src="../layuiadmin/layui/lay/modules/layer.js"></script>
<!-- 引入新版本的类库. -->
<script src="/WF/Scripts/config.js" type="text/javascript"></script>
<script src="/WF/Comm/Gener.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#Msg").html("正在加载请稍候...");
var empNo = GetQueryString("FK_Emp");
if (empNo == null)
empNo = 'liping';
var emp = new Entity("BP.Cloud.Emp", empNo);
empNo = emp.UserID;
// alert(empNo);
var ens = new Entities("BP.Cloud.DeptEmps");
ens.Retrieve("FK_Emp", empNo, "OrgNo", emp.OrgNo);
if (ens.length == 0) {
var deptEmp = new Entity("BP.Cloud.DeptEmp");
deptEmp.FK_Dept = emp.FK_Dept;
deptEmp.FK_Emp = emp.UserID;
deptEmp.OrgNo = emp.OrgNo;
deptEmp.MyPK = emp.FK_Dept + "_" + emp.No;
deptEmp.EmpNo = emp.No;
deptEmp.Insert();
ens.Retrieve("FK_Emp", empNo, "OrgNo", emp.OrgNo);
}
var html = "<table border=0 style='width:100%;'>";
html += "<caption >姓名:" + emp.Name + ", 主要部门:" + emp.FK_DeptText + " </caption>";
html += "<tr>";
html += "<th>编号</th>";
html += "<th>部门名称</th>";
html += "<th></th>";
html += "<th>多个岗位</th>";
html += "<th>操作</th>";
html += "</tr>";
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
html += "<tr>";
if (en.FK_Dept.length > 23)
html += "<td class='showTD' data-info='" + en.FK_Dept + "' style='white-space:nowrap;word-break:keep-all;text-overflow: ellipsis;'>" + en.FK_Dept.substring(0, 23) + "..." + "</td>";
else
html += "<td>" + en.FK_Dept + "</td>";
//求部门名称.
var dept = new Entity("BP.Cloud.Dept", en.FK_Dept);
if (emp.FK_Dept == dept.No) {
html += "<td><font color=green><b>" + dept.Name + "</b></font></td>";
html += "<td> 主部门 </td>";
}
else {
html += "<td>" + dept.Name + "</td>";
html += "<td><a href=\"javascript:SetMainDept('" + dept.No + "','" + en.EmpNo + "')\">设置主部门</a></td>";
}
//求岗位集合.
var dess = new Entities("BP.Cloud.DeptEmpStations");
dess.Retrieve("FK_Emp", empNo, "FK_Dept", dept.No);
// alert(empNo + " " + dept.No);
if (dess.length == 0) {
html += "<td>无岗位-<a href=\"javascript:AddStation('" + dept.No + "','" + empNo + "')\">增加</a></td>";
} else {
var staNames = "";
for (var idx = 0; idx < dess.length; idx++) {
var des = dess[idx];
var station = new Entity("BP.Cloud.Station", des.FK_Station);
staNames += station.Name + ",";
}
html += "<td><a href=\"javascript:AddStation('" + dept.No + "','" + empNo + "')\">" + staNames + "</a></td>";
}
//html += "<td> <a href='javascript:EditMainDept()'>修改主部门</a> </td>";
if (emp.FK_Dept == dept.No)
html += "<td> - </td>";
else
html += "<td><a href=\"javascript:Del('" + en.MyPK + "')\" ><img src='/WF/Img/Btn/Delete.png' ></a></td>";
html += "</tr>";
}
html += "</table>";
$("#Msg").html(html);
$(".showTD").on("mouseover", function () {
var innerHtml = this.innerHTML;
if (innerHtml.endsWith("...") == false)
return;
var that = this;
var text = $(this).attr("data-info");
layer.tips(text, that, {
maxWidth: text.length * 10,
tips: 1,
time: 0
});
});
$(".showTD").on("mouseout", function () {
layer.closeAll();
});
});
//修改主部门.
function EditMainDept() {
var empNo = GetQueryString("FK_Emp");
var emp = new Entity("BP.Cloud.Emp", empNo);
SetHref( "EmpDeptMainDept.htm?FK_Emp=" + empNo + "&FK_DEPT=" + emp.FK_Dept);
}
//设置主部门
function SetMainDept(deptNo, empNo) {
var emp = new Entity("BP.Cloud.Emp", empNo);
emp.FK_Dept = deptNo;
emp.Update();
Reload();
}
//设置岗位.
function AddStation(deptNo, empNo) {
var empNo = GetQueryString("FK_Emp");
var url = "EmpDeptsDtl.htm?FK_Emp=" + empNo + "&FK_Dept=" + deptNo;
SetHref(url);
}
function AddDept() {
var empNo = GetQueryString("FK_Emp");
var url = "/WF/Comm/RefFunc/Branches.htm?EnName=BP.Cloud.GPMEmp&Dot2DotEnsName=BP.Cloud.DeptEmps&Dot2DotEnName=BP.Cloud.DeptEmp&AttrOfOneInMM=FK_Emp&AttrOfMInMM=FK_Dept&EnsOfM=BP.Cloud.Depts&DefaultGroupAttrKey=&No=" + empNo + "&PKVal=" + empNo;
if (plant != "CCFlow")
url = basePath + "/WF/Comm/RefFunc/Branches.htm?EnName=BP.Cloud.GPMEmp&Dot2DotEnsName=BP.Cloud.DeptEmps&Dot2DotEnName=BP.Cloud.DeptEmp&AttrOfOneInMM=FK_Emp&AttrOfMInMM=FK_Dept&EnsOfM=BP.Cloud.Depts&DefaultGroupAttrKey=&No=" + empNo + "&PKVal=" + empNo;
SetHref(url);
}
function Del(mypk) {
if (window.confirm('您确定要删除吗?') == false)
return;
var dept = new Entity("BP.Cloud.DeptEmp", mypk);
dept.Delete();
Reload();
}
</script>
<link href="/DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="Msg"></div>
</body>
</html>