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.

119 lines
4.7 KiB
Plaintext

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>切换部门</title>
<link href="../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet">
<link href="../Style/skin/css/style.css" rel="stylesheet" type="text/css" />
<link href="../Style/skin/css/animate.css" rel="stylesheet" type="text/css" />
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="usercenter">切换部门</div>
<form class="form-horizontal" id="cc">
<div class="form-group">
<div id="Msg" style="margin:20px;"></div>
</div>
</form>
</div>
</div>
</div>
<script src="../Scripts/easyUI/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="../Scripts/QueryString.js" type="text/javascript"></script>
<!-- 引用通用的js文件. -->
<script type="text/javascript" src="../Scripts/config.js"></script>
<script type="text/javascript" src="../Comm/Gener.js"></script>
<script type="text/javascript" language="javascript" >
//页面启动函数.
$(function () {
$("#Msg").html("<img src='../Img/loading.gif' /><font color=blue>ccbpm 正在获取部门信息.</font>");
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Setting");
var data = handler.DoMethodReturnString("ChangeDept_Init");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
data = JSON.parse(data);
console.log(data);
if (data.length == 0) {
$("#Msg").html("您有0个部门不需要切换部门.");
return;
}
if (data.length == 1) {
$("#Msg").html("<br><br>您有1个部门<font color=green >(" + data[0].Name + ")</font>不需要切换部门.<br><br>");
return;
}
var html = "";
for (var i = 0; i < data.length; i++) {
var deptRoot = data[i];
if (deptRoot.No == deptRoot.OrgNo) {
html = html +"<div style='font-size: 15px;font - weight: bold; '>" + deptRoot.Name + "</div><ul style='padding-left:30px'>";
if (deptRoot.CurrentDept == 1)
html += "<li ><font color='green'><b>" + deptRoot.Name + "(当前部门)</b></font></li>";
else
html += "<li onclick=\"ChangeDept_Submit('" + deptRoot.No + "','" + deptRoot.OrgNo + "');\" style='font-color:green;' ><u>" + deptRoot.Name + "</u></li>";
for (var j = 0; j < data.length; j++) {
var dept = data[j];
if (dept.OrgNo == deptRoot.OrgNo && dept.No != deptRoot.No) {
if (dept.CurrentDept == 1)
html += "<li ><font color='green'><b>" + dept.Name + "(当前部门)</b></font></li>";
else
html += "<li onclick=\"ChangeDept_Submit('" + dept.No + "','" + dept.OrgNo + "');\" style='font-color:green;' ><u>" + dept.Name + "</u></li>";
}
}
html += "</ul>";
}
}
$("#Msg").html(html);
return;
});
function ChangeDept_Submit(deptNo,OrgNo) {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Setting");
handler.AddPara("DeptNo", deptNo);
var data = handler.DoMethodReturnString("ChangeDept_Submit");
if (data.indexOf('err@') == 0) {
$("#Msg").html("<font color=red>" + data + "</font>");
return;
}
alert(data);
//history.back();
history.go(0);
console.log(top.document.location.href);
//替换页面url
var url = top.document.location.href;
let param = url.split('?')[1];
let params = param.split('&');
let paramOrgNo;
for (let i = 0; i < params.length; i++) {
let param = params[i];
if (param.indexOf('OrgNo') > -1)
paramOrgNo = param;
}
url = url.replace(paramOrgNo, 'OrgNo=' + OrgNo);
console.log(url);
top.document.location.href = url;
}
</script>
</body>
</html>