<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
<%
|
String path = request.getContextPath();
|
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
|
+ path + "/";
|
%>
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<base href="<%=basePath%>">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<title>设置默认处理人</title>
|
<!--[if !IE]><!-->
|
<link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
|
<!--<![endif]-->
|
<!--[if gt IE 8]>
|
<link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
|
<![endif]-->
|
<link rel="stylesheet" href="static/plugins/jquery-steps/css/main.css" type="text/css">
|
<link rel="stylesheet" href="static/plugins/jquery-steps/css/jquery.steps.css" type="text/css">
|
<link href="static/plugins/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css">
|
<link rel="stylesheet" href="static/styles/initialize.css" type="text/css">
|
<link rel="stylesheet" href="static/styles/common.css" type="text/css">
|
|
<script type="text/javascript" src="static/plugins/jquery/jquery.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/jquery.easyui.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
|
<script type="text/javascript" src="static/scripts/easyuiExtend.js"></script>
|
<script type="text/javascript" src="static/scripts/jquery-extend.js"></script>
|
<script type="text/javascript" src="static/plugins/layer/layer.js"></script>
|
<script type="text/javascript" src="static/plugins/slimScroll/jquery.slimscroll.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui-edatagrid/jquery.edatagrid.js"></script>
|
<!-- 弹窗加载组件 -->
|
<script type="text/javascript" src="static/plugins/layer/layer.js"></script>
|
<script type="text/javascript" src="static/plugins/spinjs/spin.js"></script>
|
<script type="text/javascript" src="static/plugins/spinjs/jquery.spin.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery.blockUI.js"></script>
|
<script type="text/javascript" src="static/plugins/ace/src-noconflict/ace.js"></script>
|
<!-- wcp组件 -->
|
<script type="text/javascript" src="static/wcp/scripts/wcp.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.layer.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.blockUI.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.spin.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.jquery.js"></script>
|
|
<!--[if lt IE 9]>
|
<script type="text/javascript" src="static/plugins/json2.js"></script>
|
<![endif]-->
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.infoPicker.js"></script>
|
|
|
<style>
|
.combobox-group {
|
clear: both;
|
}
|
|
.radios label {
|
line-height: 26px !important;
|
}
|
|
.content {
|
height: 430px !important;
|
}
|
</style>
|
</head>
|
<body>
|
<div class="margin-lr">
|
<div>
|
<div id="right">
|
<div style="height:100%">
|
<table id="tb_flowCustom" singleselect="true" idfield="flowCustomId"
|
style="width: auto; height: 450px" toolbar="#toolbar">
|
</table>
|
<div id="toolbar">
|
<%-- <font color="red"><b>注意:</b>无需审批的步骤,请选择跳过,且确保需审批的步骤设置默认处理人!</font>--%>
|
<div style="margin-left:2px;">
|
<button onclick="addStep()" class="pt-btn pt-btn-primary">
|
<i class="fa fa-plus"></i>
|
增加步骤
|
</button>
|
<%-- <a onclick="$('#tb_flowCustom').edatagrid('cancelRow');" class="pt-btn pt-btn-warning">
|
<i class="fa fa-scissors"></i> 取消修改--%>
|
</a>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="pt-form-btn" style="bottom:0px;">
|
<div class="form-group">
|
<button type="button" class="pt-btn pt-btn-info" onclick="doSave();">确定</button>
|
<button type="reset" class="pt-btn pt-btn-default"
|
onclick="doClose();">关闭
|
</button>
|
</div>
|
</div>
|
</div>
|
</div>
|
</body>
|
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
|
<script>
|
//定义页面全局变量
|
var t_flowCustomData = null;
|
//窗口参数,用于弹窗传递
|
var params = {
|
securityCode: null,
|
variables: null,
|
callBack: null
|
};
|
var removeRows = [];
|
var columns = [];
|
$(function () {
|
setTimeout(function () {
|
t_flowCustomData = $('#tb_flowCustom').edatagrid({
|
rownumbers: true,
|
pagination: false,
|
fitColumns: true,
|
remoteSort: false,
|
method: "POST",
|
url: "flowCustom/getFlowCustomList?flowDefinitionId=${flowDefinitionId}&taskId=${taskId}&keyId=${keyId}",
|
queryParams: params.variables,
|
saveUrl: "",
|
updateUrl: "",
|
destroyUrl: "",
|
columns: [[
|
{
|
field: 'userTaskName',
|
title: '步骤名称',
|
width: 100,
|
align: 'center'
|
},
|
{
|
field: 'defaultUserNames',
|
title: '默认处理人',
|
width: 180,
|
editor: "setDefaultUser",
|
align: 'center'
|
},
|
{
|
field: 'allowSkip',
|
title: '删除',
|
width: 100,
|
align: 'center',
|
formatter: function (value, row, index) {
|
var ret = "";
|
if (value == true) {
|
ret = '<a style="cursor:pointer" onclick=\'deleteStep(' + index + ');\' class="pt-color-danger"> <i class="fa fa-trash-o"></i>删除</a>';
|
}
|
return ret;
|
}
|
}
|
]],
|
onClickRow: onClickRow,
|
onDblClickCell: function (index, field, value) {
|
//双击第一行避免编辑
|
$('#tb_flowCustom').datagrid('endEdit', index);
|
},
|
onBeforeSave: function (rowIndex) {
|
|
},
|
onSave: function (index, row) {
|
|
},
|
onDestroy: function (index, row) {
|
},
|
onEdit: function (index, row) {
|
}
|
});
|
}, 100)
|
});
|
|
//添加节点后刷新
|
function reloadData() {
|
removeRows = [];
|
$('#tb_flowCustom').datagrid('reload');
|
if (params.callBack) {
|
params.callBack();
|
}
|
}
|
|
//删除步骤
|
function deleteStep(index) {
|
var rows = $('#tb_flowCustom').datagrid('getRows');
|
removeRows.push(rows[index]);
|
rows[index].enableSkip = true;
|
endEditing();
|
$('#tb_flowCustom').datagrid('deleteRow', index);
|
rows = $('#tb_flowCustom').datagrid('getRows');
|
$("#tb_flowCustom").datagrid('loadData', rows);
|
}
|
|
//增加步骤
|
function addStep() {
|
var userTaskIds = "";
|
for (i = 0; i < removeRows.length; i++) {
|
userTaskIds += removeRows[i].userTaskId + ",";
|
}
|
userTaskIds = userTaskIds.substr(0, userTaskIds.length - 1);
|
var url = "flowCustom/selectFlowStep?flowDefinitionId=${flowDefinitionId}&keyId=${keyId}&userTaskIds=" + userTaskIds;
|
top.layer.open({
|
title: "增加步骤",
|
type: 2,
|
area: ['300px', '450px'],
|
fixed: false, //不固定
|
content: url,
|
success: function (layero, index) {
|
var body = window.top.layer.getChildFrame('body', index);
|
var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
|
//将参数和回调函数传给子页面
|
iframeWin.params.callBack = reloadData;
|
}
|
});
|
}
|
|
$.extend($.fn.datagrid.defaults.editors, {
|
setDefaultUser: {
|
init: function (container, options) {
|
var selectedRowIndex = $(container).closest(".datagrid-row").attr("datagrid-row-index");
|
var rows = $('#tb_flowCustom').datagrid('getRows');
|
var roleIdsRange = rows[selectedRowIndex].roleIdsRange;
|
var multiSelect = rows[selectedRowIndex].multiSelect;
|
var input = $("<div><input readonly=\"readonly\" id=\"txt_defaultUserNames_" + selectedRowIndex + "\" class=\"datagrid-editable-input\" style=\"width:200px; height:28px;\"></input><input type=\"hidden\" id=\"txt_defaultUserIds_" + selectedRowIndex + "\" />" +
|
" <a style=\"width: 40px;cursor:pointer\" class=\"pt-color-primary\" onclick=\"selectDefaultUsers('txt_defaultUserNames_" + selectedRowIndex + "','txt_defaultUserIds_" + selectedRowIndex + "','" + roleIdsRange + "'," + multiSelect + ")\"><i class=\"fa fa-user\" title=\"用户设置\"></i>选择</a> </div>").appendTo(container);
|
mergeCellsByField("tb_flowCustom", "MainBody");
|
return input;
|
},
|
getValue: function (target) {
|
return $($(target).children()[0]).val();
|
},
|
setValue: function (target, value) {
|
$($(target).children()[0]).val(value);
|
var a = $('#tb_flowCustom').datagrid('getSelected');
|
if (a.defaultUserIds) {
|
$($(target).children()[1]).val(a.defaultUserIds.replace("</p>", ""));
|
}
|
},
|
resize: function (target, width) {
|
$(target)._outerWidth(width);
|
}
|
}
|
});
|
var editIndex = undefined;
|
|
function onClickRow(index) {
|
//alert(index);
|
var row = $('#tb_flowCustom').datagrid('getSelected');
|
if (editIndex != index) {
|
if (endEditing()) {
|
if (index > 0) {
|
$('#tb_flowCustom').datagrid('selectRow', index)
|
.datagrid('beginEdit', index);
|
editIndex = index;
|
}
|
} else {
|
|
$('#tb_flowCustom').datagrid('selectRow', editIndex);
|
}
|
}
|
}
|
|
function endEditing() {
|
if (editIndex == undefined) {
|
return true
|
}
|
if ($('#tb_flowCustom').datagrid('validateRow', editIndex)) {
|
var userids = $("#txt_defaultUserIds_" + editIndex).val();
|
$('#tb_flowCustom').datagrid('getRows')[editIndex]['defaultUserIds'] = userids;
|
$('#tb_flowCustom').datagrid('endEdit', editIndex);
|
editIndex = undefined;
|
return true;
|
} else {
|
return false;
|
}
|
}
|
|
/**
|
* EasyUI DataGrid根据字段动态合并单元格
|
* 参数 tableID 要合并table的id
|
* 参数 colList 要合并的列,用逗号分隔(例如:"name,department,office");
|
*/
|
function mergeCellsByField(tableID, colList) {
|
var ColArray = colList.split(",");
|
var tTable = $("#" + tableID);
|
var TableRowCnts = tTable.datagrid("getRows").length;
|
var tmpA;
|
var tmpB;
|
var PerTxt = "";
|
var CurTxt = "";
|
var alertStr = "";
|
for (j = ColArray.length - 1; j >= 0; j--) {
|
PerTxt = "";
|
tmpA = 1;
|
tmpB = 0;
|
|
for (i = 0; i <= TableRowCnts; i++) {
|
if (i == TableRowCnts) {
|
CurTxt = "";
|
} else {
|
CurTxt = tTable.datagrid("getRows")[i][ColArray[j]];
|
}
|
if (PerTxt == CurTxt) {
|
tmpA += 1;
|
} else {
|
tmpB += tmpA;
|
|
tTable.datagrid("mergeCells", {
|
index: i - tmpA,
|
field: ColArray[j], //合并字段
|
rowspan: tmpA,
|
colspan: null
|
});
|
tTable.datagrid("mergeCells", { //根据ColArray[j]进行合并
|
index: i - tmpA,
|
field: "Ideparture",
|
rowspan: tmpA,
|
colspan: null
|
});
|
|
tmpA = 1;
|
}
|
PerTxt = CurTxt;
|
}
|
}
|
}
|
|
|
//选择默认处理人
|
function selectDefaultUsers(nameElement, idElement, roleIdsRange, multiSelect) {
|
var hasSelectNames = $("#" + nameElement).val();
|
var hasSelectIds = $("#" + idElement).val();
|
if (roleIdsRange == null || roleIdsRange == "null") {
|
roleIdsRange = "";
|
}
|
wcp.picker.selectUser({
|
title: "请选择默认处理人",
|
selectRole: true,
|
pickRangeType: 3,
|
pickRangeId: roleIdsRange,
|
classificationCode: params.securityCode,
|
multiSelect: multiSelect,
|
idElement: idElement,
|
nameElement: nameElement,
|
hasSelectIds: hasSelectIds,
|
hasSelectNames: hasSelectNames,
|
layerOpener: window
|
}, function () {
|
endEditing();
|
});
|
}
|
|
//确定按钮事件
|
function doSave() {
|
$('#tb_flowCustom').edatagrid('saveRow');
|
endEditing();
|
var flowCustoms = [];
|
var flowCustomsExist = $('#tb_flowCustom').datagrid("getRows");
|
for (a = 0; a < flowCustomsExist.length; a++) {
|
flowCustoms.push(flowCustomsExist[a]);
|
}
|
for (j = 0; j < removeRows.length; j++) {
|
flowCustoms.push(removeRows[j]);
|
}
|
for (i = 0; i < flowCustoms.length; i++) {
|
if (flowCustoms[i].hasOwnProperty('isNewRecord')) {
|
delete flowCustoms[i].isNewRecord;
|
}
|
}
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "flowCustom/saveFlowCustom",
|
data: JSON.stringify(flowCustoms),
|
}).done(function (result) {
|
if (params.callBack) {
|
params.callBack();
|
}
|
var index = top.layer.getFrameIndex(window.name); //获取窗口索引
|
top.layer.close(index);
|
top.wcp.notify.success("保存成功!");
|
}));
|
}
|
|
function doClose() { //关闭按钮事件
|
var index = top.layer.getFrameIndex(window.name); //获取窗口索引
|
top.layer.close(index);
|
}
|
</script>
|
</html>
|