diff --git a/src/main/java/com/sipai/controller/activiti/ModelController.java b/src/main/java/com/sipai/controller/activiti/ModelController.java index 1f675cc6..feaa7066 100644 --- a/src/main/java/com/sipai/controller/activiti/ModelController.java +++ b/src/main/java/com/sipai/controller/activiti/ModelController.java @@ -55,6 +55,7 @@ import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; @@ -728,12 +729,21 @@ public class ModelController { if(stencil.get("id").asText().toString().equals("UserTask")){ JSONObject json = JSONObject.fromObject(childShapes.path(i).toString()); JSONObject properties = JSONObject.fromObject(json.get("properties").toString()); - String documentation = properties.get("documentation").toString(); + String documentation = properties.get("documentation").toString(); + + // 获取节点名称 + String nodeName = ""; + if(properties.has("name") && properties.get("name") != null) { + nodeName = properties.get("name").toString(); + } + // 添加节点名称字段,方便前端显示 + json.put("nodeName", nodeName); + json.put("businessunit", businessUnitService.selectById(documentation)); String resourceId = json.get("resourceId").toString(); List list = this.jobService.selectModelNodeJobListByWhere(" where resource_id='"+resourceId+"' and model_id ='"+modelData.getId()+"' "); StringBuilder jobNames= new StringBuilder(); - StringBuilder jobIds = new StringBuilder(); + StringBuilder jobIds= new StringBuilder(); if(list != null && !list.isEmpty()){ for(int j=0;j list = this.businessUnitService.selectListByWhere(wherestr+orderstr); @@ -72,7 +72,6 @@ public class BusinessUnitController { JSONArray json=JSONArray.fromObject(list); String result="{\"total\":"+pi.getTotal()+",\"rows\":"+json+"}"; -// System.out.println(result); model.addAttribute("result",result); return new ModelAndView("result"); } diff --git a/src/main/webapp/jsp/activiti/modelEdit.jsp b/src/main/webapp/jsp/activiti/modelEdit.jsp index e1d0e344..7fb95e0f 100644 --- a/src/main/webapp/jsp/activiti/modelEdit.jsp +++ b/src/main/webapp/jsp/activiti/modelEdit.jsp @@ -79,8 +79,8 @@ var initTable = function(id) { align: 'center', // 左右居中 valign: 'middle', // 上下居中 formatter:function(value,row,index){ - return value.name; - } + return row.nodeName || (value && value.name) || ''; + } },{ field: 'businessunit', // 返回json数据中的name title: '节点业务名称', // 表格表头显示文字 diff --git a/src/main/webapp/jsp/business/businessUnitAdd.jsp b/src/main/webapp/jsp/business/businessUnitAdd.jsp index 60d0a0f4..3528e838 100644 --- a/src/main/webapp/jsp/business/businessUnitAdd.jsp +++ b/src/main/webapp/jsp/business/businessUnitAdd.jsp @@ -4,7 +4,7 @@ function dosave() { $("#subForm").bootstrapValidator('validate');//提交验证 if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码 - $.post(ext.contextPath + "/work/group/save.do", $("#subForm").serialize(), function(data) { + $.post(ext.contextPath + "/business/businessunit/save.do", $("#subForm").serialize(), function(data) { if (data.res == 1) { closeModal('subModal') $("#table").bootstrapTable('refresh'); @@ -25,12 +25,42 @@ name: { validators: { notEmpty: { - message: '用户名不能为空' + message: '业务单元名称不能为空' + } + } + }, + processTypeId: { + validators: { + notEmpty: { + message: '流程类型不能为空' } } }, } - }); + }); + + $(function() { + // 加载流程类型下拉框 + $.post(ext.contextPath + "/activiti/workflow/getProcessTypes4Combo.do", function(data) { + var selelct = $("#processTypeId").select2({ + data: data, + placeholder: '请选择', + allowClear: true, + escapeMarkup: function(markup) { + return markup; + }, + language: "zh-CN", + minimumInputLength: 0, + minimumResultsForSearch: 10, + formatResult: function formatRepo(repo) { + return repo.text; + }, + formatSelection: function formatRepoSelection(repo) { + return repo.text; + } + }); + }, 'json'); + });