add -- 添加"委派"和"转办"操作,修改流转记录显示方式
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.web.controller.workflow;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
@@ -135,14 +136,20 @@ public class WfTaskController {
|
||||
@ApiOperation(value = "委派任务")
|
||||
@PostMapping(value = "/delegate")
|
||||
public R delegate(@RequestBody WfTaskBo bo) {
|
||||
if (ObjectUtil.hasNull(bo.getTaskId(), bo.getUserId())) {
|
||||
return R.fail("参数错误!");
|
||||
}
|
||||
flowTaskService.delegateTask(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "转办任务")
|
||||
@PostMapping(value = "/assign")
|
||||
public R assign(@RequestBody WfTaskBo bo) {
|
||||
flowTaskService.assignTask(bo);
|
||||
@PostMapping(value = "/transfer")
|
||||
public R transfer(@RequestBody WfTaskBo bo) {
|
||||
if (ObjectUtil.hasNull(bo.getTaskId(), bo.getUserId())) {
|
||||
return R.fail("参数错误!");
|
||||
}
|
||||
flowTaskService.transferTask(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ public enum FlowComment {
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
NORMAL("1", "正常意见"),
|
||||
REBACK("2", "退回意见"),
|
||||
REJECT("3", "驳回意见"),
|
||||
DELEGATE("4", "委派意见"),
|
||||
ASSIGN("5", "转办意见"),
|
||||
STOP("6", "终止流程");
|
||||
NORMAL("1", "正常"),
|
||||
REBACK("2", "退回"),
|
||||
REJECT("3", "驳回"),
|
||||
DELEGATE("4", "委派"),
|
||||
TRANSFER("5", "转办"),
|
||||
STOP("6", "终止");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ruoyi.workflow.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author konbai
|
||||
* @createTime 2022/4/4 02:03
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("流程批复视图对象")
|
||||
public class WfCommentVo {
|
||||
|
||||
/**
|
||||
* 审批类别
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 批复内容
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 批复时间
|
||||
*/
|
||||
private Date time;
|
||||
|
||||
|
||||
}
|
||||
@@ -6,9 +6,11 @@ import com.ruoyi.workflow.domain.dto.WfCommentDto;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.flowable.engine.task.Comment;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工作流任务视图对象
|
||||
@@ -84,6 +86,9 @@ public class WfTaskVo implements Serializable {
|
||||
@ApiModelProperty("任务意见")
|
||||
private WfCommentDto comment;
|
||||
|
||||
@ApiModelProperty("任务意见")
|
||||
private List<Comment> commentList;
|
||||
|
||||
@ApiModelProperty("候选执行人")
|
||||
private String candidate;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public interface IWfTaskService {
|
||||
*
|
||||
* @param bo 请求实体参数
|
||||
*/
|
||||
void assignTask(WfTaskBo bo);
|
||||
void transferTask(WfTaskBo bo);
|
||||
|
||||
/**
|
||||
* 我发起的流程
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.workflow.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.BetweenFormatter;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -13,7 +14,6 @@ import com.ruoyi.flowable.factory.FlowServiceFactory;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.workflow.domain.bo.WfTaskBo;
|
||||
import com.ruoyi.workflow.domain.dto.WfCommentDto;
|
||||
import com.ruoyi.workflow.domain.vo.WfFormVo;
|
||||
import com.ruoyi.workflow.domain.vo.WfTaskVo;
|
||||
import com.ruoyi.workflow.service.IWfDeployFormService;
|
||||
@@ -21,11 +21,11 @@ import com.ruoyi.workflow.service.IWfInstanceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
|
||||
import org.flowable.engine.history.HistoricActivityInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.task.Comment;
|
||||
import org.flowable.identitylink.api.history.HistoricIdentityLink;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -130,58 +130,61 @@ public class WfInstanceServiceImpl extends FlowServiceFactory implements IWfInst
|
||||
public Map<String, Object> queryDetailProcess(String procInsId, String deployId) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (StringUtils.isNotBlank(procInsId)) {
|
||||
List<HistoricActivityInstance> list = historyService
|
||||
.createHistoricActivityInstanceQuery()
|
||||
List<HistoricTaskInstance> taskInstanceList = historyService.createHistoricTaskInstanceQuery()
|
||||
.processInstanceId(procInsId)
|
||||
.orderByHistoricActivityInstanceStartTime()
|
||||
.desc().list();
|
||||
List<WfTaskVo> hisFlowList = new ArrayList<>();
|
||||
for (HistoricActivityInstance histIns : list) {
|
||||
if (StringUtils.isNotBlank(histIns.getTaskId())) {
|
||||
WfTaskVo flowTask = new WfTaskVo();
|
||||
flowTask.setProcDefId(histIns.getProcessDefinitionId());
|
||||
flowTask.setTaskId(histIns.getTaskId());
|
||||
flowTask.setTaskName(histIns.getActivityName());
|
||||
flowTask.setCreateTime(histIns.getStartTime());
|
||||
flowTask.setFinishTime(histIns.getEndTime());
|
||||
if (StringUtils.isNotBlank(histIns.getAssignee())) {
|
||||
SysUser user = userService.selectUserById(Long.parseLong(histIns.getAssignee()));
|
||||
flowTask.setAssigneeId(user.getUserId());
|
||||
flowTask.setAssigneeName(user.getNickName());
|
||||
flowTask.setDeptName(user.getDept().getDeptName());
|
||||
}
|
||||
// 展示审批人员
|
||||
List<HistoricIdentityLink> linksForTask = historyService.getHistoricIdentityLinksForTask(histIns.getTaskId());
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (HistoricIdentityLink identityLink : linksForTask) {
|
||||
if ("candidate".equals(identityLink.getType())) {
|
||||
if (StringUtils.isNotBlank(identityLink.getUserId())) {
|
||||
SysUser user = userService.selectUserById(Long.parseLong(identityLink.getUserId()));
|
||||
stringBuilder.append(user.getNickName()).append(",");
|
||||
}
|
||||
if (StringUtils.isNotBlank(identityLink.getGroupId())) {
|
||||
SysRole role = roleService.selectRoleById(Long.parseLong(identityLink.getGroupId()));
|
||||
stringBuilder.append(role.getRoleName()).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(stringBuilder)) {
|
||||
flowTask.setCandidate(stringBuilder.substring(0, stringBuilder.length() - 1));
|
||||
}
|
||||
if (ObjectUtil.isNotNull(histIns.getDurationInMillis())) {
|
||||
flowTask.setDuration(DateUtil.formatBetween(histIns.getDurationInMillis(), BetweenFormatter.Level.SECOND));
|
||||
}
|
||||
// 获取意见评论内容
|
||||
List<Comment> commentList = taskService.getProcessInstanceComments(histIns.getProcessInstanceId());
|
||||
commentList.forEach(comment -> {
|
||||
if (histIns.getTaskId().equals(comment.getTaskId())) {
|
||||
flowTask.setComment(WfCommentDto.builder().type(comment.getType()).comment(comment.getFullMessage()).build());
|
||||
}
|
||||
});
|
||||
hisFlowList.add(flowTask);
|
||||
.orderByHistoricTaskInstanceStartTime().desc()
|
||||
.list();
|
||||
List<Comment> commentList = taskService.getProcessInstanceComments(procInsId);
|
||||
List<WfTaskVo> taskVoList = new ArrayList<>(taskInstanceList.size());
|
||||
taskInstanceList.forEach(taskInstance -> {
|
||||
WfTaskVo taskVo = new WfTaskVo();
|
||||
taskVo.setProcDefId(taskInstance.getProcessDefinitionId());
|
||||
taskVo.setTaskId(taskInstance.getId());
|
||||
taskVo.setTaskName(taskInstance.getName());
|
||||
taskVo.setCreateTime(taskInstance.getStartTime());
|
||||
taskVo.setFinishTime(taskInstance.getEndTime());
|
||||
if (StringUtils.isNotBlank(taskInstance.getAssignee())) {
|
||||
SysUser user = userService.selectUserById(Long.parseLong(taskInstance.getAssignee()));
|
||||
taskVo.setAssigneeId(user.getUserId());
|
||||
taskVo.setAssigneeName(user.getNickName());
|
||||
taskVo.setDeptName(user.getDept().getDeptName());
|
||||
}
|
||||
}
|
||||
map.put("flowList", hisFlowList);
|
||||
// 展示审批人员
|
||||
List<HistoricIdentityLink> linksForTask = historyService.getHistoricIdentityLinksForTask(taskInstance.getId());
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (HistoricIdentityLink identityLink : linksForTask) {
|
||||
if ("candidate".equals(identityLink.getType())) {
|
||||
if (StringUtils.isNotBlank(identityLink.getUserId())) {
|
||||
SysUser user = userService.selectUserById(Long.parseLong(identityLink.getUserId()));
|
||||
stringBuilder.append(user.getNickName()).append(",");
|
||||
}
|
||||
if (StringUtils.isNotBlank(identityLink.getGroupId())) {
|
||||
SysRole role = roleService.selectRoleById(Long.parseLong(identityLink.getGroupId()));
|
||||
stringBuilder.append(role.getRoleName()).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(stringBuilder)) {
|
||||
taskVo.setCandidate(stringBuilder.substring(0, stringBuilder.length() - 1));
|
||||
}
|
||||
if (ObjectUtil.isNotNull(taskInstance.getDurationInMillis())) {
|
||||
taskVo.setDuration(DateUtil.formatBetween(taskInstance.getDurationInMillis(), BetweenFormatter.Level.SECOND));
|
||||
}
|
||||
// 获取意见评论内容
|
||||
if (CollUtil.isNotEmpty(commentList)) {
|
||||
List<Comment> comments = new ArrayList<>();
|
||||
// commentList.stream().filter(comment -> taskInstance.getId().equals(comment.getTaskId())).collect(Collectors.toList());
|
||||
for (Comment comment : commentList) {
|
||||
if (comment.getTaskId().equals(taskInstance.getId())) {
|
||||
comments.add(comment);
|
||||
// taskVo.setComment(WfCommentDto.builder().type(comment.getType()).comment(comment.getFullMessage()).build());
|
||||
}
|
||||
}
|
||||
taskVo.setCommentList(comments);
|
||||
}
|
||||
taskVoList.add(taskVo);
|
||||
});
|
||||
map.put("flowList", taskVoList);
|
||||
// // 查询当前任务是否完成
|
||||
// List<Task> taskList = taskService.createTaskQuery().processInstanceId(procInsId).list();
|
||||
// if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.JsonUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.flowable.common.constant.ProcessConstants;
|
||||
import com.ruoyi.flowable.common.enums.FlowComment;
|
||||
import com.ruoyi.flowable.factory.FlowServiceFactory;
|
||||
@@ -33,7 +34,6 @@ import com.ruoyi.workflow.service.IWfTaskService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.bpmn.model.*;
|
||||
import org.flowable.common.engine.api.FlowableException;
|
||||
@@ -84,26 +84,26 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
|
||||
/**
|
||||
* 完成任务
|
||||
*
|
||||
* @param taskVo 请求实体参数
|
||||
* @param taskBo 请求实体参数
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void complete(WfTaskBo taskVo) {
|
||||
Task task = taskService.createTaskQuery().taskId(taskVo.getTaskId()).singleResult();
|
||||
public void complete(WfTaskBo taskBo) {
|
||||
Task task = taskService.createTaskQuery().taskId(taskBo.getTaskId()).singleResult();
|
||||
if (Objects.isNull(task)) {
|
||||
throw new ServiceException("任务不存在");
|
||||
}
|
||||
if (DelegationState.PENDING.equals(task.getDelegationState())) {
|
||||
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment());
|
||||
taskService.resolveTask(taskVo.getTaskId(), taskVo.getValues());
|
||||
taskService.addComment(taskBo.getTaskId(), taskBo.getInstanceId(), FlowComment.DELEGATE.getType(), taskBo.getComment());
|
||||
taskService.resolveTask(taskBo.getTaskId(), taskBo.getValues());
|
||||
} else {
|
||||
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment());
|
||||
taskService.addComment(taskBo.getTaskId(), taskBo.getInstanceId(), FlowComment.NORMAL.getType(), taskBo.getComment());
|
||||
Long userId = LoginHelper.getUserId();
|
||||
taskService.setAssignee(taskVo.getTaskId(), userId.toString());
|
||||
if (ObjectUtil.isNotEmpty(taskVo.getValues())) {
|
||||
taskService.complete(taskVo.getTaskId(), taskVo.getValues());
|
||||
taskService.setAssignee(taskBo.getTaskId(), userId.toString());
|
||||
if (ObjectUtil.isNotEmpty(taskBo.getValues())) {
|
||||
taskService.complete(taskBo.getTaskId(), taskBo.getValues());
|
||||
} else {
|
||||
taskService.complete(taskVo.getTaskId());
|
||||
taskService.complete(taskBo.getTaskId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,11 +115,14 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
|
||||
*/
|
||||
@Override
|
||||
public void taskReject(WfTaskBo bo) {
|
||||
if (taskService.createTaskQuery().taskId(bo.getTaskId()).singleResult().isSuspended()) {
|
||||
throw new RuntimeException("任务处于挂起状态");
|
||||
}
|
||||
// 当前任务 task
|
||||
Task task = taskService.createTaskQuery().taskId(bo.getTaskId()).singleResult();
|
||||
if (ObjectUtil.isNull(task)) {
|
||||
throw new RuntimeException("获取任务信息异常!");
|
||||
}
|
||||
if (task.isSuspended()) {
|
||||
throw new RuntimeException("任务处于挂起状态");
|
||||
}
|
||||
// 获取流程定义信息
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
|
||||
// 获取所有节点信息
|
||||
@@ -240,11 +243,14 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void taskReturn(WfTaskBo bo) {
|
||||
if (taskService.createTaskQuery().taskId(bo.getTaskId()).singleResult().isSuspended()) {
|
||||
throw new RuntimeException("任务处于挂起状态");
|
||||
}
|
||||
// 当前任务 task
|
||||
Task task = taskService.createTaskQuery().taskId(bo.getTaskId()).singleResult();
|
||||
if (ObjectUtil.isNull(task)) {
|
||||
throw new RuntimeException("获取任务信息异常!");
|
||||
}
|
||||
if (task.isSuspended()) {
|
||||
throw new RuntimeException("任务处于挂起状态");
|
||||
}
|
||||
// 获取流程定义信息
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
|
||||
// 获取所有节点信息
|
||||
@@ -394,7 +400,28 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delegateTask(WfTaskBo bo) {
|
||||
taskService.delegateTask(bo.getTaskId(), bo.getAssignee());
|
||||
// 当前任务 task
|
||||
Task task = taskService.createTaskQuery().taskId(bo.getTaskId()).singleResult();
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new ServiceException("获取任务失败!");
|
||||
}
|
||||
StringBuilder commentBuilder = new StringBuilder(LoginHelper.getNickName())
|
||||
.append("->");
|
||||
SysUser user = sysUserService.selectUserById(Long.parseLong(bo.getUserId()));
|
||||
if (ObjectUtil.isNotNull(user)) {
|
||||
commentBuilder.append(user.getNickName());
|
||||
} else {
|
||||
commentBuilder.append(bo.getUserId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getComment())) {
|
||||
commentBuilder.append(": ").append(bo.getComment());
|
||||
}
|
||||
// 添加审批意见
|
||||
taskService.addComment(bo.getTaskId(), task.getProcessInstanceId(), FlowComment.DELEGATE.getType(), commentBuilder.toString());
|
||||
// 设置办理人为当前登录人
|
||||
taskService.setOwner(bo.getTaskId(), LoginHelper.getUserId().toString());
|
||||
// 执行委派
|
||||
taskService.delegateTask(bo.getTaskId(), bo.getUserId());
|
||||
}
|
||||
|
||||
|
||||
@@ -405,8 +432,29 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void assignTask(WfTaskBo bo) {
|
||||
taskService.setAssignee(bo.getTaskId(), bo.getComment());
|
||||
public void transferTask(WfTaskBo bo) {
|
||||
// 当前任务 task
|
||||
Task task = taskService.createTaskQuery().taskId(bo.getTaskId()).singleResult();
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new ServiceException("获取任务失败!");
|
||||
}
|
||||
StringBuilder commentBuilder = new StringBuilder(LoginHelper.getNickName())
|
||||
.append("->");
|
||||
SysUser user = sysUserService.selectUserById(Long.parseLong(bo.getUserId()));
|
||||
if (ObjectUtil.isNotNull(user)) {
|
||||
commentBuilder.append(user.getNickName());
|
||||
} else {
|
||||
commentBuilder.append(bo.getUserId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getComment())) {
|
||||
commentBuilder.append(": ").append(bo.getComment());
|
||||
}
|
||||
// 添加审批意见
|
||||
taskService.addComment(bo.getTaskId(), task.getProcessInstanceId(), FlowComment.TRANSFER.getType(), commentBuilder.toString());
|
||||
// 设置拥有者为当前登录人
|
||||
taskService.setOwner(bo.getTaskId(), LoginHelper.getUserId().toString());
|
||||
// 转办任务
|
||||
taskService.setAssignee(bo.getTaskId(), bo.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,15 @@ export function delegate(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 转办任务
|
||||
export function transfer(data) {
|
||||
return request({
|
||||
url: '/workflow/task/transfer',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 退回任务
|
||||
export function returnTask(data) {
|
||||
return request({
|
||||
|
||||
@@ -12,18 +12,27 @@
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="6" :offset="8">
|
||||
<el-button icon="el-icon-edit-outline" type="success" @click="handleComplete">通过</el-button>
|
||||
<!-- <el-button icon="el-icon-edit-outline" type="primary" @click="handleDelegate">委派</el-button>-->
|
||||
<!-- <el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleAssign">转办</el-button>-->
|
||||
<!-- <el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleDelegate">签收</el-button>-->
|
||||
<el-row :gutter="10" type="flex" justify="center" >
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="el-icon-circle-check" type="success" @click="handleComplete">通过</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="el-icon-chat-line-square" type="primary" @click="handleDelegate">委派</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="el-icon-thumb" type="success" @click="handleTransfer">转办</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="2">-->
|
||||
<!-- <el-button icon="el-icon-edit-outline" type="primary"" @click="handle">签收</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="el-icon-refresh-left" type="warning" @click="handleReturn">退回</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="el-icon-circle-close" type="danger" @click="handleReject">驳回</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<!-- </div>-->
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="表单信息">
|
||||
<el-card class="box-card" shadow="never">
|
||||
@@ -42,44 +51,29 @@
|
||||
</el-col>
|
||||
</el-card>
|
||||
</el-tab-pane >
|
||||
|
||||
<el-tab-pane label="流转记录">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<el-col :span="16" :offset="4">
|
||||
<el-col :span="18" :offset="3">
|
||||
<div class="block">
|
||||
<el-timeline>
|
||||
<el-timeline-item v-for="(item,index ) in flowRecordList" :key="index" :icon="setIcon(item.finishTime)" :color="setColor(item.finishTime)">
|
||||
<el-timeline-item v-for="(item,index) in flowRecordList" :key="index" :icon="setIcon(item.finishTime)" :color="setColor(item.finishTime)">
|
||||
<p style="font-weight: 700">{{ item.taskName }}</p>
|
||||
<el-card :body-style="{ padding: '10px' }">
|
||||
<label v-if="item.assigneeName" style="font-weight: normal;margin-right: 30px;">实际办理:
|
||||
{{ item.assigneeName }}
|
||||
<el-tag type="info" size="mini">{{ item.deptName }}</el-tag>
|
||||
</label>
|
||||
<label v-if="item.candidate" style="font-weight: normal;margin-right: 30px;">
|
||||
候选办理: {{ item.candidate }}
|
||||
</label>
|
||||
<label style="font-weight: normal">
|
||||
接收时间:
|
||||
</label>
|
||||
<label style="color:#8a909c;font-weight: normal">
|
||||
{{ item.createTime }}
|
||||
</label>
|
||||
<label v-if="item.finishTime" style="margin-left: 30px;font-weight: normal">
|
||||
办结时间:
|
||||
</label>
|
||||
<label style="color:#8a909c;font-weight: normal">
|
||||
{{ item.finishTime }}
|
||||
</label>
|
||||
<label v-if="item.duration" style="margin-left: 30px;font-weight: normal">
|
||||
耗时:
|
||||
</label>
|
||||
<label style="color:#8a909c;font-weight: normal">
|
||||
{{ item.duration }}
|
||||
</label>
|
||||
<p v-if="item.comment">
|
||||
<el-tag type="success" v-if="item.comment.type === '1'"> {{ item.comment.comment }}</el-tag>
|
||||
<el-tag type="warning" v-if="item.comment.type === '2'"> {{ item.comment.comment }}</el-tag>
|
||||
<el-tag type="danger" v-if="item.comment.type === '3'"> {{ item.comment.comment }}</el-tag>
|
||||
</p>
|
||||
<el-card class="box-card" shadow="hover">
|
||||
<el-descriptions column="5" :labelStyle="{'font-weight': 'bold'}">
|
||||
<el-descriptions-item label="实际办理">{{ item.assigneeName || '-'}}</el-descriptions-item>
|
||||
<el-descriptions-item label="候选办理">{{ item.candidate || '-'}}</el-descriptions-item>
|
||||
<el-descriptions-item label="接收时间">{{ item.createTime || '-'}}</el-descriptions-item>
|
||||
<el-descriptions-item label="办结时间">{{ item.finishTime || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="耗时">{{ item.duration || '-'}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div v-if="item.commentList && item.commentList.length > 0" v-for="comment in item.commentList">
|
||||
<el-divider content-position="left">
|
||||
<el-tag :type="approveTypeTag(comment.type)" size="mini">{{ commentType(comment.type) }}</el-tag>
|
||||
<el-tag type="info" effect="plain" size="mini">{{ comment.time }}</el-tag>
|
||||
</el-divider>
|
||||
<span>{{ comment.fullMessage }}</span>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
@@ -87,6 +81,7 @@
|
||||
</el-col>
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="流程跟踪">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<process-viewer :key="`designer-${loadIndex}`" :style="'height:' + height" :xml="xmlData"
|
||||
@@ -110,12 +105,58 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="returnOpen = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitReturn">确 定</el-button>
|
||||
</span>
|
||||
<el-button @click="returnOpen = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitReturn">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<el-dialog :title="userDialogTitle" :visible.sync="userOpen" width="60%" append-to-body>
|
||||
<el-row type="flex" :gutter="20">
|
||||
<!--部门数据-->
|
||||
<el-col :span="5">
|
||||
<el-card shadow="never" style="height: 100%">
|
||||
<div slot="header">
|
||||
<span>部门列表</span>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search"/>
|
||||
<el-tree
|
||||
:data="deptOptions"
|
||||
:props="deptProps"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
default-expand-all
|
||||
@node-click="handleNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<el-table ref="userTable" height="500" :data="userList" highlight-current-row @current-change="changeCurrentUser">
|
||||
<el-table-column width="30">
|
||||
<template slot-scope="scope">
|
||||
<el-radio :label="scope.row.userId" v-model="currentUserId">{{''}}</el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户名" align="center" prop="nickName" />
|
||||
<el-table-column label="手机" align="center" prop="phonenumber" />
|
||||
<el-table-column label="部门" align="center" prop="dept.deptName" />
|
||||
</el-table>
|
||||
<pagination
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="userOpen = false">取 消</el-button>
|
||||
<el-button type="primary" v-if="userDialogTitle === '委派任务'" @click="submitDelegate">确 定</el-button>
|
||||
<el-button type="primary" v-if="userDialogTitle === '转办任务'" @click="submitTransfer">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -123,7 +164,7 @@
|
||||
import { getDetailInstance } from '@/api/workflow/instance'
|
||||
import Parser from '@/utils/generator/parser'
|
||||
import { definitionStart, getFlowViewer, getProcessVariables, readXml } from '@/api/workflow/definition'
|
||||
import { complete, delegate, getNextFlowNode, rejectTask, returnList, returnTask } from '@/api/workflow/todo'
|
||||
import { complete, delegate, transfer,getNextFlowNode, rejectTask, returnList, returnTask } from '@/api/workflow/todo'
|
||||
import { treeselect } from '@/api/system/dept'
|
||||
import ProcessViewer from '@/components/ProcessViewer'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
@@ -138,6 +179,30 @@ export default {
|
||||
Treeselect
|
||||
},
|
||||
props: {},
|
||||
computed: {
|
||||
commentType() {
|
||||
return val => {
|
||||
switch (val) {
|
||||
case '1': return '通过'
|
||||
case '2': return '退回'
|
||||
case '3': return '驳回'
|
||||
case '4': return '委派'
|
||||
case '5': return '转办'
|
||||
}
|
||||
}
|
||||
},
|
||||
approveTypeTag() {
|
||||
return val => {
|
||||
switch (val) {
|
||||
case '1': return 'success'
|
||||
case '2': return 'warning'
|
||||
case '3': return 'danger'
|
||||
case '4': return 'primary'
|
||||
case '5': return 'success'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
height: document.documentElement.clientHeight - 205 + 'px;',
|
||||
@@ -165,6 +230,7 @@ export default {
|
||||
queryParams: {
|
||||
deptId: undefined
|
||||
},
|
||||
total: 0,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
flowRecordList: [],
|
||||
@@ -188,6 +254,7 @@ export default {
|
||||
rules: {
|
||||
comment: [{ required: true, message: '请输入审批意见', trigger: 'blur' }],
|
||||
},
|
||||
currentUserId: null,
|
||||
userDataList:[], // 流程候选人
|
||||
assignee: null,
|
||||
formConf: {}, // 默认表单数据
|
||||
@@ -201,7 +268,8 @@ export default {
|
||||
returnOpen: false,
|
||||
rejectOpen: false,
|
||||
rejectTitle: null,
|
||||
delegateOpen: false,
|
||||
userDialogTitle: '',
|
||||
userOpen: false,
|
||||
userData:[],
|
||||
};
|
||||
},
|
||||
@@ -321,6 +389,7 @@ export default {
|
||||
const params = {procInsId: procInsId, deployId: deployId}
|
||||
getDetailInstance(params).then(res => {
|
||||
this.flowRecordList = res.data.flowList;
|
||||
console.log("res flowList => ", this.flowRecordList)
|
||||
// 流程过程中不存在初始化表单 直接读取的流程变量中存储的表单值
|
||||
if (res.data.formData) {
|
||||
this.formConf = res.data.formData;
|
||||
@@ -386,7 +455,26 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** 委派任务 */
|
||||
handleDelegate() {
|
||||
this.$refs["taskForm"].validate(valid => {
|
||||
if (valid) {
|
||||
this.userDialogTitle = '委派任务'
|
||||
this.userOpen = true;
|
||||
this.getTreeSelect();
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 转办任务 */
|
||||
handleTransfer(){
|
||||
this.$refs["taskForm"].validate(valid => {
|
||||
if (valid) {
|
||||
this.userDialogTitle = '转办任务'
|
||||
this.userOpen = true;
|
||||
this.getTreeSelect();
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 驳回任务 */
|
||||
handleReject() {
|
||||
this.$refs["taskForm"].validate(valid => {
|
||||
@@ -398,8 +486,8 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
handleAssign(){
|
||||
|
||||
changeCurrentUser(val) {
|
||||
this.currentUserId = val.userId
|
||||
},
|
||||
/** 返回页面 */
|
||||
goBack() {
|
||||
@@ -446,6 +534,36 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
submitDelegate() {
|
||||
if (!this.taskForm.comment) {
|
||||
this.$modal.msgError("请输入审批意见");
|
||||
return false;
|
||||
}
|
||||
if (!this.currentUserId) {
|
||||
this.$modal.msgError("请选择委派用户");
|
||||
return false;
|
||||
}
|
||||
this.taskForm.userId = this.currentUserId;
|
||||
delegate(this.taskForm).then(res => {
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.goBack();
|
||||
});
|
||||
},
|
||||
submitTransfer() {
|
||||
if (!this.taskForm.comment) {
|
||||
this.$modal.msgError("请输入审批意见");
|
||||
return false;
|
||||
}
|
||||
if (!this.currentUserId) {
|
||||
this.$modal.msgError("请选择受理用户");
|
||||
return false;
|
||||
}
|
||||
this.taskForm.userId = this.currentUserId;
|
||||
transfer(this.taskForm).then(res => {
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.goBack();
|
||||
});
|
||||
},
|
||||
/** 可退回任务列表 */
|
||||
handleReturn() {
|
||||
this.$refs['taskForm'].validate(valid => {
|
||||
@@ -473,32 +591,7 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 取消回退任务按钮 */
|
||||
cancelTask() {
|
||||
this.taskForm.returnTaskShow = false;
|
||||
this.taskForm.defaultTaskShow = true;
|
||||
this.taskForm.sendUserShow = true;
|
||||
this.returnTaskList = [];
|
||||
},
|
||||
/** 委派任务 */
|
||||
submitDeleteTask() {
|
||||
this.$refs["taskForm"].validate(valid => {
|
||||
if (valid) {
|
||||
delegate(this.taskForm).then(response => {
|
||||
this.$modal.msgSuccess(response.msg);
|
||||
this.goBack();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 取消回退任务按钮 */
|
||||
cancelDelegateTask() {
|
||||
this.taskForm.delegateTaskOpen = false;
|
||||
this.taskForm.defaultTaskShow = true;
|
||||
this.taskForm.sendUserShow = true;
|
||||
this.returnTaskList = [];
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user