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.

369 lines
15 KiB
Plaintext

11 months ago
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>权限控制</title>
<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" />
<link href="../../CCForm/JS/mselector.css" rel="stylesheet" type="text/css" />
<link href="../../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
<script src="../../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet"
type="text/css" />
<script type="text/javascript" src="../../Comm/JScript.js"></script>
<script type="text/javascript"
src="../../Scripts/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../Scripts/QueryString.js"></script>
<script type="text/javascript" src="../../Scripts/config.js"></script>
<script type="text/javascript" src="../../Comm/Gener.js"></script>
<script type="text/javascript" src="../../Scripts/QueryString.js"></script>
<link href="../../Scripts/bootstrap/css/font-awesome.css" rel="Stylesheet" />
<script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.cokie.min.js"></script>
<script src="../../Scripts/bootstrap/BootstrapUIDialog.js" type="text/javascript"></script>
<script src="../../CCForm/JS/mtags.js" type="text/javascript"></script>
<link href="../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
<link href="../../Style/skin/css/Default.css" rel="stylesheet" />
<style type="text/css">
.ccflow-input-span-container {
box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.075);
border: 0px;
}
.ccflow-input-span-container {
line-height: 28px;
}
th {
border-width: 1px;
border-color: #C2D5E3;
border-style: solid;
line-height: 25px;
color: #0a0a0a;
white-space: nowrap;
padding: 5px 2px;
font-size: 14px;
text-align: left;
font-size: 12px;
font-weight: bolder;
}
caption {
text-align: left;
font-family: 'Microsoft YaHei';
font-weight: bolder;
border-bottom: none;
margin-bottom: 10px;
}
</style>
<base target="_self" />
<script type="text/javascript">
var currSelectNode = "";
var models = [];
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");
//定义权限控制类型
//var itemFlowDataView = { 'PowerFlag': 'FlowDataView', 'PowerFlagName': '查看', 'PortSta': '', 'PortEmp': '' };
var itemFlowDataPress = { 'PowerFlag': 'FlowDataPress', 'PowerFlagName': '催办', 'PortSta': '', 'PortEmp': '' };
var itemFlowDataShift = { 'PowerFlag': 'FlowDataShift', 'PowerFlagName': '移交(特送人员)', 'PortSta': '', 'PortEmp': '' };
var itemFlowDataUnSend = { 'PowerFlag': 'FlowDataUnSend', 'PowerFlagName': '撤销', 'PortSta': '', 'PortEmp': '' };
var itemFlowDataAddEmps = { 'PowerFlag': 'FlowDataAddEmps', 'PowerFlagName': '增加处理人(委托)', 'PortSta': '', 'PortEmp': '' };
var itemFlowDataRollback = { 'PowerFlag': 'FlowDataRollback', 'PowerFlagName': '回滚', 'PortSta': '', 'PortEmp': '' };
var itemFlowDataOver = { 'PowerFlag': 'FlowDataOver', 'PowerFlagName': '结束', 'PortSta': '', 'PortEmp': '' };
var itemFlowDataSkip = { 'PowerFlag': 'FlowDataSkip', 'PowerFlagName': '跳转', 'PortSta': '', 'PortEmp': '' };
var itemFlowDataDelete = { 'PowerFlag': 'FlowDataDelete', 'PowerFlagName': '删除', 'PortSta': '', 'PortEmp': '' };
//models.push(itemFlowDataView);
models.push(itemFlowDataPress);
models.push(itemFlowDataShift);
models.push(itemFlowDataUnSend);
models.push(itemFlowDataAddEmps);
models.push(itemFlowDataRollback);
models.push(itemFlowDataOver);
models.push(itemFlowDataSkip);
models.push(itemFlowDataDelete);
//初始化页面
InitPage();
$("#Msg").html("");
});
var currPowerFlag = "";
//初始化数据.
function InitPage() {
var flowNo = GetQueryString("FK_Flow");
//获取流程中设置的权限列表
var powerModels = new Entities("BP.WF.Template.PowerModels");
powerModels.Retrieve("Model", "FlowData", "FlowNo", flowNo);
//李震bs
var html = "";
html += "<table class='table table-hover' style='width:100%;'>";
html += "<tr>";
html += "<th>#</th>";
html += "<th>编号/权限</th>";
html += "<th>岗位(双击设置)</th>";
html += "<th>人员(双击设置)</th>";
html += "</tr>";
for (var i = 0; i < models.length; i++) {
var model = models[i];
html += "<tr style='vertical-align:middle;'>";
html += "<td>" + (i + 1) + "</td>";
html += "<td>" + model.PowerFlag + " " + model.PowerFlagName + "</td>";
//岗位
html += "<td width='40%'><div id='portSta_" + model.PowerFlag + "_mtags' data-power=" + model.PowerFlag + " style='width:100%' class='mtags'></div></td>";
//人员
html += "<td width='40%'><div id='portEmp_" + model.PowerFlag + "_mtags' data-power=" + model.PowerFlag + " style='width:100%' class='mtags'></div></td>";
html += "</tr>";
}
html += "</table>";
$("#docs").html(html);
//设置选择人员的路径
var dept = getQueryStringByNameFromUrl("?" + $.cookie('CCS'), "FK_Dept");
if (dept == null || dept == '' || dept == undefined) {
dept = $.cookie('FK_Dept');
}
if (dept == null || dept == '' || dept == undefined) {
var u = new WebUser();
dept = u.FK_Dept;
}
if (dept == undefined) {
dept = "0";
}
var empUrl = "../../WorkOpt/SelectEmps.htm?FK_Dept=" + dept + "&s=" + Math.random();
var staUrl = "../../WorkOpt/SelectStationGroup.htm?s=" + Math.random();
//设置选择岗位的路径
for (var i = 0; i < models.length; i++) {
var mtags = $("#portSta_" + models[i].PowerFlag + "_mtags");
//初始化mtags 岗位
mtags.mtags({
"fit": true,
"onUnselect": function (record) {
RemoveSta(record.MyPK, record.PowerFlag);
}
});
//初始化数据
var initJsonData = GetPowerModel(models[i].PowerFlag, 1, 0, powerModels);
if (initJsonData.length != 0)
mtags.mtags("loadData", initJsonData);
//人员
mtags = $("#portEmp_" + models[i].PowerFlag + "_mtags");
//初始化mtags 岗位
mtags.mtags({
"fit": true,
"onUnselect": function (record) {
RemoveEmp(record.MyPK, record.PowerFlag);
}
});
//初始化数据
initJsonData = GetPowerModel(models[i].PowerFlag, 0, 1, powerModels);
if (initJsonData.length != 0)
mtags.mtags("loadData", initJsonData);
}
//绑定获取用户事件
$.each($(".mtags"), function (i, mtags) {
var id = $(mtags).attr("id");
//岗位选择事件
if (id.indexOf("portSta") != -1) {
$(mtags).bind("dblclick", function () {
$("#title").html("选择岗位");
currPowerFlag = $(mtags).attr("data-power");
$('#iframeSelectEmpsForm').attr('src', staUrl);
$('#SelectEmpsModal').modal().show();
});
}
//人员选择事件
if (id.indexOf("portEmp") != -1) {
$(mtags).bind("dblclick", function () {
$("#title").html("选择人员");
currPowerFlag = $(mtags).attr("data-power");
$('#iframeSelectEmpsForm').attr('src', empUrl);
$('#SelectEmpsModal').modal().show();
});
}
});
}
//获取对应类型的数据
function GetPowerModel(powerFlag, portSta, portEmp, powerModels) {
var initJson = [];
for (var i = 0; i < powerModels.length; i++) {
var powerModel = powerModels[i];
//权限类型一致
if (powerModel.PowerFlag == powerFlag) {
if (portSta == 1 && powerModel.StaNo != null && powerModel.StaNo != "") {
initJson.push({
"No": powerModel.StaNo,
"Name": powerModel.StaName,
"MyPK": powerModel.MyPK,
"PowerFlag": powerModel.PowerFlag
});
}
if (portEmp == 1 && powerModel.EmpNo != null && powerModel.EmpNo != "") {
initJson.push({
"No": powerModel.EmpNo,
"Name": powerModel.EmpName,
"MyPK": powerModel.MyPK,
"PowerFlag": powerModel.PowerFlag
});
}
}
}
return initJson;
}
//获取当前结点model根据powerFlag
function getModelByPowerFlag(powerFlag) {
for (var i = 0; i < models.length; i++) {
var model = models[i];
if (model.PowerFlag == powerFlag) {
return model;
}
}
return null;
}
//初始化接收人员列表
function InitMtags(mtags, powerFlag, portSta, portEmp) {
var powerModels = new Entities("BP.WF.Template.PowerModels");
powerModels.Retrieve("Model", "FlowData", "FlowNo", GetQueryString("FK_Flow"));
var initJsonData = GetPowerModel(powerFlag, portSta, portEmp, powerModels)
mtags.mtags("loadData", initJsonData);
}
//设置选中的人员
function selectEmpsWindowClose(data) {
$('#SelectEmpsModal').modal('hide');
if (data == '取消') {
return;
}
var returnVal = frames["iframeSelectEmpsForm"].window.returnVal;
var powerFlag = currPowerFlag;
var flowNo = GetQueryString("FK_Flow");
var myPK = currPowerFlag + "_" + returnVal.No + "_" + flowNo;
var en = new Entity("BP.WF.Template.PowerModel");
en.MyPK = myPK; //设置主键.
en.Model = "FlowData";
en.PowerFlag = powerFlag;
var model = getModelByPowerFlag(powerFlag);
if (model != null) {
en.PowerFlagName = model.PowerFlagName;
}
en.FlowNo = flowNo;
en.EmpNo = returnVal.No;
en.EmpName = returnVal.Name;
en.NodeId = 0;
en.PowerCtrlType = 1;
en.Save();
InitMtags($("#portEmp_" + powerFlag + "_mtags"), powerFlag, 0, 1);
}
//删除人员
function RemoveEmp(mypk, powerFlag) {
var en = new Entity("BP.WF.Template.PowerModel", mypk);
en.Delete();
InitMtags($("#portEmp_" + powerFlag + "_mtags"), powerFlag, 0, 1);
}
//设置选中的岗位
function selectStasWindowClose(data) {
$('#SelectEmpsModal').modal('hide');
if (data == '取消') {
return;
}
var returnVals = frames["iframeSelectEmpsForm"].window.returnVal;
var powerFlag = currPowerFlag;
var flowNo = GetQueryString("FK_Flow");
for (var i = 0; i < returnVals.length; i++) {
var returnVal = returnVals[i];
var myPK = currPowerFlag + "_" + returnVal.No + "_" + flowNo;
var en = new Entity("BP.WF.Template.PowerModel");
en.MyPK = myPK; //设置主键.
en.Model = "FlowData";
en.PowerFlag = powerFlag;
var model = getModelByPowerFlag(powerFlag);
if (model != null) {
en.PowerFlagName = model.PowerFlagName;
}
en.FlowNo = flowNo;
en.StaNo = returnVal.No;
en.StaName = returnVal.Name;
en.NodeId = 0;
en.PowerCtrlType = 0;
en.Save();
}
InitMtags($("#portSta_" + powerFlag + "_mtags"), powerFlag, 1, 0);
}
//删除岗位
function RemoveSta(mypk, powerFlag) {
var en = new Entity("BP.WF.Template.PowerModel", mypk);
en.Delete();
InitMtags($("#portSta_" + powerFlag + "_mtags"), powerFlag, 1, 0);
}
</script>
</head>
<body>
<div class="container-full">
<div id="titleH4" class="attrnode-bar-header">
<strong>权限控制 </strong>
</div>
<div id="docs"></div>
<div id="Msg"></div>
<div class="modal fade" id="SelectEmpsModal">
<div class="modal-dialog">
<div class="modal-content" style="border-radius: 0px; width: 700px;">
<div class="modal-header">
<button type="button" class="close" style="color: #000; opacity: 1;" data-dismiss="modal"
aria-hidden="true">
&times;
</button>
<h4 class="modal-title" id="title">
接受人
</h4>
</div>
<div class="modal-body">
<iframe style="width: 100%; border: 0px; height: 400px;" id="iframeSelectEmpsForm"
name="iframeSelectEmpsForm"></iframe>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
</body>
</html>