fix -- 修复我的流程跳转后表单内容为空,优化流程详情页面显示布局。
This commit is contained in:
@@ -11,8 +11,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作流流程实例管理
|
||||
*
|
||||
@@ -26,29 +24,20 @@ import java.util.Map;
|
||||
@RequestMapping("/workflow/instance")
|
||||
public class WfInstanceController {
|
||||
|
||||
private final IWfInstanceService flowInstanceService;
|
||||
|
||||
@ApiOperation(value = "根据流程定义id启动流程实例")
|
||||
@PostMapping("/startBy/{procDefId}")
|
||||
public R startById(@ApiParam(value = "流程定义id") @PathVariable(value = "procDefId") String procDefId,
|
||||
@ApiParam(value = "变量集合,json对象") @RequestBody Map<String, Object> variables) {
|
||||
flowInstanceService.startProcessInstanceById(procDefId, variables);
|
||||
return R.ok("流程启动成功");
|
||||
}
|
||||
|
||||
private final IWfInstanceService instanceService;
|
||||
|
||||
@ApiOperation(value = "激活或挂起流程实例")
|
||||
@PostMapping(value = "/updateState")
|
||||
public R updateState(@ApiParam(value = "1:激活,2:挂起", required = true) @RequestParam Integer state,
|
||||
@ApiParam(value = "流程实例ID", required = true) @RequestParam String instanceId) {
|
||||
flowInstanceService.updateState(state, instanceId);
|
||||
instanceService.updateState(state, instanceId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("结束流程实例")
|
||||
@PostMapping(value = "/stopProcessInstance")
|
||||
public R stopProcessInstance(@RequestBody WfTaskBo bo) {
|
||||
flowInstanceService.stopProcessInstance(bo);
|
||||
instanceService.stopProcessInstance(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -56,7 +45,13 @@ public class WfInstanceController {
|
||||
@DeleteMapping(value = "/delete")
|
||||
public R delete(@ApiParam(value = "流程实例ID", required = true) @RequestParam String instanceId,
|
||||
@ApiParam(value = "删除原因") @RequestParam(required = false) String deleteReason) {
|
||||
flowInstanceService.delete(instanceId, deleteReason);
|
||||
instanceService.delete(instanceId, deleteReason);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询流程实例详情信息")
|
||||
@GetMapping("/detail")
|
||||
public R detail(String procInsId, String deployId) {
|
||||
return R.ok(instanceService.queryDetailProcess(procInsId, deployId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.workflow.domain.vo.WfDefinitionVo;
|
||||
import com.ruoyi.workflow.domain.vo.WfTaskVo;
|
||||
import com.ruoyi.workflow.service.IWfProcessService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -47,4 +48,10 @@ public class WfProcessController extends BaseController {
|
||||
return R.ok("流程启动成功");
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "我拥有的流程", response = WfTaskVo.class)
|
||||
@GetMapping(value = "/own")
|
||||
public TableDataInfo<WfTaskVo> ownProcess(PageQuery pageQuery) {
|
||||
return processService.queryPageOwnProcessList(pageQuery);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class WfTaskController {
|
||||
|
||||
private final IWfTaskService flowTaskService;
|
||||
|
||||
@Deprecated
|
||||
@ApiOperation(value = "我发起的流程", response = WfTaskVo.class)
|
||||
@GetMapping(value = "/myProcess")
|
||||
public TableDataInfo<WfTaskVo> myProcess(PageQuery pageQuery) {
|
||||
@@ -62,6 +63,7 @@ public class WfTaskController {
|
||||
return flowTaskService.todoList(pageQuery);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiOperation(value = "获取已办任务", response = WfTaskVo.class)
|
||||
@GetMapping(value = "/finishedList")
|
||||
public TableDataInfo<WfTaskVo> finishedList(PageQuery pageQuery) {
|
||||
|
||||
@@ -46,12 +46,11 @@ public interface IWfInstanceService {
|
||||
*/
|
||||
HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据流程定义ID启动流程实例
|
||||
*
|
||||
* @param procDefId 流程定义Id
|
||||
* @param variables 流程变量
|
||||
* @return
|
||||
* 查询流程详情信息
|
||||
* @param procInsId 流程实例ID
|
||||
* @param deployId 流程部署ID
|
||||
*/
|
||||
void startProcessInstanceById(String procDefId, Map<String, Object> variables);
|
||||
Map<String, Object> queryDetailProcess(String procInsId, String deployId);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.workflow.service;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.workflow.domain.vo.WfDefinitionVo;
|
||||
import com.ruoyi.workflow.domain.vo.WfTaskVo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -32,4 +33,11 @@ public interface IWfProcessService {
|
||||
* @param variables 扩展参数
|
||||
*/
|
||||
void startProcessByDefKey(String procDefKey, Map<String, Object> variables);
|
||||
|
||||
/**
|
||||
* 查询我的流程列表
|
||||
* @param pageQuery 分页参数
|
||||
*/
|
||||
TableDataInfo<WfTaskVo> queryPageOwnProcessList(PageQuery pageQuery);
|
||||
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ public interface IWfTaskService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
TableDataInfo<WfTaskVo> myProcess(PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
@@ -129,6 +130,7 @@ public interface IWfTaskService {
|
||||
* @param procInsId 流程实例Id
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, Object> flowRecord(String procInsId, String deployId);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,22 +1,35 @@
|
||||
package com.ruoyi.workflow.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.BetweenFormatter;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.flowable.common.constant.ProcessConstants;
|
||||
import com.ruoyi.common.utils.JsonUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
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;
|
||||
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.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 工作流流程实例管理
|
||||
@@ -24,10 +37,14 @@ import java.util.Objects;
|
||||
* @author KonBAI
|
||||
* @createTime 2022/3/10 00:12
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WfInstanceServiceImpl extends FlowServiceFactory implements IWfInstanceService {
|
||||
|
||||
private final IWfDeployFormService deployFormService;
|
||||
private final ISysUserService userService;
|
||||
private final ISysRoleService roleService;
|
||||
|
||||
@Override
|
||||
public List<Task> queryListByInstanceId(String instanceId) {
|
||||
@@ -102,25 +119,85 @@ public class WfInstanceServiceImpl extends FlowServiceFactory implements IWfInst
|
||||
return historicProcessInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据流程定义ID启动流程实例
|
||||
* 流程历史流转记录
|
||||
*
|
||||
* @param procDefId 流程定义Id
|
||||
* @param variables 流程变量
|
||||
* @param procInsId 流程实例Id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void startProcessInstanceById(String procDefId, Map<String, Object> variables) {
|
||||
try {
|
||||
// 设置流程发起人Id到流程中
|
||||
String userIdStr = LoginHelper.getUserId().toString();
|
||||
// identityService.setAuthenticatedUserId(userId.toString());
|
||||
variables.put(ProcessConstants.PROCESS_INITIATOR, userIdStr);
|
||||
variables.put("_FLOWABLE_SKIP_EXPRESSION_ENABLED", true);
|
||||
runtimeService.startProcessInstanceById(procDefId, variables);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("流程启动错误");
|
||||
public Map<String, Object> queryDetailProcess(String procInsId, String deployId) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (StringUtils.isNotBlank(procInsId)) {
|
||||
List<HistoricActivityInstance> list = historyService
|
||||
.createHistoricActivityInstanceQuery()
|
||||
.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);
|
||||
}
|
||||
}
|
||||
map.put("flowList", hisFlowList);
|
||||
// // 查询当前任务是否完成
|
||||
// List<Task> taskList = taskService.createTaskQuery().processInstanceId(procInsId).list();
|
||||
// if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
// map.put("finished", true);
|
||||
// } else {
|
||||
// map.put("finished", false);
|
||||
// }
|
||||
}
|
||||
// 第一次申请获取初始化表单
|
||||
if (StringUtils.isNotBlank(deployId)) {
|
||||
WfFormVo formVo = deployFormService.selectDeployFormByDeployId(deployId);
|
||||
if (Objects.isNull(formVo)) {
|
||||
throw new ServiceException("请先配置流程表单");
|
||||
}
|
||||
map.put("formData", JsonUtils.parseObject(formVo.getContent(), Map.class));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
package com.ruoyi.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
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;
|
||||
import com.ruoyi.workflow.domain.vo.WfDefinitionVo;
|
||||
import com.ruoyi.workflow.domain.vo.WfTaskVo;
|
||||
import com.ruoyi.workflow.service.IWfProcessService;
|
||||
import com.ruoyi.workflow.service.IWfTaskService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.repository.ProcessDefinitionQuery;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -133,6 +137,54 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<WfTaskVo> queryPageOwnProcessList(PageQuery pageQuery) {
|
||||
Page<WfTaskVo> page = new Page<>();
|
||||
Long userId = LoginHelper.getUserId();
|
||||
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery()
|
||||
.startedBy(userId.toString())
|
||||
.orderByProcessInstanceStartTime()
|
||||
.desc();
|
||||
int offset = pageQuery.getPageSize() * (pageQuery.getPageNum() - 1);
|
||||
List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery
|
||||
.listPage(offset, pageQuery.getPageSize());
|
||||
page.setTotal(historicProcessInstanceQuery.count());
|
||||
List<WfTaskVo> taskVoList = new ArrayList<>();
|
||||
for (HistoricProcessInstance hisIns : historicProcessInstances) {
|
||||
WfTaskVo taskVo = new WfTaskVo();
|
||||
taskVo.setCreateTime(hisIns.getStartTime());
|
||||
taskVo.setFinishTime(hisIns.getEndTime());
|
||||
taskVo.setProcInsId(hisIns.getId());
|
||||
|
||||
// 计算耗时
|
||||
if (Objects.nonNull(hisIns.getEndTime())) {
|
||||
taskVo.setDuration(DateUtils.getDatePoor(hisIns.getEndTime(), hisIns.getStartTime()));
|
||||
} else {
|
||||
taskVo.setDuration(DateUtils.getDatePoor(DateUtils.getNowDate(), hisIns.getStartTime()));
|
||||
}
|
||||
// 流程部署实例信息
|
||||
Deployment deployment = repositoryService.createDeploymentQuery()
|
||||
.deploymentId(hisIns.getDeploymentId()).singleResult();
|
||||
taskVo.setDeployId(hisIns.getDeploymentId());
|
||||
taskVo.setProcDefId(hisIns.getProcessDefinitionId());
|
||||
taskVo.setProcDefName(hisIns.getProcessDefinitionName());
|
||||
taskVo.setProcDefVersion(hisIns.getProcessDefinitionVersion());
|
||||
taskVo.setCategory(deployment.getCategory());
|
||||
// 当前所处流程
|
||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
|
||||
if (CollUtil.isNotEmpty(taskList)) {
|
||||
taskVo.setTaskId(taskList.get(0).getId());
|
||||
} else {
|
||||
List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery()
|
||||
.processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
|
||||
taskVo.setTaskId(historicTaskInstance.get(0).getId());
|
||||
}
|
||||
taskVoList.add(taskVo);
|
||||
}
|
||||
page.setRecords(taskVoList);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 扩展参数构建
|
||||
* @param variables 扩展参数
|
||||
|
||||
10
ruoyi-ui/src/api/workflow/instance.js
Normal file
10
ruoyi-ui/src/api/workflow/instance.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询流程实例详情信息
|
||||
export function getDetailInstance(query) {
|
||||
return request({
|
||||
url: '/workflow/instance/detail',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
@@ -20,9 +20,9 @@ export function startProcess(processDefId, data) {
|
||||
}
|
||||
|
||||
// 我的发起的流程
|
||||
export function myProcessList(query) {
|
||||
export function listOwnProcess(query) {
|
||||
return request({
|
||||
url: '/workflow/task/myProcess',
|
||||
url: '/workflow/process/own',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
||||
@@ -1,21 +1,37 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-tabs tab-position="top" v-model="activeTagName">
|
||||
<el-tab-pane label="基础信息" name="basicInfo">
|
||||
<el-card class="box-card">
|
||||
<el-tabs tab-position="top">
|
||||
<el-tab-pane label="任务办理" v-if="finished === 'true'">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<el-row>
|
||||
<el-col :span="20" :offset="2">
|
||||
<el-form ref="taskForm" :model="taskForm" :rules="rules" label-width="80px">
|
||||
<el-form-item label="审批意见" prop="comment">
|
||||
<el-input type="textarea" :rows="5" v-model="taskForm.comment" placeholder="请输入 审批意见" />
|
||||
</el-form-item>
|
||||
</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-button icon="el-icon-refresh-left" type="warning" @click="handleReturn">退回</el-button>
|
||||
<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">
|
||||
<!--流程处理表单模块-->
|
||||
<el-col :span="16" :offset="6" v-if="variableOpen">
|
||||
<el-col :span="20" :offset="2" v-if="variableOpen">
|
||||
<div>
|
||||
<parser :key="new Date().getTime()" :form-conf="variablesData"/>
|
||||
</div>
|
||||
<div style="margin-left:10%;margin-bottom: 20px;font-size: 14px;" v-if="finished === 'true'">
|
||||
<el-button icon="el-icon-edit-outline" type="success" size="mini" @click="handleComplete">审批</el-button>
|
||||
<!-- <el-button icon="el-icon-edit-outline" type="primary" size="mini" @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-button icon="el-icon-refresh-left" type="warning" size="mini" @click="handleReturn">退回</el-button>
|
||||
<el-button icon="el-icon-circle-close" type="danger" size="mini" @click="handleReject">驳回</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<!--初始化流程加载表单信息-->
|
||||
@@ -26,8 +42,8 @@
|
||||
</el-col>
|
||||
</el-card>
|
||||
</el-tab-pane >
|
||||
<el-tab-pane label="流转记录" name="flowRecord">
|
||||
<el-card class="box-card">
|
||||
<el-tab-pane label="流转记录">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<el-col :span="16" :offset="4">
|
||||
<div class="block">
|
||||
<el-timeline>
|
||||
@@ -71,8 +87,8 @@
|
||||
</el-col>
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="流程跟踪" name="processTrack">
|
||||
<el-card class="box-card">
|
||||
<el-tab-pane label="流程跟踪">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<process-viewer :key="`designer-${loadIndex}`" :style="'height:' + height" :xml="xmlData"
|
||||
:finishedInfo="finishedInfo" :allCommentList="null"
|
||||
/>
|
||||
@@ -80,65 +96,6 @@
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<!--审批正常流程-->
|
||||
<el-dialog :title="completeTitle" :visible.sync="completeOpen" width="60%" append-to-body>
|
||||
<!-- <el-row :gutter="20">-->
|
||||
<!-- <!–部门数据–>-->
|
||||
<!-- <el-col :span="4" :xs="24">-->
|
||||
<!-- <h6>部门列表</h6>-->
|
||||
<!-- <div class="head-container">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="deptName"-->
|
||||
<!-- placeholder="请输入部门名称"-->
|
||||
<!-- clearable-->
|
||||
<!-- size="small"-->
|
||||
<!-- prefix-icon="el-icon-search"-->
|
||||
<!-- style="margin-bottom: 20px"-->
|
||||
<!-- />-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="head-container">-->
|
||||
<!-- <el-tree-->
|
||||
<!-- :data="deptOptions"-->
|
||||
<!-- :props="defaultProps"-->
|
||||
<!-- :expand-on-click-node="false"-->
|
||||
<!-- :filter-node-method="filterNode"-->
|
||||
<!-- ref="tree"-->
|
||||
<!-- default-expand-all-->
|
||||
<!-- @node-click="handleNodeClick"-->
|
||||
<!-- />-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" :xs="24">-->
|
||||
<!-- <h6>待选人员</h6>-->
|
||||
<!-- <el-table-->
|
||||
<!-- ref="singleTable"-->
|
||||
<!-- :data="userList"-->
|
||||
<!-- border-->
|
||||
<!-- style="width: 100%"-->
|
||||
<!-- @selection-change="handleSelectionChange">-->
|
||||
<!-- <el-table-column type="selection" width="50" align="center" />-->
|
||||
<!-- <el-table-column label="用户名" align="center" prop="nickName" />-->
|
||||
<!-- <el-table-column label="部门" align="center" prop="dept.deptName" />-->
|
||||
<!-- </el-table>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="8" :xs="24">-->
|
||||
<!-- <h6>已选人员</h6>-->
|
||||
<!-- <el-tag-->
|
||||
<!-- v-for="tag in userData"-->
|
||||
<!-- :key="tag.nickName"-->
|
||||
<!-- closable-->
|
||||
<!-- @close="handleClose(tag)">-->
|
||||
<!-- {{tag.nickName}} {{tag.dept.deptName}}-->
|
||||
<!-- </el-tag>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- </el-row>-->
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-input style="width: 50%;margin-right: 34%" type="textarea" v-model="taskForm.comment" placeholder="请输入处理意见"/>
|
||||
<el-button @click="completeOpen = false">取 消</el-button>
|
||||
<el-button type="primary" @click="taskComplete">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<!--退回流程-->
|
||||
<el-dialog :title="returnTitle" :visible.sync="returnOpen" width="40%" append-to-body>
|
||||
<el-form ref="taskForm" :model="taskForm" label-width="80px" >
|
||||
@@ -151,33 +108,19 @@
|
||||
>{{item.name}}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="退回意见" prop="comment" :rules="[{ required: true, message: '请输入意见', trigger: 'blur' }]">
|
||||
<el-input style="width: 50%" type="textarea" v-model="taskForm.comment" placeholder="请输入意见"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="returnOpen = false">取 消</el-button>
|
||||
<el-button type="primary" @click="taskReturn">确 定</el-button>
|
||||
<el-button type="primary" @click="submitReturn">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<!--驳回流程-->
|
||||
<el-dialog :title="rejectTitle" :visible.sync="rejectOpen" width="40%" append-to-body>
|
||||
<el-form ref="taskForm" :model="taskForm" label-width="80px" >
|
||||
<el-form-item label="驳回意见" prop="comment" :rules="[{ required: true, message: '请输入意见', trigger: 'blur' }]">
|
||||
<el-input style="width: 50%" type="textarea" v-model="taskForm.comment" placeholder="请输入意见"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="rejectOpen = false">取 消</el-button>
|
||||
<el-button type="primary" @click="taskReject">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { flowRecord } from '@/api/workflow/finished'
|
||||
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'
|
||||
@@ -198,7 +141,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
height: document.documentElement.clientHeight - 205 + 'px;',
|
||||
activeTagName: 'basicInfo',
|
||||
// 模型xml数据
|
||||
loadIndex: 0,
|
||||
xmlData: undefined,
|
||||
@@ -215,7 +157,7 @@ export default {
|
||||
deptOptions: undefined,
|
||||
// 用户表格数据
|
||||
userList: null,
|
||||
defaultProps: {
|
||||
deptProps: {
|
||||
children: "children",
|
||||
label: "label"
|
||||
},
|
||||
@@ -225,16 +167,14 @@ export default {
|
||||
},
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
flowRecordList: [], // 流程流转数据
|
||||
flowRecordList: [],
|
||||
formConfCopy: {},
|
||||
src: null,
|
||||
rules: {}, // 表单校验
|
||||
variablesForm: {}, // 流程变量数据
|
||||
variablesForm: {},
|
||||
taskForm:{
|
||||
returnTaskShow: false, // 是否展示回退表单
|
||||
delegateTaskShow: false, // 是否展示回退表单
|
||||
defaultTaskShow: true, // 默认处理
|
||||
sendUserShow: false, // 审批用户
|
||||
returnTaskShow: false,
|
||||
delegateTaskOpen: false,
|
||||
defaultTaskShow: true,
|
||||
sendUserShow: false,
|
||||
multiple: false,
|
||||
comment:"", // 意见内容
|
||||
procInsId: "", // 流程实例编号
|
||||
@@ -245,6 +185,9 @@ export default {
|
||||
vars: "",
|
||||
targetKey:""
|
||||
},
|
||||
rules: {
|
||||
comment: [{ required: true, message: '请输入审批意见', trigger: 'blur' }],
|
||||
},
|
||||
userDataList:[], // 流程候选人
|
||||
assignee: null,
|
||||
formConf: {}, // 默认表单数据
|
||||
@@ -254,12 +197,11 @@ export default {
|
||||
variableOpen: false, // 是否加载流程变量数据
|
||||
returnTaskList: [], // 回退列表数据
|
||||
finished: 'false',
|
||||
completeTitle: null,
|
||||
completeOpen: false,
|
||||
returnTitle: null,
|
||||
returnOpen: false,
|
||||
rejectOpen: false,
|
||||
rejectTitle: null,
|
||||
delegateOpen: false,
|
||||
userData:[],
|
||||
};
|
||||
},
|
||||
@@ -271,7 +213,7 @@ export default {
|
||||
this.taskForm.instanceId = this.$route.query && this.$route.query.procInsId;
|
||||
this.finished = this.$route.query && this.$route.query.finished
|
||||
// 流程任务重获取变量表单
|
||||
if (this.taskForm.taskId){
|
||||
if (this.taskForm.taskId) {
|
||||
this.processVariables( this.taskForm.taskId)
|
||||
// this.getNextFlowNode(this.taskForm.taskId)
|
||||
this.taskForm.deployId = null
|
||||
@@ -283,7 +225,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
/** 查询部门下拉树结构 */
|
||||
getTreeselect() {
|
||||
getTreeSelect() {
|
||||
treeselect().then(response => {
|
||||
this.deptOptions = response.data;
|
||||
});
|
||||
@@ -377,7 +319,7 @@ export default {
|
||||
/** 流程流转记录 */
|
||||
getFlowRecordList(procInsId, deployId) {
|
||||
const params = {procInsId: procInsId, deployId: deployId}
|
||||
flowRecord(params).then(res => {
|
||||
getDetailInstance(params).then(res => {
|
||||
this.flowRecordList = res.data.flowList;
|
||||
// 流程过程中不存在初始化表单 直接读取的流程变量中存储的表单值
|
||||
if (res.data.formData) {
|
||||
@@ -433,31 +375,28 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 审批任务选择 */
|
||||
/** 通过任务 */
|
||||
handleComplete() {
|
||||
this.completeOpen = true;
|
||||
this.completeTitle = "审批流程";
|
||||
this.getTreeselect();
|
||||
},
|
||||
/** 审批任务 */
|
||||
taskComplete() {
|
||||
// if (!this.taskForm.values){
|
||||
// this.$modal.msgError("请选择流程接收人员");
|
||||
// return;
|
||||
// }
|
||||
if (!this.taskForm.comment){
|
||||
this.$modal.msgError("请输入审批意见");
|
||||
return;
|
||||
}
|
||||
complete(this.taskForm).then(response => {
|
||||
this.$modal.msgSuccess(response.msg);
|
||||
this.goBack();
|
||||
this.$refs['taskForm'].validate(valid => {
|
||||
if (valid) {
|
||||
complete(this.taskForm).then(response => {
|
||||
this.$modal.msgSuccess(response.msg);
|
||||
this.goBack();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 委派任务 */
|
||||
handleDelegate() {
|
||||
this.taskForm.delegateTaskShow = true;
|
||||
this.taskForm.defaultTaskShow = false;
|
||||
|
||||
/** 驳回任务 */
|
||||
handleReject() {
|
||||
this.$refs["taskForm"].validate(valid => {
|
||||
if (valid) {
|
||||
rejectTask(this.taskForm).then(res => {
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.goBack();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
handleAssign(){
|
||||
|
||||
@@ -507,35 +446,27 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
/** 驳回任务 */
|
||||
handleReject() {
|
||||
this.rejectOpen = true;
|
||||
this.rejectTitle = "驳回流程";
|
||||
},
|
||||
/** 驳回任务 */
|
||||
taskReject() {
|
||||
this.$refs["taskForm"].validate(valid => {
|
||||
if (valid) {
|
||||
rejectTask(this.taskForm).then(res => {
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.goBack();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 可退回任务列表 */
|
||||
handleReturn() {
|
||||
this.returnOpen = true;
|
||||
this.returnTitle = "退回流程";
|
||||
returnList(this.taskForm).then(res => {
|
||||
this.returnTaskList = res.data;
|
||||
this.taskForm.values = null;
|
||||
})
|
||||
this.$refs['taskForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.returnTitle = "退回流程";
|
||||
returnList(this.taskForm).then(res => {
|
||||
this.returnTaskList = res.data;
|
||||
this.taskForm.values = null;
|
||||
this.returnOpen = true;
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
/** 提交退回任务 */
|
||||
taskReturn() {
|
||||
submitReturn() {
|
||||
this.$refs["taskForm"].validate(valid => {
|
||||
if (valid) {
|
||||
if (!this.taskForm.targetKey) {
|
||||
this.$modal.msgError("请选择退回节点!");
|
||||
}
|
||||
returnTask(this.taskForm).then(res => {
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.goBack()
|
||||
@@ -563,7 +494,7 @@ export default {
|
||||
},
|
||||
/** 取消回退任务按钮 */
|
||||
cancelDelegateTask() {
|
||||
this.taskForm.delegateTaskShow = false;
|
||||
this.taskForm.delegateTaskOpen = false;
|
||||
this.taskForm.defaultTaskShow = true;
|
||||
this.taskForm.sendUserShow = true;
|
||||
this.returnTaskList = [];
|
||||
@@ -595,4 +526,14 @@ export default {
|
||||
.el-tag + .el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.el-row {
|
||||
margin-bottom: 20px;
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
.el-col {
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="myProcessList" border @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" :data="ownProcessList" border @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="流程编号" align="center" prop="procInsId" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="流程名称" align="center" prop="procDefName" :show-overflow-tooltip="true"/>
|
||||
@@ -110,7 +110,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { myProcessList, stopProcess, delProcess } from "@/api/workflow/process";
|
||||
import { listOwnProcess, stopProcess, delProcess } from '@/api/workflow/process';
|
||||
import { listCategory } from '@/api/workflow/category';
|
||||
export default {
|
||||
name: "Own",
|
||||
@@ -134,7 +134,7 @@ export default {
|
||||
categoryOptions: [],
|
||||
processTotal:0,
|
||||
// 我发起的流程列表数据
|
||||
myProcessList: [],
|
||||
ownProcessList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
@@ -172,8 +172,8 @@ export default {
|
||||
/** 查询流程定义列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
myProcessList(this.queryParams).then(response => {
|
||||
this.myProcessList = response.rows;
|
||||
listOwnProcess(this.queryParams).then(response => {
|
||||
this.ownProcessList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
@@ -226,7 +226,8 @@ export default {
|
||||
});
|
||||
},
|
||||
/** 流程流转记录 */
|
||||
handleFlowRecord(row){
|
||||
handleFlowRecord(row) {
|
||||
console.log("row =========> ", row)
|
||||
this.$router.push({ path: '/work/detail',
|
||||
query: {
|
||||
definitionId: row.procDefId,
|
||||
|
||||
Reference in New Issue
Block a user