<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
|
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
|
<%
|
String path = request.getContextPath();
|
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
|
+ path + "/";
|
%>
|
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<base href="<%=basePath%>">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<title>流程分类管理</title>
|
|
<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/font-awesome/css/font-awesome.css" rel="stylesheet" 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">
|
<link rel="stylesheet" href="static/plugins/layer/skin/default/layer.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/scripts/ResizeScroll.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui-edatagrid/jquery.edatagrid.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui-datagrid-dnd/datagrid-dnd.js"></script>
|
<script src="static/plugins/ace/src-noconflict/ace.js" type="text/javascript"></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>
|
<!-- 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>
|
<script type="text/javascript" src="static/scripts/customResize.js"></script>
|
|
|
<!--[if lt IE 9]>
|
<script type="text/javascript" src="static/plugins/json2.js"></script>
|
<![endif]-->
|
<style>
|
html, body {
|
height: 100%;
|
width: 100%;
|
overflow: hidden;
|
}
|
</style>
|
</head>
|
<body class="pt-tree">
|
<div>
|
<div class="pt-main-top clear">
|
<div class="pt-nav">
|
<span class="pt-title-icon">
|
<i class="fa fa-list-ul"></i>
|
</span>
|
<div class="pt-title">
|
<div>
|
<h4>流程分类管理</h4>
|
</div>
|
</div>
|
</div>
|
<div class="pt-search">
|
<p class="pt-retrieval">
|
<input id="txtKeySearch" type="text" placeholder="请输入流程名进行搜索">
|
<button id="btnKeySearch">
|
<i class="fa fa-search"></i>
|
</button>
|
</p>
|
<shiro:hasPermission name="SYS_MANAGE.FLOW.CATEGORY.OPERATION.ADDFLOW">
|
<button id="btnAdd" class="pt-btn pt-btn-primary">
|
<i class="fa fa-plus"></i>
|
添加
|
</button>
|
<a href="javascript:;" class="pt-btn pt-btn-info" onclick="enableSort(this)">
|
<i class="fa fa-retweet"></i>
|
排序
|
</a>
|
</shiro:hasPermission>
|
<shiro:hasPermission name="SYS_MANAGE.FLOW.CATEGORY.OPERATION.DELETEFLOW">
|
<button id="btnDelete" class="pt-btn pt-btn-danger">
|
<i class="fa fa-trash-o"></i>
|
删除
|
</button>
|
</shiro:hasPermission>
|
</div>
|
</div>
|
<div class="pt-left-menu pt-tree" style="padding:0px 10px;">
|
<div class="pt-left-tools">
|
<shiro:hasPermission name="SYS_MANAGE.FLOW.CATEGORY.OPERATION.ADD">
|
<button class="pt-btn pt-btn-primary" id="btnAddFlowCategory">
|
<i class="fa fa-plus"></i>
|
新增
|
</button>
|
</shiro:hasPermission>
|
<shiro:hasPermission name="SYS_MANAGE.FLOW.CATEGORY.OPERATION.SAVE">
|
<button class="pt-btn pt-btn-success" id="btnUpdateFlowCategory">
|
<i class="fa fa-pencil"></i>
|
修改
|
</button>
|
</shiro:hasPermission>
|
<shiro:hasPermission name="SYS_MANAGE.FLOW.CATEGORY.OPERATION.DELETE">
|
<button class="pt-btn pt-btn-danger" id="btnDeleteFlowCategory">
|
<i class="fa fa-trash-o"></i>
|
删除
|
</button>
|
</shiro:hasPermission>
|
</div>
|
|
<!-- <div class="easyui-panel" style="overflow-x:auto;">
|
<h3 class="pt-tree-title">
|
流程分类
|
<i id="btnRefreshClassification" class="pull-right fa fa-refresh"></i>
|
</h3>
|
<ul id="ul_flowCategory"></ul>
|
</div> -->
|
<div class="easyui-panel" style="overflow-x:auto;">
|
<h3 class="pt-tree-title">
|
流程分类
|
<i id="btnRefreshClassification" class="pull-right fa fa-refresh"></i>
|
</h3>
|
<ul id="ul_flowCategory"></ul>
|
</div>
|
</div>
|
<div class="pt-right-main">
|
<div id="right">
|
<div id="div_table">
|
<table id="dg_flowCategory_flowDefinition" style="width:100%;height:100%;">
|
</table>
|
</div>
|
</div>
|
</div>
|
<!-- <div id="div_table">
|
<table id="dg_flowCategory_flowDefinition" style="width:100%;height:100%;"></table>
|
</div> -->
|
</div>
|
|
</body>
|
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
|
<script>
|
//定义页面全局变量
|
var NowSelectedflowCategoryId = null;
|
var dg_flowCategory_flowDefinition = null;
|
//窗口参数,用于弹窗传递
|
var params = {
|
callBack: null
|
};
|
$(function () {
|
|
//初始化部门树
|
$("#ul_flowCategory").tree({
|
method: "get",
|
url: "config/flowCategory/listFlowCategoryByTree",
|
animate: true,
|
onBeforeLoad: function (node, param) {
|
new ResizeScroll({
|
"id": "#ul_flowCategory",
|
fun: function () {
|
var wh = $(window).height();
|
//$("#ul_dept").height(wh-79-39);
|
return (wh - 79 - 60);
|
}
|
});
|
|
wcp.ui.setBusy("#ul_flowCategory");
|
},
|
onLoadSuccess: function (node, data) {
|
wcp.ui.clearBusy("#ul_flowCategory");
|
new ResizeScroll({
|
"id": "#ul_flowCategory",
|
"fun": function () {
|
var wh = $(window).height();
|
return (wh - 79 - 95);
|
}
|
});
|
|
//选中第一个元素
|
if (data.length > 0) {
|
NowSelectedflowCategoryId = data[0].id;
|
var node = $('#ul_flowCategory').tree('find', NowSelectedflowCategoryId);
|
if (node != null) {
|
$('#ul_flowCategory').tree('select', node.target);
|
selectNode(node);
|
}
|
}
|
},
|
onLoadError: function (args) {
|
wcp.ui.clearBusy("#ul_flowCategory");
|
},
|
onClick: function (node) {
|
selectNode(node);
|
}
|
})
|
|
//初始化表格
|
dg_flowCategory_flowDefinition = $('#dg_flowCategory_flowDefinition').datagrid({
|
url: 'config/flowCategory/getFlowCategoryRelationList',
|
idField: "id",
|
rownumbers: true,
|
fitColumns: true,
|
method: "post",
|
checkOnSelect: false,
|
selectOnCheck: false,
|
pagination: true,
|
sortName: "sort_num",
|
sortOrder: "desc",
|
columns: [[
|
{
|
field: 'ck',
|
checkbox: true
|
},
|
{
|
field: 'sortNum',
|
title: '序号',
|
width: 50,
|
align: 'center'
|
},
|
{
|
field: 'flowName',
|
title: '流程名称',
|
width: 100
|
},
|
// {
|
// field: 'flowState',
|
// title: '状态',
|
// width: 200,
|
// align: 'center',
|
// formatter: function (value) {
|
// return '<input class="btnState">';
|
// }
|
// },
|
{
|
field: 'id',
|
title: '操作',
|
width: 100,
|
align: 'center',
|
formatter: function (value, row, index) {
|
var str = "";
|
<shiro:hasPermission name="SYS_MANAGE.FLOW.CATEGORY.OPERATION.SAVELOW">
|
str = '<a onclick=\'designFlow("' + row.flowId + '");\' class="pt-color-success"><i class="fa fa-pencil" title="编辑"></i></a>';
|
</shiro:hasPermission>
|
<shiro:hasPermission name="SYS_MANAGE.FLOW.CATEGORY.OPERATION.DELETEFLOW">
|
str += '<a onclick=\'deleteFlowCategoryRelation("' + row.id + '");\' class="pt-color-danger"><i class="fa fa-trash-o" title="删除"></i></a>';
|
</shiro:hasPermission>
|
return str;
|
|
}
|
}
|
]],
|
onLoadSuccess: function (data) {
|
// $.each(data.rows, function (index, elem) {
|
// $("table .btnState").eq(index).switchbutton({
|
// onText: "启用",
|
// offText: "关闭",
|
// checked: elem.flowState == 1,
|
// onChange: function (checked) {
|
// var flowState;
|
// var flowId = elem.flowId;
|
// if (checked) {
|
// flowState = 1;
|
// } else {
|
// flowState = 0;
|
// }
|
// wcp.ui.setBusy("body", wcp.ajax({
|
// url: "config/flowDefinition/updateFlowState?flowId=" + flowId + "&flowState=" + flowState
|
// }).done(function (result) {
|
// wcp.notify.success('修改成功!');
|
// //刷新数据
|
// //refreshData();
|
// }));
|
// }
|
// });
|
//
|
// })
|
|
},
|
onDrop: function (targetRow, sourceRow, point) {
|
// var index = t_flow.datagrid("getRowIndex", sourceRow);
|
// $("table .btnState").eq(index).switchbutton({
|
// onText: "开启",
|
// offText: "关闭",
|
// checked: sourceRow.flowState == 1,
|
// onChange: function (checked) {
|
// //方法
|
// }
|
// });
|
}
|
});
|
|
//绑定按钮事件
|
//新增按钮事件
|
$("#btnAdd").click(function () {
|
addFlowCategory();
|
});
|
|
//删除按钮事件
|
$("#btnDelete").click(function () {
|
//获取dg选中的数据行
|
var checkRows = $("#dg_flowCategory_flowDefinition").datagrid("getChecked");
|
if (checkRows.length == 0) {
|
layer.alert("请选择需要删除的流程!");
|
} else {
|
var ids = new Array();
|
$.each(checkRows, function (index, value) {
|
ids.push(value.id);
|
});
|
|
deleteFlowCategoryRelations(ids);
|
}
|
});
|
|
//绑定关键字检索输入框回车事件
|
$("#btnKeySearch").click(function () {
|
SearchKey();
|
});
|
|
//关键字检索按钮事件
|
$('#txtKeySearch').bind('keypress', function (event) {
|
if (event.keyCode == "13") {
|
SearchKey();
|
}
|
});
|
|
new CustomResize({
|
"id": "div_table",
|
"fun": computeHeight
|
});
|
|
//绑定按钮事件
|
//新增按钮事件
|
$("#btnAddFlowCategory").click(function () {
|
editFlowCategory(0);
|
});
|
|
$("#btnUpdateFlowCategory").click(function () {
|
var node = $('#ul_flowCategory').tree('getSelected');
|
if (node == null) {
|
wcp.message.info("请选择需要修改的流程分类!");
|
} else {
|
editFlowCategory(node.id);
|
}
|
});
|
//删除按钮事件
|
$("#btnDeleteFlowCategory").click(function () {
|
var node = $('#ul_flowCategory').tree('getSelected');
|
if (node == null) {
|
wcp.message.info("请选择需要删除的流程分类!");
|
} else {
|
|
deleteFlowCategorys([node.id]);
|
}
|
});
|
})
|
|
function selectNode(node) {
|
NowSelectedflowCategoryId = node.id;
|
$('#dg_flowCategory_flowDefinition').datagrid('load', {
|
flowCategoryId: NowSelectedflowCategoryId
|
});
|
}
|
|
function computeHeight() {
|
var wh = $(window).height();
|
$("#div_table").height(wh - 89);
|
$("#dg_flowCategory_flowDefinition").datagrid("resize");
|
}
|
|
//关键字搜索方法
|
function SearchKey() {
|
var keyValue = $("#txtKeySearch").val();
|
$('#dg_flowCategory_flowDefinition').datagrid('load', {
|
flowCategoryId: NowSelectedflowCategoryId,
|
searchText: keyValue
|
});
|
}
|
|
//新增
|
function addFlowCategory() {
|
var node = $('#ul_flowCategory').tree('getSelected');
|
if (node == null) {
|
wcp.message.info("请选择一个流程分类!");
|
} else {
|
var url = "config/flowCategory/addFlowCategoryIndex?flowCategoryId=" + node.id;
|
var title = "流程信息";
|
top.layer.open({
|
title: title,
|
type: 2,
|
area: ["800px", "500px"],
|
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 = refreshData;
|
}
|
});
|
}
|
|
}
|
|
//设计流程
|
function designFlow(flowId) {
|
var url = "config/flowDefinition/designFlow?flowDefinitionId=" + flowId;
|
window.open(url, "flowDesign");
|
}
|
|
//刷新表格数据
|
function refreshData() {
|
$('#dg_flowCategory_flowDefinition').datagrid('reload');
|
//清除已经选择的数据
|
$('#dg_flowCategory_flowDefinition').datagrid('clearSelections');
|
$('#dg_flowCategory_flowDefinition').datagrid('clearChecked');
|
}
|
|
//删除单个流程事件
|
function deleteFlowCategoryRelation(id) {
|
//alert(id);
|
deleteFlowCategoryRelations([id]);
|
}
|
|
//删除多个流程事件
|
function deleteFlowCategoryRelations(ids) {
|
layer.confirm("确定要删除选择的流程吗?", {
|
icon: 3,
|
title: '提示'
|
}, function (index) {
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "config/flowCategory/deleteFlowCategoryRelations",
|
data: JSON.stringify(ids),
|
}).done(function (result) {
|
wcp.notify.success('删除成功!');
|
|
//刷新数据
|
refreshData();
|
}));
|
layer.close(index);
|
});
|
}
|
|
//流程分类信息编辑方法
|
function editFlowCategory(flowCategoryId) {
|
var url = "config/flowCategory/editFlowCategory?flowCategoryId=" + flowCategoryId;
|
var title = flowCategoryId == 0 ? "新增流程分类" : "编辑流程分类";
|
top.layer.open({
|
title: title,
|
type: 2,
|
area: ["550px", "400px"],
|
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 = refreshFlowCategoryTree;
|
}
|
});
|
}
|
|
//删除流程分类事件
|
function deleteFlowCategorys(flowCategoryIds) {
|
layer.confirm("确定要删除选择的流程分类吗?", {
|
icon: 3,
|
title: '提示'
|
}, function (index) {
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "config/flowCategory/deleteFlowCategory",
|
data: JSON.stringify(flowCategoryIds),
|
}).done(function (result) {
|
wcp.notify.success('删除成功!');
|
//刷新数据
|
refreshFlowCategoryTree();
|
}));
|
|
layer.close(index);
|
});
|
}
|
|
//刷新流程树
|
function refreshFlowCategoryTree() {
|
$('#ul_flowCategory').tree('reload');
|
}
|
|
//排序
|
function enableSort(obj) {
|
var oA = $(obj);
|
var tip = $.trim(oA.text());
|
if (tip == "排序") {
|
oA.html('<i class="fa fa-retweet"></i>保存排序');
|
dg_flowCategory_flowDefinition.datagrid("enableDnd");
|
} else {
|
oA.html('<i class="fa fa-retweet"></i>排序');
|
if (tip == "保存排序") {
|
saveSortNum();
|
}
|
}
|
}
|
|
//保存列排序号
|
function saveSortNum(dataGridId, postUrl) {
|
var data = $('#dg_flowCategory_flowDefinition').datagrid('getRows');
|
var Ids_SortNums = new Array();
|
$.each(data, function (i, row) {
|
Ids_SortNums.push(row.id + "_" + (i + 1));
|
});
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: 'config/flowCategory/saveFlowCategorySortNum',
|
data: JSON.stringify(Ids_SortNums),
|
}).done(function (result) {
|
refreshData();
|
top.wcp.notify.success("保存排序成功!");
|
}));
|
}
|
</script>
|
</html>
|