mirror of
https://gitee.com/jamen/slife.git
synced 2026-10-28 21:13:38 +00:00
add something about task
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package com.slife.constants;
|
||||
|
||||
/**
|
||||
* @Author felixu
|
||||
* @Date 2018.08.15
|
||||
*/
|
||||
public interface ActivitiConstants {
|
||||
|
||||
interface TaskStatus {
|
||||
String TASK_STATUS_TODO = "todo";
|
||||
String TASK_STATUS_CLAIM = "claim";
|
||||
String TASK_STATUS_FINISH = "finish";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.slife.controller;
|
||||
|
||||
import com.slife.base.entity.ReturnDTO;
|
||||
import com.slife.base.vo.DataTable;
|
||||
import com.slife.form.StartTaskForm;
|
||||
import com.slife.service.TaskService;
|
||||
import com.slife.util.ReturnDTOUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Author felixu
|
||||
* @Date 2018.08.14
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/task")
|
||||
@Api(value = "任务管理的前端控制器", tags = "任务管理接口", description = "任务相关")
|
||||
public class TaskController {
|
||||
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
|
||||
@ApiOperation(value = "进入流程管理页面", notes = "进入流程管理页面")
|
||||
@GetMapping(value = "/todo")
|
||||
public String list(Model model, HttpServletRequest request) {
|
||||
model.addAttribute("url", request.getContextPath()+"/task/todo/");
|
||||
return "task/todoList";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "待办列表", notes = "待办列表")
|
||||
@PostMapping("/todo/list")
|
||||
@ResponseBody
|
||||
public DataTable todoList(@RequestBody DataTable dt) {
|
||||
return taskService.getTodoTasks(dt);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "开始流程", notes = "开始任务")
|
||||
@PostMapping("/todo/start")
|
||||
public ReturnDTO start(@RequestBody StartTaskForm form, BindingResult result) {
|
||||
if (result.hasErrors()) {
|
||||
|
||||
}
|
||||
return ReturnDTOUtil.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.slife.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author felixu
|
||||
* @Date 2018.08.15
|
||||
*/
|
||||
@Data
|
||||
public class TaskDTO {
|
||||
private String applicant;
|
||||
private String taskId;
|
||||
private String taskName;
|
||||
private String title;
|
||||
private String pdName;
|
||||
private String version;
|
||||
private Long time;
|
||||
private String processInstanceId;
|
||||
private String status;
|
||||
private Variable variable;
|
||||
private String nodeKey;
|
||||
private String processDefKey;
|
||||
private String category;
|
||||
public void setVariable(Map<String, Object> variable) {
|
||||
this.variable = new Variable(variable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.slife.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.slife.util.StringUtils;
|
||||
import com.slife.utils.DateConverter;
|
||||
import com.slife.utils.PropertyType;
|
||||
import org.apache.commons.beanutils.ConvertUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Variable {
|
||||
|
||||
private Map<String, Object> map = new HashMap<>();
|
||||
|
||||
private String keys;
|
||||
private String values;
|
||||
private String types;
|
||||
|
||||
public Variable(){
|
||||
|
||||
}
|
||||
|
||||
public Variable(Map<String, Object> map){
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public String getKeys() {
|
||||
return keys;
|
||||
}
|
||||
|
||||
public void setKeys(String keys) {
|
||||
this.keys = keys;
|
||||
}
|
||||
|
||||
public String getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(String values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public String getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public void setTypes(String types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Map<String, Object> getVariableMap() {
|
||||
|
||||
ConvertUtils.register(new DateConverter(), java.util.Date.class);
|
||||
|
||||
if (StringUtils.isBlank(keys)) {
|
||||
return map;
|
||||
}
|
||||
|
||||
String[] arrayKey = keys.split(",");
|
||||
String[] arrayValue = values.split(",");
|
||||
String[] arrayType = types.split(",");
|
||||
for (int i = 0; i < arrayKey.length; i++) {
|
||||
String key = arrayKey[i];
|
||||
String value = arrayValue[i];
|
||||
String type = arrayType[i];
|
||||
|
||||
Class<?> targetType = Enum.valueOf(PropertyType.class, type).getValue();
|
||||
Object objectValue = ConvertUtils.convert(value, targetType);
|
||||
map.put(key, objectValue);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<String, Object> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.slife.form;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* @Author felixu
|
||||
* @Date 2018.08.14
|
||||
*/
|
||||
@Data
|
||||
public class StartTaskForm {
|
||||
@NotEmpty
|
||||
public String procDefKey;
|
||||
// @NotEmpty
|
||||
public String entityId;
|
||||
@NotEmpty
|
||||
public String title;
|
||||
// public String userId;
|
||||
public String comment;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.slife.service;
|
||||
|
||||
import com.slife.base.vo.DataTable;
|
||||
import com.slife.constants.ActivitiConstants;
|
||||
import com.slife.dto.TaskDTO;
|
||||
import com.slife.shiro.SlifeSysUser;
|
||||
import com.slife.util.StringUtils;
|
||||
import com.slife.utils.ExtUtils;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Deployment;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.task.TaskInfo;
|
||||
import org.activiti.engine.task.TaskQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author felixu
|
||||
* @Date 2018.08.14
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class TaskService {
|
||||
|
||||
@Autowired
|
||||
org.activiti.engine.TaskService actTaskService;
|
||||
|
||||
@Autowired
|
||||
RepositoryService repositoryService;
|
||||
|
||||
/**
|
||||
* 待办任务
|
||||
* @param title
|
||||
* @param category
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public DataTable<Map> getTodoTasks(DataTable dt) {
|
||||
String userId = SlifeSysUser.id() + "";
|
||||
TaskQuery taskQuery = actTaskService.createTaskQuery().taskCandidateOrAssigned(userId)
|
||||
.active().includeProcessVariables().orderByTaskCreateTime().desc();
|
||||
String category = (String) dt.getSearchParams().get("category");
|
||||
if (StringUtils.isNotBlank(category)) {
|
||||
taskQuery.taskCategory(category);
|
||||
}
|
||||
String title = (String) dt.getSearchParams().get("title");
|
||||
if (StringUtils.isNotBlank(title)){
|
||||
taskQuery.processVariableValueLikeIgnoreCase("title", "%" + title + "%");
|
||||
}
|
||||
Map<String, List<TaskDTO>> collect = taskQuery.listPage((dt.getPageNumber() - 1) * dt.getPageSize(), dt.getPageSize())
|
||||
.stream()
|
||||
.map(task -> {
|
||||
TaskDTO dto = getTaskDTO(task, task.getAssignee() == null ?
|
||||
ActivitiConstants.TaskStatus.TASK_STATUS_CLAIM : ActivitiConstants.TaskStatus.TASK_STATUS_TODO);
|
||||
dto.setTime(task.getCreateTime().getTime());
|
||||
return dto;
|
||||
}).collect(Collectors.groupingBy(TaskDTO::getCategory));
|
||||
dt.setRows(Collections.singletonList(collect));
|
||||
return dt;
|
||||
}
|
||||
|
||||
private TaskDTO getTaskDTO(TaskInfo task, String status) {
|
||||
ProcessDefinition processDefinition = getProcessDefinition(task.getProcessDefinitionId());
|
||||
String deploymentId = processDefinition.getDeploymentId();
|
||||
Deployment deployment = getDeployment(deploymentId);
|
||||
return ExtUtils.toTaskDTO(task, status, processDefinition, deployment);
|
||||
}
|
||||
|
||||
private ProcessDefinition getProcessDefinition(String processDefinitionId) {
|
||||
return repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
|
||||
}
|
||||
|
||||
private Deployment getDeployment(String deploymentId) {
|
||||
return repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.slife.utils;
|
||||
|
||||
import org.apache.commons.beanutils.Converter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class DateConverter implements Converter {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DateConverter.class);
|
||||
|
||||
private static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
private static final String DATETIME_PATTERN_NO_SECOND = "yyyy-MM-dd HH:mm";
|
||||
|
||||
private static final String DATE_PATTERN = "yyyy-MM-dd";
|
||||
|
||||
private static final String MONTH_PATTERN = "yyyy-MM";
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public Object convert(Class type, Object value) {
|
||||
Object result = null;
|
||||
if (type == Date.class) {
|
||||
try {
|
||||
result = doConvertToDate(value);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (type == String.class) {
|
||||
result = doConvertToString(value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert String to Date
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
private Date doConvertToDate(Object value) throws ParseException {
|
||||
Date result = null;
|
||||
|
||||
if (value instanceof String) {
|
||||
result = DateUtils.parseDate((String) value, new String[] { DATE_PATTERN, DATETIME_PATTERN,
|
||||
DATETIME_PATTERN_NO_SECOND, MONTH_PATTERN });
|
||||
|
||||
// all patterns failed, try a milliseconds constructor
|
||||
if (result == null && StringUtils.isNotEmpty((String) value)) {
|
||||
|
||||
try {
|
||||
result = new Date(new Long((String) value).longValue());
|
||||
} catch (Exception e) {
|
||||
logger.error("Converting from milliseconds to Date fails!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (value instanceof Object[]) {
|
||||
// let's try to convert the first element only
|
||||
Object[] array = (Object[]) value;
|
||||
|
||||
if (array.length >= 1) {
|
||||
value = array[0];
|
||||
result = doConvertToDate(value);
|
||||
}
|
||||
|
||||
} else if (Date.class.isAssignableFrom(value.getClass())) {
|
||||
result = (Date) value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Date to String
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private String doConvertToString(Object value) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATETIME_PATTERN);
|
||||
String result = null;
|
||||
if (value instanceof Date) {
|
||||
result = simpleDateFormat.format(value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.slife.utils;
|
||||
|
||||
import com.slife.dto.TaskDTO;
|
||||
import com.slife.entity.SysRole;
|
||||
import com.slife.entity.SysUser;
|
||||
import com.slife.enums.HttpCodeEnum;
|
||||
@@ -12,6 +13,8 @@ import org.activiti.engine.impl.persistence.entity.GroupEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.UserEntity;
|
||||
import org.activiti.engine.repository.Deployment;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.task.TaskInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -113,21 +116,22 @@ public class ExtUtils {
|
||||
return dto;
|
||||
}
|
||||
|
||||
// public static TaskDTO toTaskDTO(TaskInfo task, String status, ProcessDefinition processDefinition, Deployment deployment) {
|
||||
// TaskDTO dto = new TaskDTO();
|
||||
// dto.setTaskId(task.getId());
|
||||
// dto.setTaskName(task.getName());
|
||||
//// dto.setTime(historyService.createHistoricProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult().getStartTime().getTime());
|
||||
// dto.setVariable(task.getTaskLocalVariables());
|
||||
// dto.setPdName(deployment.getName());
|
||||
// dto.setVersion("V:" + processDefinition.getVersion());
|
||||
// dto.setProcessInstanceId(task.getProcessInstanceId());
|
||||
// dto.setStatus(status);
|
||||
// dto.setTitle((String) task.getProcessVariables().get("title"));
|
||||
// dto.setNodeKey(task.getTaskDefinitionKey());
|
||||
// dto.setProcessDefKey(processDefinition.getKey());
|
||||
// return dto;
|
||||
// }
|
||||
public static TaskDTO toTaskDTO(TaskInfo task, String status, ProcessDefinition processDefinition, Deployment deployment) {
|
||||
TaskDTO dto = new TaskDTO();
|
||||
dto.setTaskId(task.getId());
|
||||
dto.setTaskName(task.getName());
|
||||
// dto.setTime(historyService.createHistoricProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult().getStartTime().getTime());
|
||||
dto.setVariable(task.getTaskLocalVariables());
|
||||
dto.setPdName(deployment.getName());
|
||||
dto.setVersion("V:" + processDefinition.getVersion());
|
||||
dto.setProcessInstanceId(task.getProcessInstanceId());
|
||||
dto.setStatus(status);
|
||||
dto.setTitle((String) task.getProcessVariables().get("title"));
|
||||
dto.setNodeKey(task.getTaskDefinitionKey());
|
||||
dto.setProcessDefKey(processDefinition.getKey());
|
||||
dto.setCategory(task.getCategory());
|
||||
return dto;
|
||||
}
|
||||
|
||||
// public static TaskListDTO toTaskListDTO(PageResultsDTO dto, String category) {
|
||||
// TaskListDTO taskList = new TaskListDTO();
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.slife.utils;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public enum PropertyType {
|
||||
|
||||
S(String.class),
|
||||
I(Integer.class),
|
||||
L(Long.class),
|
||||
F(Float.class),
|
||||
N(Double.class),
|
||||
D(Date.class),
|
||||
SD(java.sql.Date.class),
|
||||
B(Boolean.class);
|
||||
|
||||
private Class<?> clazz;
|
||||
|
||||
private PropertyType(Class<?> clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public Class<?> getValue() {
|
||||
return clazz;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
function get_data(columns, sorts, uri) {
|
||||
$('#exampleTable').bootstrapTable(
|
||||
{
|
||||
method: 'post', // 服务器数据的请求方式 get or post
|
||||
url: url + uri, // 服务器数据的加载地址
|
||||
//showRefresh : true,
|
||||
//showToggle : true,
|
||||
//showColumns : true,
|
||||
iconSize: 'outline',
|
||||
toolbar: '#exampleToolbar',
|
||||
striped: true, // 设置为true会有隔行变色效果
|
||||
dataType: "json", // 服务器返回的数据类型
|
||||
pagination: true, // 设置为true会在底部显示分页条
|
||||
// queryParamsType : "limit",
|
||||
// //设置为limit则会发送符合RESTFull格式的参数
|
||||
singleSelect: false, // 设置为true将禁止多选
|
||||
// contentType : "application/x-www-form-urlencoded",
|
||||
// //发送到服务器的数据编码类型
|
||||
pageSize: 10, // 如果设置了分页,每页数据条数
|
||||
pageNumber: 1, // 如果设置了分布,首页页码
|
||||
//search : true, // 是否显示搜索框
|
||||
//showColumns : true, // 是否显示内容下拉框(选择显示的列)
|
||||
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者
|
||||
// "server"
|
||||
queryParams: function (params) {
|
||||
|
||||
var searchParams = {};
|
||||
$("#exampleToolbar ._search").each(function () {
|
||||
searchParams[$(this).attr('name')] = $(this).val();
|
||||
});
|
||||
|
||||
var p = {
|
||||
"pageNumber": this.pageNumber,
|
||||
"pageSize": this.pageSize,
|
||||
"searchParams": searchParams,
|
||||
"sorts": sorts
|
||||
|
||||
};
|
||||
return p;
|
||||
|
||||
},
|
||||
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
|
||||
// queryParamsType = 'limit' ,返回参数必须包含
|
||||
// limit, offset, search, sort, order 否则, 需要包含:
|
||||
// pageSize, pageNumber, searchText, sortName,
|
||||
// sortOrder.
|
||||
// 返回false将会终止请求
|
||||
columns: columns
|
||||
});
|
||||
}
|
||||
@@ -52,8 +52,7 @@ function getcolumns() {
|
||||
return c;
|
||||
}
|
||||
|
||||
// get_data(getcolumns(), {"revision": "desc"}, "list");
|
||||
load_data(getcolumns(), {"revision": "desc"})
|
||||
load_data_list(getcolumns(), {"revision": "desc"}, 'list')
|
||||
|
||||
function dt_delete_button(row) {
|
||||
var deleteO = '<a class="btn btn-warning btn-sm" href="#" title="删除" mce_href="#" ' +
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
function getcolumns() {
|
||||
var c = [
|
||||
{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'category',
|
||||
title: '流程分类'
|
||||
},
|
||||
{
|
||||
field: 'applicant',
|
||||
title: '申请人'
|
||||
},
|
||||
{
|
||||
field: 'taskName',
|
||||
title: '任务名称'
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '流程主题'
|
||||
},
|
||||
{
|
||||
field: 'xmlName',
|
||||
title: '流程XML',
|
||||
align: 'center',
|
||||
formatter: function (value, row, index) {
|
||||
var procDefId = row.processonDefinitionId;
|
||||
return '<a href=${url}resource?procDefId=' + procDefId + '&resType=xml>' + value + '</a>';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'picName',
|
||||
title: '流程图片',
|
||||
align: 'center',
|
||||
formatter: function (value, row, index) {
|
||||
var procDefId = row.processonDefinitionId;
|
||||
return '<a href=${url}resource?procDefId=' + procDefId + '&resType=image>' + value + '</a>';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'deploymentTime',
|
||||
title: '部署时间'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
field: 'id',
|
||||
align: 'center',
|
||||
formatter: function (value, row, index) {
|
||||
return dt_delete_button(row)+dt_active_button(row);
|
||||
}
|
||||
}];
|
||||
return c;
|
||||
}
|
||||
|
||||
load_data_list(getcolumns(), {"revision": "desc"}, 'list')
|
||||
|
||||
function dt_delete_button(row) {
|
||||
var deleteO = '<a class="btn btn-warning btn-sm" href="#" title="删除" mce_href="#" ' +
|
||||
'onclick="remove(\'' + row.id + '\')">删除</a> ';
|
||||
|
||||
return deleteO;
|
||||
|
||||
}
|
||||
|
||||
function dt_active_button(row) {
|
||||
var value = '';
|
||||
var status = '';
|
||||
if (row.suspend === false) {
|
||||
value = '挂起';
|
||||
status = 'suspend';
|
||||
} else {
|
||||
value = '激活'
|
||||
status = 'active';
|
||||
}
|
||||
var procDefId = row.processonDefinitionId;
|
||||
var deleteO = '<a class="btn btn-warning btn-sm" href="#" ' +
|
||||
'title="挂起/激活" mce_href="#" onclick="active(\'' + procDefId + '\', \'' + status + '\')"> ' + value + ' </a> ';
|
||||
return deleteO;
|
||||
}
|
||||
|
||||
function active(procDefId, state) {
|
||||
$.ajax({
|
||||
url: url + "status",
|
||||
type: "POST",
|
||||
data: {
|
||||
'procDefId': procDefId,
|
||||
'status': state
|
||||
},
|
||||
success: function (r) {
|
||||
dataTable_rep_message(r)
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -37,7 +37,6 @@
|
||||
<script src="${base}/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
|
||||
<script src="${base}/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
|
||||
<script src="${base}/js/slife/datatable.js"></script>
|
||||
<#--<script src="${base}/model/model.js"/>-->
|
||||
<script src="${base}/model/process/processDefinition.js"/>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,117 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>模型编辑</title>
|
||||
|
||||
<link href="${rc.contextPath}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link href="${rc.contextPath}/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
|
||||
<link href="${rc.contextPath}/css/animate.css" rel="stylesheet">
|
||||
<link href="${rc.contextPath}/css/style.css?v=4.1.0" rel="stylesheet">
|
||||
<link href="${rc.contextPath}/css/slife.css" rel="stylesheet">
|
||||
<link href="${rc.contextPath}/css/plugins/select2/select2.css" rel="stylesheet">
|
||||
|
||||
<link href="${rc.contextPath}/css/plugins/dropzone/dropzone.css" rel="stylesheet">
|
||||
<!-- 全局js -->
|
||||
<script src="${rc.contextPath}/js/jquery.min.js?v=2.1.4"></script>
|
||||
<script src="${rc.contextPath}/js/bootstrap.min.js?v=3.3.6"></script>
|
||||
<script src="${rc.contextPath}/js/plugins/validate/jquery.validate.min.js"></script>
|
||||
<script src="${rc.contextPath}/js/plugins/validate/messages_zh.min.js"></script>
|
||||
<script src="${rc.contextPath}/js/plugins/layer/layer.min.js"></script>
|
||||
<script src="${rc.contextPath}/js/jquery.form.js"></script>
|
||||
|
||||
<script src="${rc.contextPath}/js/plugins/select2/select2.min.js"></script>
|
||||
<script src="${rc.contextPath}/js/plugins/dropzone/dropzone.min.js"></script>
|
||||
|
||||
<script>
|
||||
var url = "${url}", action = "${action}";
|
||||
|
||||
</script>
|
||||
<script src="${rc.contextPath}/js/slife/slife.js"></script>
|
||||
<script src="${rc.contextPath}/js/slife/slifeform.js"></script>
|
||||
</head>
|
||||
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
|
||||
<form class="form-horizontal form-bordered" id="slifeForm">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">
|
||||
模型分类:
|
||||
<span class="required">
|
||||
*
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="category"
|
||||
value="${modelForm.category}" required aria-required="true"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">模型名称:<span class="required">*</span></label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="name"
|
||||
value="${modelForm.name}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">模型标识:<span class="required">*</span></label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<input name="key" type="text" class="form-control" value="${modelForm.key}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">模型描述:</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<textarea name="desc" class="form-control" value="${modelForm.desc}"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions fluid">
|
||||
<div class="col-md-offset-3 col-md-9">
|
||||
<button type="submit" class="btn green">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function cusFunction() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
var form = $('#slifeForm');
|
||||
var error = $('.alert-danger', form);
|
||||
form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'error',
|
||||
focusInvalid: true,
|
||||
rules: {
|
||||
|
||||
name: {
|
||||
category: true
|
||||
},
|
||||
name: {
|
||||
required: true,
|
||||
},
|
||||
key: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,141 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>模型管理</title>
|
||||
<link href="${rc.contextPath}/css/font-awesome.css?v=4.4.0" rel="stylesheet">
|
||||
<link href="${rc.contextPath}/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
|
||||
<link href="${rc.contextPath}/css/animate.css" rel="stylesheet">
|
||||
<script>
|
||||
var url = "${url}";
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="col-sm-12">
|
||||
<div class="ibox">
|
||||
<div class="ibox-body">
|
||||
|
||||
<div id="exampleToolbar" role="group">
|
||||
|
||||
<label style="margin-left: 10px;">
|
||||
登录名:
|
||||
<input type="text" class="form-filter input-sm _search" name="search_eq_login_name">
|
||||
</label>
|
||||
<label style="margin-left: 10px;">
|
||||
动作:
|
||||
<input type="text" class="form-filter input-sm _search" name="search_eq_msg">
|
||||
</label>
|
||||
<label style="margin-left: 10px;">
|
||||
参数:
|
||||
<input type="text" class="form-filter input-sm _search" name="search_like_params">
|
||||
</label>
|
||||
|
||||
<label style="margin-left: 10px;">
|
||||
<button class="btn btn-success" onclick="re_load()">
|
||||
<i class="fa fa-search" aria-hidden="true"></i>查询
|
||||
</button>
|
||||
<#--<button type="button" class="btn btn-danger" onclick="batch_remove()">-->
|
||||
<#--<i class="fa fa-trash" aria-hidden="true"></i>删除-->
|
||||
<#--</button>-->
|
||||
<#--<button type="button" class="btn btn-info" onclick="dt_action('发起流程', 'start')">-->
|
||||
<#--<i class="fa fa-plus-square" aria-hidden="true"></i>添加-->
|
||||
<#--</button>-->
|
||||
</label>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<table id="exampleTable" data-mobile-responsive="true">
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bootstrap table -->
|
||||
<script src="${rc.contextPath}/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
|
||||
<script src="${rc.contextPath}/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
|
||||
<script src="${rc.contextPath}/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
|
||||
|
||||
<script src="${rc.contextPath}/js/slife/datatable.js"></script>
|
||||
<script type="text/javascript">
|
||||
function getcolumns() {
|
||||
var c = [
|
||||
{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'category',
|
||||
title: '流程分类'
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: '模型ID'
|
||||
},
|
||||
{
|
||||
field: 'key',
|
||||
title: '模型标识'
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '模型名称'
|
||||
},
|
||||
{
|
||||
field: 'version',
|
||||
title: '版本号'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间'
|
||||
},
|
||||
{
|
||||
field: 'lastUpdateTime',
|
||||
title: '最后更新时间'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
field: 'id',
|
||||
align: 'center',
|
||||
formatter: function (value, row, index) {
|
||||
return dt_delete_button(row)+dt_edit_model_button(row)+dt_doploy_button(row);
|
||||
}
|
||||
}];
|
||||
return c;
|
||||
}
|
||||
load_data( getcolumns(), {"createDate": "desc"});
|
||||
|
||||
function dt_edit_model_button(row) {
|
||||
var uri = url.substring(0, url.length - 1);
|
||||
var editO = '<a class="btn btn-primary btn-sm" href="'+ uri +'er.html?modelId=' + row.id + '" title="编辑"><i class="fa fa-edit"></i></a> ';
|
||||
return editO;
|
||||
}
|
||||
|
||||
function dt_doploy_button(row) {
|
||||
var editO = '<a class="btn btn-primary btn-sm" href="#" mce_href="#" title="部署" onclick="deploy(\''
|
||||
+ row.id + '\')"><i class="fa fa-cog"></i></a> ';
|
||||
return editO;
|
||||
}
|
||||
|
||||
function deploy(id) {
|
||||
layer.confirm('确定要部署选中的记录?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
$.ajax({
|
||||
url: url + "deploy",
|
||||
type: "POST",
|
||||
data: {
|
||||
'id': id
|
||||
},
|
||||
success: function (r) {
|
||||
dataTable_rep_message(r)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -15,7 +15,7 @@ public class WebSiteMeshFilter extends ConfigurableSiteMeshFilter {
|
||||
/** 需要装饰的访问路径 */
|
||||
|
||||
private String contentPath="/sys/user,/sys/menu,/sys/dict,/sys/role,/sys/office,/sys/,/index,/monitor/*," +
|
||||
"/blog/content**,/404,/model,/process";
|
||||
"/blog/content**,/404,/model,/process,/task/**";
|
||||
|
||||
/** 装饰器页面路径 */
|
||||
|
||||
|
||||
@@ -126,10 +126,19 @@ function export_data(columns, sorts) {
|
||||
* @param columns
|
||||
*/
|
||||
function load_data(columns, sorts) {
|
||||
load_data_list(columns, sorts, 'list')
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载表数据
|
||||
* @param url
|
||||
* @param columns
|
||||
*/
|
||||
function load_data_list(columns, sorts, uri) {
|
||||
$('#exampleTable').bootstrapTable(
|
||||
{
|
||||
method: 'post', // 服务器数据的请求方式 get or post
|
||||
url: url + "list", // 服务器数据的加载地址
|
||||
url: url + uri, // 服务器数据的加载地址
|
||||
//showRefresh : true,
|
||||
//showToggle : true,
|
||||
//showColumns : true,
|
||||
|
||||
Reference in New Issue
Block a user