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.

215 lines
6.1 KiB
Plaintext

This file contains ambiguous Unicode 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.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>本组织岗位</title>
<link href="../../../Comm/Style/CommStyle.css" rel="stylesheet" type="text/css" />
<link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<link href="../../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="../../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
<script src="../../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="../../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
<script type="text/javascript" src="../../../Scripts/config.js"></script>
<script type="text/javascript" src="../../../Comm/Gener.js"></script>
<script src="../../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
<!-- 自己的系统风格统一. -->
<link href="../../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
<link href="../../../Style/skin/css/Default.css" rel="stylesheet" />
<!-- 自己的系统风格统一end -->
<base target="_self" />
<script type="text/javascript">
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../../Img/loading.gif />&nbsp;正在加载,请稍后......");
//求出来已经设置的延续子流程.
var nodeID = GetQueryString("FK_Node");
var orgNo = GetQueryString("OrgNo");
var webUser = new WebUser();
if (orgNo == null || orgNo == undefined || orgNo == "undefined")
orgNo = webUser.FK_Dept;
//已经选择的岗位.
var ens = new Entities("BP.WF.Template.NodeStations");
ens.Retrieve("FK_Node", nodeID);
//获得该组织的岗位.
var stas = new Entities("BP.Port.Stations");
stas.Retrieve("OrgNo", orgNo);
if (stas.length == 0) {
$("#Msg").html("<span style='color:red;margin:10px'>组织编号为" + orgNo + "下面没有设置岗位</span>");
return;
}
//查询出来数据.
//var sql = "select No as \"No\", Name as \"Name\" FROM port_StationType where No in (select Fk_StationType from Port_Station where OrgNo ='" + orgNo + "') group by No,Name";
//获得要增加的流程集合.
//var stationTypes = DBAccess.RunSQLReturnTable(sql);
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_AttrNode");
handler.AddPara("orgNo", orgNo);
var stationTypes = handler.DoMethodReturnString("NodeStationGroup_Init");
stationTypes = JSON.parse(stationTypes);
BindGroupModel(stationTypes, stas, ens);
});
function BindGroupModel(groups, entities, selectedEles) {
AttrOfMInMM = "FK_Station";
var html = "<table style='width:100%;' >";
html += "<tr>";
html += "<th colspan=3>";
html += "<div style='float:left'>";
html += "<input type=button value='保存' onclick='Save();' id='save' />";
html += "</div>";
html += "</th>";
html += "</tr>";
for (var i = 0; i < groups.length; i++) {
var group = groups[i];
html += "<tr>";
html += "<th colspan=3>";
html += "<input type='checkbox' onclick='CheckAll(this.checked, \"" + group.No + "\");' id='Group_" + group.No + "' /><label for='Group_" + group.No + "'>" + group.Name + "</label>";
html += "</th>";
html += "</tr>";
var myNum = -1;
for (var idx = 0; idx < entities.length; idx++) {
en = entities[idx];
var myidx = 0;
var oOfEn;
for (var obj in en) {
if (myidx == 2) {
oOfEn = obj;
break;
}
myidx++;
}
myidx = 0;
var oOfGroup;
for (var obj in en) {
if (myidx == 0) {
oOfGroup = obj;
break;
}
myidx++;
}
if (en[oOfEn] != group[oOfGroup])
continue;
var isHave = false;
for (var iEle = 0; iEle < selectedEles.length; iEle++) {
var ele = selectedEles[iEle];
if (ele == null || ele == undefined)
continue;
if (ele[AttrOfMInMM] == en.No) {
isHave = true;
break;
}
}
var lab = en.Name;
if (isHave)
lab = "<font color=green>" + en.Name + "</font>";
myNum++;
if (myNum == 0)
html += "<TR>";
if (isHave == true)
html += "<td><input type='checkbox' checked=true name='" + group.No + "' id='CB_" + en.No + "' value='" + en.No + "' /><label for='CB_" + en.No + "'>" + lab + "</label></td>";
else
html += "<td><input type='checkbox' name='" + group.No + "' id='CB_" + en.No + "' value='" + en.No + "' /><label for='CB_" + en.No + "'>" + lab + "</label></td>";
if (myNum == 2) {
html += "</tr>";
myNum = -1;
}
}
if (idx == 1) {
html += "<td colspan=2></td>";
html += "</tr>";
}
if (idx == 2) {
html += "<td></td>";
html += "</tr>";
}
}
html += "</table>";
console.log(html);
$("#Msg").html("");
$("#Msg").html(html);
}
//选择与取消选择.
function CheckAll(checked, no) {
$("input[name='" + no + "']").each(function () {
this.checked = checked;
});
}
//保存.
function Save() {
var nodeID = GetQueryString("FK_Node");
var orgNo = GetQueryString("OrgNo");
//删除,该组织下已经保存的岗位.
//var sql = "DELETE FROM WF_NodeStation WHERE FK_Station IN (SELECT No FROM Port_Station WHERE OrgNo='" + orgNo + "') AND FK_Node=" + nodeID;
//DBAccess.RunSQL(sql);
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_AttrNode");
handler.AddPara("orgNo", orgNo);
handler.AddPara("nodeID", nodeID);
handler.DoMethodReturnString("NodeStationGroup_Dele");
//获得该组织的岗位.
var stas = new Entities("BP.Port.Stations");
stas.Retrieve("OrgNo", orgNo);
//遍历checkbox控件然后执行插入.
for (var i = 0; i < stas.length; i++) {
var en = new Entity("BP.WF.Template.NodeStation");
if (document.getElementById("CB_" + stas[i].No).checked) {
en.FK_Node = nodeID;
en.FK_Station = stas[i].No;
en.Insert();
}
}
window.close();
}
</script>
</head>
<body>
<div id="Msg"></div>
</body>
</html>