commit
8a3488f3d1
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
|
||||
### 请求 /bpm/process-definition/list 接口 => 成功
|
||||
GET {{baseUrl}}/bpm/process-definition/list?suspensionState=1
|
||||
tenant-id: 1
|
||||
Authorization: Bearer {{token}}
|
||||
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("流程定义列表 Request VO")
|
||||
public class BpmProcessDefinitionListReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "中断状态", example = "1", notes = "参见 SuspensionState 枚举")
|
||||
private Integer suspensionState;
|
||||
|
||||
}
|
||||
@ -1,13 +1,29 @@
|
||||
### 请求 /login 接口 => 成功
|
||||
### 请求 /bpm/process-instance/create 接口 => 成功
|
||||
POST {{baseUrl}}/bpm/process-instance/create
|
||||
Content-Type: application/json
|
||||
tenant-id: 1
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
{
|
||||
"processDefinitionId": "leave:7:20ada39c-6c95-11ec-88b1-cacd34981f8e",
|
||||
"processDefinitionId": "gateway_test:2:00e52d8e-701b-11ec-aca9-a2380e71991a",
|
||||
"variables": {
|
||||
"a": 1,
|
||||
"b": "2"
|
||||
}
|
||||
}
|
||||
|
||||
### 请求 /bpm/process-instance/cancel 接口 => 成功
|
||||
DELETE {{baseUrl}}/bpm/process-instance/cancel
|
||||
Content-Type: application/json
|
||||
tenant-id: 1
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
{
|
||||
"id": "b9220387-7088-11ec-bcae-a2380e71991a",
|
||||
"reason": "我就取消"
|
||||
}
|
||||
|
||||
### 请求 /bpm/process-instance/my-page 接口 => 成功
|
||||
GET {{baseUrl}}/bpm/process-instance/my-page
|
||||
tenant-id: 1
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
### 请求 /bpm/task/todo-page 接口 => 成功
|
||||
GET {{baseUrl}}/bpm/task/todo-page
|
||||
tenant-id: 1
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
### 请求 /bpm/task/done-page 接口 => 成功
|
||||
GET {{baseUrl}}/bpm/task/done-page?pageSize=100
|
||||
tenant-id: 1
|
||||
Authorization: Bearer {{token}}
|
||||
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.instance;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
|
||||
@ApiModel("流程实例的取消 Request VO")
|
||||
@Data
|
||||
public class BpmProcessInstanceCancelReqVO {
|
||||
|
||||
@ApiModelProperty(value = "流程实例的编号", required = true, example = "1024")
|
||||
@NotEmpty(message = "流程实例的编号不能为空")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "取消原因", required = true, example = "不请假了!")
|
||||
@NotEmpty(message = "取消原因不能为空")
|
||||
private String reason;
|
||||
|
||||
}
|
||||
@ -1,6 +1,44 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.instance;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("流程实例的分页 Item Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmProcessInstanceMyPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "流程名称", example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "流程定义的编号", example = "2048")
|
||||
private String processDefinitionId;
|
||||
|
||||
@ApiModelProperty(value = "流程实例的状态", notes = "参见 bpm_process_instance_status", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "流程实例的结果", notes = "参见 bpm_process_instance_result", example = "2")
|
||||
private Integer result;
|
||||
|
||||
@ApiModelProperty(value = "流程分类", notes = "参见 bpm_model_category 数据字典", example = "1")
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty(value = "开始的创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginCreateTime;
|
||||
|
||||
@ApiModelProperty(value = "结束的创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endCreateTime;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.instance;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("流程实例的分页 Item Response VO")
|
||||
@Data
|
||||
public class BpmProcessInstancePageItemRespVO {
|
||||
|
||||
@ApiModelProperty(value = "流程实例的编号", required = true, example = "1024")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "流程名称", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "流程定义的编号", required = true, example = "2048")
|
||||
private String processDefinitionId;
|
||||
|
||||
@ApiModelProperty(value = "流程分类", required = true, notes = "参见 bpm_model_category 数据字典", example = "1")
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty(value = "流程实例的状态", required = true, notes = "参见 bpm_process_instance_status", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "流程实例的结果", required = true, notes = "参见 bpm_process_instance_result", example = "2")
|
||||
private Integer result;
|
||||
|
||||
@ApiModelProperty(value = "提交时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间", required = true)
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 当前任务
|
||||
*/
|
||||
private List<Task> tasks;
|
||||
|
||||
@ApiModel("流程任务")
|
||||
@Data
|
||||
public static class Task {
|
||||
|
||||
@ApiModelProperty(value = "流程任务的编号", required = true, example = "1024")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "任务名称", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
|
||||
@ApiModel("通过流程任务的 Request VO")
|
||||
@Data
|
||||
public class BpmTaskApproveReqVO {
|
||||
|
||||
@ApiModelProperty(value = "任务编号", required = true, example = "1024")
|
||||
@NotEmpty(message = "任务编号不能为空")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "审批意见", required = true, example = "不错不错!")
|
||||
@NotEmpty(message = "审批意见不能为空")
|
||||
private String comment;
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("流程任务的 Done 已完成的分页项 Response VO")
|
||||
@Data
|
||||
public class BpmTaskDonePageItemRespVO {
|
||||
|
||||
@ApiModelProperty(value = "任务编号", required = true, example = "1024")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "任务名字", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "接收时间", required = true)
|
||||
private Date claimTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
@ApiModelProperty(value = "结束时间", required = true)
|
||||
private Date endTime;
|
||||
@ApiModelProperty(value = "持续时间", required = true, example = "1000")
|
||||
private Long durationInMillis;
|
||||
|
||||
@ApiModelProperty(value = "任务结果", required = true, notes = "参见 bpm_process_instance_result", example = "2")
|
||||
private Integer result;
|
||||
@ApiModelProperty(value = "审批建议", required = true, example = "不请假了!")
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 所属流程实例
|
||||
*/
|
||||
private ProcessInstance processInstance;
|
||||
|
||||
@Data
|
||||
@ApiModel("流程实例")
|
||||
public static class ProcessInstance {
|
||||
|
||||
@ApiModelProperty(value = "流程实例编号", required = true, example = "1024")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "流程实例名称", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "发起人的用户编号", required = true, example = "1024")
|
||||
private Long startUserId;
|
||||
|
||||
@ApiModelProperty(value = "发起人的用户昵称", required = true, example = "芋艿")
|
||||
private String startUserNickname;
|
||||
|
||||
@ApiModelProperty(value = "流程定义的编号", required = true, example = "2048")
|
||||
private String processDefinitionId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 任务编号、流程名称、任务节点、流程发起人、接收时间、审批时间、耗时【名称、开始时间】「流程记录、撤回」
|
||||
// 任务编号、任务名称、所属流程、委托代办人、流程发起人、优先级、审批操作、审批意见、耗时、创建时间【名称、开始时间】「申请详情」
|
||||
|
||||
// 任务编号、任务名称、流程名称、流程发起人、接收时间、审批时间、耗时【名称、接收时间】「详情」TODO 撤回
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("流程任务的 Done 已办的分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmTaskDonePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "流程任务名", example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "开始的创建收间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginCreateTime;
|
||||
|
||||
@ApiModelProperty(value = "结束的创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endCreateTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@ApiModel("不通过流程任务的 Request VO")
|
||||
@Data
|
||||
public class BpmTaskRejectReqVO {
|
||||
|
||||
@ApiModelProperty(value = "任务编号", required = true, example = "1024")
|
||||
@NotEmpty(message = "任务编号不能为空")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "审批意见", required = true, example = "不错不错!")
|
||||
@NotEmpty(message = "审批意见不能为空")
|
||||
private String comment;
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("流程任务的 Running 进行中的分页项 Response VO")
|
||||
@Data
|
||||
public class BpmTaskTodoPageItemRespVO {
|
||||
|
||||
@ApiModelProperty(value = "任务编号", required = true, example = "1024")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "任务名字", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "接收时间", required = true)
|
||||
private Date claimTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "激活状态", required = true, example = "1", notes = "参见 SuspensionState 枚举")
|
||||
private Integer suspensionState;
|
||||
|
||||
/**
|
||||
* 所属流程实例
|
||||
*/
|
||||
private ProcessInstance processInstance;
|
||||
|
||||
@Data
|
||||
@ApiModel("流程实例")
|
||||
public static class ProcessInstance {
|
||||
|
||||
@ApiModelProperty(value = "流程实例编号", required = true, example = "1024")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "流程实例名称", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "发起人的用户编号", required = true, example = "1024")
|
||||
private Long startUserId;
|
||||
|
||||
@ApiModelProperty(value = "发起人的用户昵称", required = true, example = "芋艿")
|
||||
private String startUserNickname;
|
||||
|
||||
@ApiModelProperty(value = "流程定义的编号", required = true, example = "2048")
|
||||
private String processDefinitionId;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("流程任务的 TODO 待办的分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmTaskTodoPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "流程任务名", example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "开始的创建收间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginCreateTime;
|
||||
|
||||
@ApiModelProperty(value = "结束的创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endCreateTime;
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo;
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo;
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo;
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo;
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
@ -1,17 +0,0 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class TaskReqVO {
|
||||
|
||||
private String taskId;
|
||||
|
||||
private Map<String,Object> variables;
|
||||
|
||||
private String comment;
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("待办任务申请分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TodoTaskPageReqVO extends PageParam {
|
||||
|
||||
private String assignee;
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.convert.task;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.instance.BpmProcessInstancePageItemRespVO;
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.sql.SQLXML;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* 流程实例 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface BpmProcessInstanceConvert {
|
||||
|
||||
BpmProcessInstanceConvert INSTANCE = Mappers.getMapper(BpmProcessInstanceConvert.class);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "instance.startUserId", target = "startUserId"),
|
||||
@Mapping(source = "instance.id", target = "processInstanceId"),
|
||||
@Mapping(source = "instance.startTime", target = "createTime"),
|
||||
@Mapping(source = "definition.id", target = "processDefinitionId"),
|
||||
@Mapping(source = "definition.name", target = "name"),
|
||||
@Mapping(source = "definition.category", target = "category")
|
||||
})
|
||||
BpmProcessInstanceExtDO convert(ProcessInstance instance, ProcessDefinition definition);
|
||||
|
||||
default PageResult<BpmProcessInstancePageItemRespVO> convertPage(PageResult<BpmProcessInstanceExtDO> page,
|
||||
Map<String, List<Task>> taskMap) {
|
||||
List<BpmProcessInstancePageItemRespVO> list = convertList(page.getList());
|
||||
list.forEach(respVO -> respVO.setTasks(convertList2(taskMap.get(respVO.getId()))));
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
List<BpmProcessInstancePageItemRespVO> convertList(List<BpmProcessInstanceExtDO> list);
|
||||
|
||||
List<BpmProcessInstancePageItemRespVO.Task> convertList2(List<Task> tasks);
|
||||
|
||||
@Mapping(source = "processInstanceId", target = "id")
|
||||
BpmProcessInstancePageItemRespVO convert(BpmProcessInstanceExtDO bean);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "id", target = "processInstanceId"),
|
||||
@Mapping(source = "startDate", target = "createTime"),
|
||||
@Mapping(source = "initiator", target = "startUserId"),
|
||||
@Mapping(source = "status", target = "status", ignore = true)
|
||||
})
|
||||
BpmProcessInstanceExtDO convert(org.activiti.api.process.model.ProcessInstance bean);
|
||||
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.convert.task;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task.BpmTaskDonePageItemRespVO;
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task.BpmTaskTodoPageItemRespVO;
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task.TaskStepVO;
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.task.BpmTaskExtDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.impl.persistence.entity.SuspensionState;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.Named;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Bpm 任务 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface BpmTaskConvert {
|
||||
|
||||
BpmTaskConvert INSTANCE = Mappers.getMapper(BpmTaskConvert.class);
|
||||
|
||||
@Mappings(value = {
|
||||
@Mapping(source = "activityName", target = "stepName"),
|
||||
@Mapping(source = "assignee", target = "assignee")
|
||||
})
|
||||
TaskStepVO convert(HistoricActivityInstance instance);
|
||||
|
||||
default List<BpmTaskTodoPageItemRespVO> convertList(List<Task> tasks, Map<String, ProcessInstance> processInstanceMap,
|
||||
Map<Long, SysUserDO> userMap) {
|
||||
return CollectionUtils.convertList(tasks, task -> {
|
||||
ProcessInstance processInstance = processInstanceMap.get(task.getProcessInstanceId());
|
||||
return convert(task, processInstance, userMap.get(Long.valueOf(processInstance.getStartUserId())));
|
||||
});
|
||||
}
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "task.id", target = "id"),
|
||||
@Mapping(source = "task.name", target = "name"),
|
||||
@Mapping(source = "task.claimTime", target = "claimTime"),
|
||||
@Mapping(source = "task.createTime", target = "createTime"),
|
||||
@Mapping(source = "task.suspended", target = "suspensionState", qualifiedByName = "convertSuspendedToSuspensionState"),
|
||||
@Mapping(source = "processInstance.id", target = "processInstance.id"),
|
||||
@Mapping(source = "processInstance.name", target = "processInstance.name"),
|
||||
@Mapping(source = "processInstance.startUserId", target = "processInstance.startUserId"),
|
||||
@Mapping(source = "processInstance.processDefinitionId", target = "processInstance.processDefinitionId"),
|
||||
@Mapping(source = "user.nickname", target = "processInstance.startUserNickname")
|
||||
})
|
||||
BpmTaskTodoPageItemRespVO convert(Task task, ProcessInstance processInstance, SysUserDO user);
|
||||
|
||||
@Named("convertSuspendedToSuspensionState")
|
||||
default Integer convertSuspendedToSuspensionState(boolean suspended) {
|
||||
return suspended ? SuspensionState.SUSPENDED.getStateCode() :
|
||||
SuspensionState.ACTIVE.getStateCode();
|
||||
}
|
||||
|
||||
default List<BpmTaskDonePageItemRespVO> convertList2(List<HistoricTaskInstance> tasks, Map<String, BpmTaskExtDO> bpmTaskExtDOMap,
|
||||
Map<String, HistoricProcessInstance> historicProcessInstanceMap,
|
||||
Map<Long, SysUserDO> userMap) {
|
||||
return CollectionUtils.convertList(tasks, task -> {
|
||||
BpmTaskExtDO taskExtDO = bpmTaskExtDOMap.get(task.getId());
|
||||
HistoricProcessInstance processInstance = historicProcessInstanceMap.get(task.getProcessInstanceId());
|
||||
SysUserDO userDO = userMap.get(Long.valueOf(processInstance.getStartUserId()));
|
||||
return convert(task, taskExtDO, processInstance, userDO);
|
||||
});
|
||||
}
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "task.id", target = "id"),
|
||||
@Mapping(source = "task.name", target = "name"),
|
||||
@Mapping(source = "task.claimTime", target = "claimTime"),
|
||||
@Mapping(source = "task.createTime", target = "createTime"),
|
||||
@Mapping(source = "task.endTime", target = "endTime"),
|
||||
@Mapping(source = "task.durationInMillis", target = "durationInMillis"),
|
||||
@Mapping(source = "taskExtDO.result", target = "result"),
|
||||
@Mapping(source = "taskExtDO.comment", target = "comment"),
|
||||
@Mapping(source = "processInstance.id", target = "processInstance.id"),
|
||||
@Mapping(source = "processInstance.name", target = "processInstance.name"),
|
||||
@Mapping(source = "processInstance.startUserId", target = "processInstance.startUserId"),
|
||||
@Mapping(source = "processInstance.processDefinitionId", target = "processInstance.processDefinitionId"),
|
||||
@Mapping(source = "user.nickname", target = "processInstance.startUserNickname")
|
||||
})
|
||||
BpmTaskDonePageItemRespVO convert(HistoricTaskInstance task, BpmTaskExtDO taskExtDO, HistoricProcessInstance processInstance, SysUserDO user);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "id", target = "taskId"),
|
||||
@Mapping(source = "assignee", target = "assigneeUserId"),
|
||||
@Mapping(source = "createdDate", target = "createTime")
|
||||
})
|
||||
BpmTaskExtDO convert(org.activiti.api.task.model.Task bean);
|
||||
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.convert.workflow;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.TaskStepVO;
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.controller.workflow.vo.TodoTaskRespVO;
|
||||
import org.activiti.api.task.model.Task;
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.Named;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface TaskConvert {
|
||||
TaskConvert INSTANCE = Mappers.getMapper(TaskConvert.class);
|
||||
|
||||
@Mappings(value = {
|
||||
@Mapping(source = "task.id", target = "id"),
|
||||
@Mapping(source = "task.businessKey", target = "businessKey"),
|
||||
@Mapping(source = "task.assignee", target = "status",qualifiedByName = "convertAssigneeToStatus"),
|
||||
@Mapping(source = "definition.name", target = "processName"),
|
||||
@Mapping(source = "definition.key", target = "processKey"),
|
||||
@Mapping(source = "definition.id", target = "processInstanceId")
|
||||
})
|
||||
TodoTaskRespVO convert(Task task, ProcessDefinition definition);
|
||||
|
||||
@Mappings(value = {
|
||||
@Mapping(source = "assignee", target = "status",qualifiedByName = "convertAssigneeToStatus")
|
||||
})
|
||||
TodoTaskRespVO convert(Task task);
|
||||
|
||||
@Named("convertAssigneeToStatus")
|
||||
default Integer convertAssigneeToStatus(String assignee) {
|
||||
//TODO 不应该通过 assignee 定义状态 需要定义更多的状态
|
||||
return assignee == null ? 1 : 2;
|
||||
}
|
||||
|
||||
@Mappings(value = {
|
||||
@Mapping(source = "activityName", target = "stepName"),
|
||||
@Mapping(source = "assignee", target = "assignee")
|
||||
})
|
||||
TaskStepVO convert(HistoricActivityInstance instance);
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.task;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.instance.BpmProcessInstanceMyPageReqVO;
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BpmProcessInstanceExtMapper extends BaseMapperX<BpmProcessInstanceExtDO> {
|
||||
|
||||
default PageResult<BpmProcessInstanceExtDO> selectPage(Long userId, BpmProcessInstanceMyPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<BpmProcessInstanceExtDO>()
|
||||
.eqIfPresent("start_user_id", userId)
|
||||
.likeIfPresent("name", reqVO.getName())
|
||||
.eqIfPresent("process_definition_id", reqVO.getProcessDefinitionId())
|
||||
.eqIfPresent("category", reqVO.getCategory())
|
||||
.eqIfPresent("status", reqVO.getStatus())
|
||||
.eqIfPresent("result", reqVO.getResult())
|
||||
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByDesc("id"));
|
||||
}
|
||||
|
||||
default void updateByProcessInstanceId(BpmProcessInstanceExtDO updateObj) {
|
||||
update(updateObj, new QueryWrapper<BpmProcessInstanceExtDO>()
|
||||
.eq("process_instance_id", updateObj.getProcessInstanceId()));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.task;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.task.BpmTaskExtDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> {
|
||||
|
||||
default void updateByTaskId(BpmTaskExtDO entity) {
|
||||
update(entity, new QueryWrapper<BpmTaskExtDO>().eq("task_id", entity.getTaskId()));
|
||||
}
|
||||
|
||||
default List<BpmTaskExtDO> selectListByTaskIds(Collection<String> taskIds) {
|
||||
return selectList("task_id", taskIds);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.enums.task;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程实例的删除原因
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BpmProcessInstanceDeleteReasonEnum {
|
||||
|
||||
REJECT_TASK("驳回任务");
|
||||
|
||||
private final String reason;
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.enums.task;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程实例的结果
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BpmProcessInstanceResultEnum {
|
||||
|
||||
PROCESS(1, "处理中"),
|
||||
APPROVE(2, "通过"),
|
||||
REJECT(3, "不通过"),
|
||||
CANCEL(4, "已取消");
|
||||
|
||||
/**
|
||||
* 结果
|
||||
*/
|
||||
private final Integer result;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
}
|
||||
@ -1,29 +1,27 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.enums;
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.enums.task;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
* 流程实例的状态
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FlowStatusEnum {
|
||||
public enum BpmProcessInstanceStatusEnum {
|
||||
|
||||
HANDLE(1, "处理中"),
|
||||
|
||||
PASS(2, "审批通过"),
|
||||
|
||||
REJECTED(3, "审批不通过");
|
||||
RUNNING(1, "进行中"),
|
||||
FINISH(2, "已完成");
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private final Integer status;
|
||||
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.service.task.listener.BpmTackActivitiEventListener;
|
||||
import org.activiti.spring.SpringProcessEngineConfiguration;
|
||||
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* BPM 模块的 Activiti 配置类
|
||||
*/
|
||||
@Configuration
|
||||
public class BpmActivitiConfiguration implements ProcessEngineConfigurationConfigurer {
|
||||
|
||||
@Resource
|
||||
private BpmTackActivitiEventListener taskActivitiEventListener;
|
||||
|
||||
@Override
|
||||
public void configure(SpringProcessEngineConfiguration configuration) {
|
||||
// 注册监听器,例如说 BpmActivitiEventListener
|
||||
configuration.setEventListeners(Collections.singletonList(taskActivitiEventListener));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 属于 bpm 模块的 framework 封装
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.framework;
|
||||
@ -0,0 +1,28 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getMyProcessInstancePage(query) {
|
||||
return request({
|
||||
url: '/bpm/process-instance/my-page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function createProcessInstance(data) {
|
||||
return request({
|
||||
url: '/bpm/process-instance/create',
|
||||
method: 'POST',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function cancelProcessInstance(id, reason) {
|
||||
return request({
|
||||
url: '/bpm/process-instance/cancel',
|
||||
method: 'DELETE',
|
||||
data: {
|
||||
id,
|
||||
reason
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getTodoTaskPage(query) {
|
||||
return request({
|
||||
url: '/bpm/task/todo-page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getDoneTaskPage(query) {
|
||||
return request({
|
||||
url: '/bpm/task/done-page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function completeTask(data) {
|
||||
return request({
|
||||
url: '/bpm/task/complete',
|
||||
method: 'PUT',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function approveTask(data) {
|
||||
return request({
|
||||
url: '/bpm/task/approve',
|
||||
method: 'PUT',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function rejectTask(data) {
|
||||
return request({
|
||||
url: '/bpm/task/reject',
|
||||
method: 'PUT',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="流程名" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入流程名" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
|
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="任务编号" align="center" prop="id" width="320" fixed />
|
||||
<el-table-column label="任务名称" align="center" prop="name" width="200" />
|
||||
<el-table-column label="所属流程" align="center" prop="processInstance.name" width="200" />
|
||||
<el-table-column label="流程发起人" align="center" prop="processInstance.startUserNickname" />
|
||||
<el-table-column label="结果" align="center" prop="result">
|
||||
<template slot-scope="scope">
|
||||
<span>
|
||||
<el-tag type="primary" v-if="scope.row.result === 1"> <!-- 进行中 -->
|
||||
{{ getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, scope.row.result) }}
|
||||
</el-tag>
|
||||
<el-tag type="success" v-if="scope.row.result === 2"> <!-- 通过 -->
|
||||
{{ getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, scope.row.result) }}
|
||||
</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.result === 3"> <!-- 不通过 -->
|
||||
{{ getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, scope.row.result) }}
|
||||
</el-tag>
|
||||
<el-tag type="info" v-if="scope.row.result === 4"> <!-- 撤回 -->
|
||||
{{ getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, scope.row.result) }}
|
||||
</el-tag>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批意见" align="center" prop="comment" width="200" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批时间" align="center" prop="endTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.endTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="耗时" align="center" prop="durationInMillis" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ getDateStar(scope.row.durationInMillis) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- TODO 耗时 -->
|
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<!-- TODO 权限、颜色 -->
|
||||
<el-button size="mini" type="text" icon="el-icon-edit">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getDoneTaskPage} from '@/api/bpm/task'
|
||||
import {getDate} from "@/utils/dateUtils";
|
||||
|
||||
export default {
|
||||
name: "Done",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 待办任务列表
|
||||
list: [],
|
||||
// 查询参数
|
||||
dateRangeCreateTime: [],
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||
getDoneTaskPage(params).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.dateRangeCreateTime = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
getDateStar(ms) {
|
||||
return getDate(ms);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="流程名" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入流程名" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
|
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="任务编号" align="center" prop="id" width="320" />
|
||||
<el-table-column label="任务名称" align="center" prop="name" />
|
||||
<el-table-column label="所属流程" align="center" prop="processInstance.name" />
|
||||
<el-table-column label="流程发起人" align="center" prop="processInstance.startUserNickname" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="version" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" v-if="scope.row.suspensionState === 1">激活</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.suspensionState === 2">挂起</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<!-- TODO 权限、颜色 -->
|
||||
<el-button size="mini" type="text" icon="el-icon-edit">审批</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="audit(scope.row, true)">通过</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="audit(scope.row, false)">不通过</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" v-if="scope.row.suspensionState === 2">激活</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" v-if="scope.row.suspensionState === 1">挂起</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {approveTask, getTodoTaskPage, rejectTask} from '@/api/bpm/task'
|
||||
|
||||
export default {
|
||||
name: "Todo",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 待办任务列表
|
||||
list: [],
|
||||
// 查询参数
|
||||
dateRangeCreateTime: [],
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||
getTodoTaskPage(params).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.dateRangeCreateTime = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
audit(row, pass) {
|
||||
if (pass) {
|
||||
approveTask({
|
||||
id: row.id,
|
||||
comment: '通过'
|
||||
})
|
||||
} else {
|
||||
rejectTask({
|
||||
id: row.id,
|
||||
comment: '不通过'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@ -1,286 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="dict in leaveStatusData"
|
||||
:key="parseInt(dict.value)"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="任务Id" align="center" prop="id" />
|
||||
<el-table-column label="流程名称" align="center" prop="processName" />
|
||||
<el-table-column label="任务状态" align="center" :formatter="statusFormat" prop="status" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" v-if="scope.row.status == 1" @click="handleClaim(scope.row)">签收</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" v-if="scope.row.status == 2" @click="getTaskFormKey(scope.row)">办理</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-tabs tab-position="left" style="height: 500px;">
|
||||
<el-tab-pane label="详情">
|
||||
<el-form ref="form" :model="handleTask.formObject" label-width="80px">
|
||||
<el-form-item label="状态" >
|
||||
{{ getDictDataLabel(DICT_TYPE.OA_LEAVE_STATUS, handleTask.formObject.status) }}
|
||||
</el-form-item>
|
||||
<el-form-item label="申请人id" >{{handleTask.formObject.userId}}</el-form-item>
|
||||
<el-form-item label="开始时间" >{{ parseTime(handleTask.formObject.startTime) }}</el-form-item>
|
||||
<el-form-item label="结束时间" prop="endTime">{{ parseTime(handleTask.formObject.endTime) }}</el-form-item>
|
||||
<el-form-item label="请假类型" prop="leaveType">
|
||||
{{ getDictDataLabel(DICT_TYPE.OA_LEAVE_TYPE, handleTask.formObject.leaveType) }}
|
||||
</el-form-item>
|
||||
<el-form-item label="原因" prop="reason">{{handleTask.formObject.reason}}</el-form-item>
|
||||
<el-form-item label="申请时间" prop="applyTime">{{ parseTime(handleTask.formObject.applyTime) }}</el-form-item>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="任务处理">
|
||||
<el-steps :active="handleTask.historyTask.length-1" simple finish-status="success">
|
||||
<el-step :title="item.stepName" icon="el-icon-edit" v-for="(item) in handleTask.historyTask" ></el-step>
|
||||
</el-steps>
|
||||
<br/>
|
||||
<el-steps direction="vertical" :active="handleTask.historyTask.length-1" finish-status="success" space="60px">
|
||||
<el-step :title="item.stepName" :description="item.comment" v-for="(item) in handleTask.historyTask" ></el-step>
|
||||
</el-steps>
|
||||
<br/>
|
||||
<el-form ref="taskForm" :model="task" label-width="80px" v-show="handleTask.taskVariable !=''">
|
||||
<el-form-item label="处理意见" prop="approved">
|
||||
<el-select v-model="task.approved" placeholder="处理意见">
|
||||
<el-option
|
||||
v-for="dict in approvedData"
|
||||
:key="parseInt(dict.value)"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
v-model="task.comment">
|
||||
</el-input>
|
||||
</el-form>
|
||||
<br/>
|
||||
<el-button type="primary" @click="submitTask">提交</el-button>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { completeTask, taskSteps, getTaskFormKey,deleteLeave, getLeave, getTodoTaskPage, claimTask } from "@/api/oa/todo";
|
||||
import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
|
||||
export default {
|
||||
name: "Todo",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 请假申请列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
handleTask: {
|
||||
historyTask:[{
|
||||
stepName:"步骤一"
|
||||
}
|
||||
],
|
||||
taskVariable: "",
|
||||
formObject: {}
|
||||
},
|
||||
steps:[{
|
||||
stepName:"步骤一"
|
||||
}],
|
||||
task: {
|
||||
approved : 1,
|
||||
variables: {},
|
||||
taskId: undefined,
|
||||
comment: ""
|
||||
},
|
||||
rules: {
|
||||
},
|
||||
leaveTypeDictData: getDictDatas(DICT_TYPE.OA_LEAVE_TYPE),
|
||||
leaveStatusData: getDictDatas(DICT_TYPE.OA_LEAVE_STATUS),
|
||||
approvedData: [
|
||||
{
|
||||
value: 1,
|
||||
label: '同意'
|
||||
},
|
||||
{
|
||||
value: 0,
|
||||
label: '不同意'
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
// 执行查询
|
||||
getTodoTaskPage(params).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
processInstanceId: undefined,
|
||||
status: undefined,
|
||||
userId: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
leaveType: undefined,
|
||||
reason: undefined,
|
||||
applyTime: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
||||
statusFormat(row, column) {
|
||||
return row.status == 1 ? "未签收" : "已签收";
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.dateRangeStartTime = [];
|
||||
this.dateRangeEndTime = [];
|
||||
this.dateRangeApplyTime = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
getTaskFormKey(row) {
|
||||
const taskId = row.id;
|
||||
const data = {
|
||||
taskId : taskId
|
||||
}
|
||||
getTaskFormKey(data).then(response => {
|
||||
const resp = response.data;
|
||||
const path = resp.formKey;
|
||||
const taskId = resp.id;
|
||||
const businessKey = resp.businessKey;
|
||||
const route = {
|
||||
path: path,
|
||||
query: {
|
||||
businessKey: businessKey,
|
||||
taskId:taskId,
|
||||
processInstanceId : resp.processInstanceId
|
||||
}
|
||||
}
|
||||
this.$router.replace(route);
|
||||
});
|
||||
},
|
||||
handleLeaveApprove(row) {
|
||||
this.reset();
|
||||
const businessKey = row.businessKey;
|
||||
const taskId = row.id;
|
||||
const processKey = row.processKey;
|
||||
const data = {
|
||||
taskId : taskId,
|
||||
businessKey: businessKey,
|
||||
processKey: processKey
|
||||
}
|
||||
taskSteps(data).then(response => {
|
||||
this.form = {};
|
||||
this.handleTask = response.data;
|
||||
this.task.taskId = taskId;
|
||||
this.open = true;
|
||||
this.title = "任务办理";
|
||||
});
|
||||
},
|
||||
/** 任务签收操作 */
|
||||
handleClaim(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
claimTask(id).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("签收成功");
|
||||
});
|
||||
},
|
||||
/** 提交任务 */
|
||||
submitTask() {
|
||||
const taskVariableName = this.handleTask.taskVariable;
|
||||
if (taskVariableName != "") {
|
||||
if (this.task.approved == 1) {
|
||||
this.task.variables[taskVariableName] = true;
|
||||
}
|
||||
if (this.task.approved == 0) {
|
||||
this.task.variables[taskVariableName] = false;
|
||||
}
|
||||
}
|
||||
completeTask(this.task).then(response => {
|
||||
this.msgSuccess("执行任务成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$confirm('是否确认删除请假申请编号为"' + id + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return deleteLeave(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Loading…
Reference in New Issue