Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/activiti/modelList.jsp

439 lines
18 KiB
Plaintext
Raw Normal View History

2026-01-16 14:13:44 +08:00
<%@page import="org.apache.poi.ss.usermodel.Row"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page import="com.sipai.entity.base.ServerObject"%>
<%@ page import="com.sipai.tools.SessionManager"%>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
<%
SessionManager sessionManager = new SessionManager();
%>
<%String contextPath = request.getContextPath();%>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<!-- bootstrap switch -->
<link rel="stylesheet"
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css" />
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
charset="utf-8"></script>
<script type="text/javascript">
var companyId = "${param.unitId}";
var addFun = function() {
$.post(ext.contextPath + '/activiti/workflow/model/addModel.do' ,{companyId:companyId}, function(data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
/* 导入 */
var importFun = function() {
$.post(ext.contextPath + '/activiti/workflow/model/saveImportModel.do', {} , function(data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
/* 同步 */
var synchroFun = function() {
$.post(ext.contextPath + '/activiti/workflow/model/savePLMProcess.do', {} , function(data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
/* 查看管控内容 */
var viewFun = function(id) {
$.post(ext.contextPath + '/activiti/workflow/model/showProcessTechnicsList.do', {modelid:id} , function(data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var editFun = function(id) {
$.post(ext.contextPath + '/activiti/workflow/model/editModel.do', {modelid:id} , function(data) {
$("#subDiv").html(data);
openModal('subModal');
//initTable(id);
});
};
/* 编辑流程节点的业务 */
var editNodeFun = function(id,resourceId,processTypeId,bizId) {
$.post(ext.contextPath + '/activiti/workflow/model/editNode.do', {modelid:id,resourceId:resourceId,processTypeId:processTypeId,bizId:bizId} , function(data) {
$("#subDiv1").html(data);
openModal('subModal1');
});
};
/* $('#subModal').on('shown.bs.modal', function () {
alert(); // 执行一些动作...
}); */
/* var editFlowFun = function(id) {
var w = window.screen.width*0.7;
var h = window.screen.height*0.7;
var l = window.screen.width*(1-0.7)/2;
window.open(ext.contextPath + '/modeler.html?modelId=' + id,'_black',
"left="+ l
+ ",top=50,scrollbars=yes,location=no,status=no,toolbar=no,resizable=yes"
+ ",width="+w
+ ",height="+h);
}; */
var copyFun = function(id) {
swal({
text: "您确定要为该模型生成副本?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function(willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/activiti/workflow/model/copycreat.do', {id : id}, function(data) {
if(data==1){
showAlert('s','生成成功');
$("#table").bootstrapTable('refresh');
}else{
showAlert('d','生成失败');
}
});
}
});
};
/* 部署 */
var deployFun = function(id) {
$.post(ext.contextPath + '/activiti/workflow/model/deploy.do',{modelId:id}, function(data) {
if(data.res=='1'){
//showAlert('s','部署成功');
showAlert('s','部署成功');
}else{
showAlert('d',data.restr);
//parent.$.messager.alert('提示','部署失败','info');
}
},'json');
};
var deleteFun = function(id) {
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function(willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/activiti/workflow/model/delete.do', {id : id}, function(data) {
if(data==1){
$("#table").bootstrapTable('refresh');
}else{
showAlert('d','删除失败','mainAlertdiv');
}
});
}
});
};
var deletesFun = function() {
var checkedItems = $("#table").bootstrapTable('getSelections');
var datas="";
$.each(checkedItems, function(index, item){
datas+=item.id+",";
});
if(datas==""){
showAlert('d','请先选择记录','mainAlertdiv');
}else{
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function(willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/work/group/deletes.do', {ids:datas} , function(data) {
if(data>0){
$("#table").bootstrapTable('refresh');
}else{
showAlert('d','删除失败','mainAlertdiv');
}
});
}
});
}
};
var init = function() {
$.post(ext.contextPath + '/work/group/getListForSelect.do', {} , function(data) {
//console.info(data)
if(data.length>0){
for(var i=0;i<data.length;i++){
console.info(data)
$("#search_code").append("<option value='"+data[i].id+"'>"+data[i].text+"</option>");
}
/* $("#search_code").select2({
placeholder: "请选择班组",
language: "zh-CN",
allowClear: true,
data: data
}); */
}
},'json');
};
var dosearch = function() {
var search_name = $('#search_name').val();
$("#table").bootstrapTable('refresh');
};
function showTable(){
$("#table").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/activiti/workflow/model/getModelList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20], // 设置页面可以显示的数据条数
pageSize: 50, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order, // 排序规则
search_name: $('#search_name').val(),
search_code: companyId
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
columns: [
{
field: 'id', // 返回json数据中的name
title: '模板ID', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},{
field: 'name',
title: '模板名称',
align: 'center',
valign: 'middle'
},/* {
field: 'key',
title: '模板key',
align: 'center',
valign: 'middle'
}, */{
field: 'createTime',
title: '创建时间',
align: 'center',
valign: 'middle',
formatter : function(value, row)
{
//return FormatDate(value.time);
return FormatDate(value.time);
}
},{
field: 'version',
title: '版本号',
align: 'center',
valign: 'middle'
},{
title: "操作",
align: 'center',
valign: 'middle',
width: 240, // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var str = '';
str += '<security:authorize buttonUrl="activiti/workflow/model/edit.do">';
str += '<button class="btn btn-default btn-sm" onclick="editFun(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
str += '<button class="btn btn-default btn-sm" onclick="copyFun(\'' + row.id + '\')" data-toggle="tooltip" title="复制"><i class="fa fa-copy"></i><span class="hidden-md hidden-lg"> 复制</span></button>';
str += '<button class="btn btn-default btn-sm" onclick="deployFun(\'' + row.id + '\')" data-toggle="tooltip" title="部署"><i class="fa fa-play"></i><span class="hidden-md hidden-lg"> 部署</span></button>';
str += '</security:authorize>';
str += '<security:authorize buttonUrl="activiti/workflow/model/delete.do">';
str += '<button class="btn btn-default btn-sm" onclick="deleteFun(\'' + row.id + '\')" data-toggle="tooltip" title="删除"><i class="fa fa-trash"></i><span class="hidden-md hidden-lg"> 删除</span></button>';
str += '</security:authorize>';
str ='<div class="btn-group">'+str+'</div>';
return str;
/* return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>'; */
}
}
],
onLoadSuccess: function(){ //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function(){ //加载失败时执行
console.info("加载数据失败");
}
})
}
function FormatDate (strTime) {
var date = new Date(strTime);
return date.Format("yyyy-MM-dd hh:mm:ss");
}
$(function() {
if(unitId!=null && unitId!=undefined && unitId!=''){
companyId = unitId;
}
//简易公司combotree
/* $.post(ext.contextPath + '/user/getUnitForTree.do', { ng: '' }, function (data) {
//console.log("data",data[0]);
if (data.length == 1 && !data[0].hasOwnProperty("nodes")) {
//当登陆者的pid以下没有子节点时显示单独一个span
$("#search_pid").val(data[0].id);
$("#companyselect").hide();
$("#companyName").text("公司:" + data[0].text);
} else if ((data.length == 1 && data.nodes != "") || data.length > 1) {
//第一次加载时赋值
$("#search_pid").val(data[0].id);
$("#cname_input").val(data[0].text);
showTable();
//$table.bootstrapTable('refresh');//异步加载重新刷新,待修改
$('#companytree').treeview({
data: data,
showBorder: false,
levels: 3,
});
$('#companytree').on('nodeSelected', function (event, data) {
$("#search_pid").val(data.id);
$("#cname_input").val(data.text);
document.getElementById('ul_tree').style.display = "none";
//$table.bootstrapTable('refresh');
dosearch();
});
} else {
//待完善
};
}, 'json');
//防止点击树的+号收起下拉框
$("#ul_tree").on("click", function (e) {
event.stopPropagation();
});
//点击空白隐藏树
$(document).click(function (e) {
var divTree = $('#ul_tree'); // 设置目标区域
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
divTree.hide()
}
})
*/
showTable();
})
</script>
</head>
<body class="hold-transition ${cu.themeclass} sidebar-mini">
<div class="wrapper">
<!-- 引用top -->
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
<!-- 菜单栏 -->
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
<div class="content-wrapper">
<!-- Main content -->
<section class="content container-fluid">
<!-- <div id="mainAlertdiv"></div> -->
<div id="subDiv"></div>
<div id="subDiv1"></div>
<div id="subDiv_Job"></div>
<div id="menu4SelectDiv"></div>
<div id="alertDiv"></div>
<div id='unit4SelectDiv'></div>
<div >
<!-- <div class="form-group " style="margin-bottom:10px;">
<input id="search_pid" name="search_pid" type="hidden" />
<span id="companyName" style="width:220px;border: none;background: transparent;"></span>
</div>
<ul id="companyselect" style="list-style-type:none;padding-left:0px;width:300px;">
<li class="dropdown" style="width:300px;">
Menu toggle button
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
style="width:300px;" onclick="document.getElementById('ul_tree').style.display = 'block';">
<div class="input-group">
<span class="input-group-addon"
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
<input class="form-control " id="cname_input" name="cname_input"
style="height:31px;width: 220px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
readonly />
</div>/input-group
</a>
<ul id="ul_tree" class="dropdown-menu" data-stopPropagation="true">
<li class="header">
<div id="companytree" style="width: 275px;overflow:auto;"></div>
</li>
</ul>
</li>
</ul> -->
<div class="form-group " style="padding:0;">
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
<security:authorize buttonUrl="activiti/workflow/model/add.do">
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i class="fa fa-plus"></i> 新增</button>
</security:authorize>
</div>
<div class="form-group pull-right" >
<div class="input-group input-group-sm" style="width: 250px;">
<input type="text" id="search_name" name="search_name" class="form-control pull-right" placeholder="模板名称">
<div class="input-group-btn">
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
</div>
<table id="table"></table>
</div>
</section>
<!-- /.content -->
</div>
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
</div>
</body>
</html>