add -- 新增 任务签收功能
This commit is contained in:
@@ -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.bo.WfCopyBo;
|
||||
import com.ruoyi.workflow.domain.bo.WfProcessBo;
|
||||
import com.ruoyi.workflow.domain.vo.WfCopyVo;
|
||||
import com.ruoyi.workflow.domain.vo.WfDefinitionVo;
|
||||
import com.ruoyi.workflow.domain.vo.WfTaskVo;
|
||||
@@ -67,6 +68,13 @@ public class WfProcessController extends BaseController {
|
||||
return processService.queryPageTodoProcessList(pageQuery);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取待签列表", response = WfTaskVo.class)
|
||||
@SaCheckPermission("workflow:process:claimList")
|
||||
@GetMapping(value = "/claimList")
|
||||
public TableDataInfo<WfTaskVo> claimProcess(WfProcessBo processBo, PageQuery pageQuery) {
|
||||
return processService.queryPageClaimProcessList(processBo, pageQuery);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取已办列表", response = WfTaskVo.class)
|
||||
@SaCheckPermission("workflow:process:finishedList")
|
||||
@GetMapping(value = "/finishedList")
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.workflow.domain.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程业务对象
|
||||
*
|
||||
* @author KonBAI
|
||||
* @createTime 2022/6/11 01:15
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("流程业务对象")
|
||||
public class WfProcessBo {
|
||||
|
||||
@ApiModelProperty("流程名称")
|
||||
private String processName;
|
||||
}
|
||||
@@ -2,6 +2,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.bo.WfProcessBo;
|
||||
import com.ruoyi.workflow.domain.vo.WfDefinitionVo;
|
||||
import com.ruoyi.workflow.domain.vo.WfTaskVo;
|
||||
|
||||
@@ -46,6 +47,12 @@ public interface IWfProcessService {
|
||||
*/
|
||||
TableDataInfo<WfTaskVo> queryPageTodoProcessList(PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询待签任务列表
|
||||
* @param pageQuery 分页参数
|
||||
*/
|
||||
TableDataInfo<WfTaskVo> queryPageClaimProcessList(WfProcessBo processBo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询已办任务列表
|
||||
* @param pageQuery 分页参数
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.ruoyi.flowable.common.constant.TaskConstants;
|
||||
import com.ruoyi.flowable.factory.FlowServiceFactory;
|
||||
import com.ruoyi.flowable.utils.TaskUtils;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.workflow.domain.bo.WfProcessBo;
|
||||
import com.ruoyi.workflow.domain.vo.WfDefinitionVo;
|
||||
import com.ruoyi.workflow.domain.vo.WfTaskVo;
|
||||
import com.ruoyi.workflow.service.IWfProcessService;
|
||||
@@ -243,6 +244,55 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<WfTaskVo> queryPageClaimProcessList(WfProcessBo processBo, PageQuery pageQuery) {
|
||||
Page<WfTaskVo> page = new Page<>();
|
||||
Long userId = LoginHelper.getUserId();
|
||||
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||
.active()
|
||||
.includeProcessVariables()
|
||||
.taskCandidateUser(userId.toString())
|
||||
.taskCandidateGroupIn(TaskUtils.getCandidateGroup())
|
||||
.orderByTaskCreateTime().desc();
|
||||
if (StringUtils.isNotBlank(processBo.getProcessName())) {
|
||||
taskQuery.processDefinitionNameLike("%" + processBo.getProcessName() + "%");
|
||||
}
|
||||
page.setTotal(taskQuery.count());
|
||||
int offset = pageQuery.getPageSize() * (pageQuery.getPageNum() - 1);
|
||||
List<Task> taskList = taskQuery.listPage(offset, pageQuery.getPageSize());
|
||||
List<WfTaskVo> flowList = new ArrayList<>();
|
||||
for (Task task : taskList) {
|
||||
WfTaskVo flowTask = new WfTaskVo();
|
||||
// 当前流程信息
|
||||
flowTask.setTaskId(task.getId());
|
||||
flowTask.setTaskDefKey(task.getTaskDefinitionKey());
|
||||
flowTask.setCreateTime(task.getCreateTime());
|
||||
flowTask.setProcDefId(task.getProcessDefinitionId());
|
||||
flowTask.setTaskName(task.getName());
|
||||
// 流程定义信息
|
||||
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionId(task.getProcessDefinitionId())
|
||||
.singleResult();
|
||||
flowTask.setDeployId(pd.getDeploymentId());
|
||||
flowTask.setProcDefName(pd.getName());
|
||||
flowTask.setProcDefVersion(pd.getVersion());
|
||||
flowTask.setProcInsId(task.getProcessInstanceId());
|
||||
|
||||
// 流程发起人信息
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(task.getProcessInstanceId())
|
||||
.singleResult();
|
||||
SysUser startUser = userService.selectUserById(Long.parseLong(historicProcessInstance.getStartUserId()));
|
||||
flowTask.setStartUserId(startUser.getNickName());
|
||||
flowTask.setStartUserName(startUser.getNickName());
|
||||
flowTask.setStartDeptName(startUser.getDept().getDeptName());
|
||||
|
||||
flowList.add(flowTask);
|
||||
}
|
||||
page.setRecords(flowList);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<WfTaskVo> queryPageFinishedProcessList(PageQuery pageQuery) {
|
||||
Page<WfTaskVo> page = new Page<>();
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.ruoyi.flowable.factory.FlowServiceFactory;
|
||||
import com.ruoyi.flowable.flow.CustomProcessDiagramGenerator;
|
||||
import com.ruoyi.flowable.flow.FindNextNodeUtil;
|
||||
import com.ruoyi.flowable.flow.FlowableUtils;
|
||||
import com.ruoyi.flowable.utils.TaskUtils;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.workflow.domain.bo.WfTaskBo;
|
||||
@@ -375,12 +376,16 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
|
||||
/**
|
||||
* 认领/签收任务
|
||||
*
|
||||
* @param bo 请求实体参数
|
||||
* @param taskBo 请求实体参数
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void claim(WfTaskBo bo) {
|
||||
taskService.claim(bo.getTaskId(), bo.getUserId());
|
||||
public void claim(WfTaskBo taskBo) {
|
||||
Task task = taskService.createTaskQuery().taskId(taskBo.getTaskId()).singleResult();
|
||||
if (Objects.isNull(task)) {
|
||||
throw new ServiceException("任务不存在");
|
||||
}
|
||||
taskService.claim(taskBo.getTaskId(), TaskUtils.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,6 +37,15 @@ export function listTodoProcess(query) {
|
||||
})
|
||||
}
|
||||
|
||||
// 我待签的流程
|
||||
export function listClaimProcess(query) {
|
||||
return request({
|
||||
url: '/workflow/process/claimList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 我已办的流程
|
||||
export function listFinishedProcess(query) {
|
||||
return request({
|
||||
|
||||
@@ -45,6 +45,15 @@ export function rejectTask(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 签收任务
|
||||
export function claimTask(data) {
|
||||
return request({
|
||||
url: '/workflow/task/claim',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 可退回任务列表
|
||||
export function returnList(data) {
|
||||
return request({
|
||||
|
||||
@@ -104,6 +104,12 @@ export const constantRoutes = [
|
||||
name: 'own',
|
||||
meta: { title: '我的流程', icon: '' }
|
||||
},
|
||||
{
|
||||
path: 'todo',
|
||||
component: () => import('@/views/workflow/work/todo'),
|
||||
name: 'todo',
|
||||
meta: { title: '代办任务', icon: '' }
|
||||
},
|
||||
{
|
||||
path: 'detail',
|
||||
component: () => import('@/views/workflow/work/detail'),
|
||||
|
||||
142
ruoyi-ui/src/views/workflow/work/claim.vue
Normal file
142
ruoyi-ui/src/views/workflow/work/claim.vue
Normal file
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="流程名称" prop="processName">
|
||||
<el-input
|
||||
v-model="queryParams.processName"
|
||||
placeholder="请输入流程名称"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</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-row :gutter="10" class="mb8">
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="claimList">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="任务编号" align="center" prop="taskId" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="流程名称" align="center" prop="procDefName"/>
|
||||
<el-table-column label="任务节点" align="center" prop="taskName"/>
|
||||
<el-table-column label="流程版本" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="medium" >v{{scope.row.procDefVersion}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="流程发起人" align="center">
|
||||
<template slot-scope="scope">
|
||||
<label>{{scope.row.startUserName}} <el-tag type="info" size="mini">{{scope.row.startDeptName}}</el-tag></label>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="接收时间" align="center" prop="createTime" width="180"/>
|
||||
<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-s-claim"
|
||||
@click="handleClaim(scope.row)"
|
||||
>签收
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listClaimProcess } from '@/api/workflow/process';
|
||||
import { claimTask } from '@/api/workflow/todo';
|
||||
|
||||
export default {
|
||||
name: 'Claim',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 流程待办任务表格数据
|
||||
claimList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
processName: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询流程定义列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listClaimProcess(this.queryParams).then(response => {
|
||||
this.claimList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 签收 */
|
||||
handleClaim(row) {
|
||||
claimTask({taskId: row.taskId}).then(response => {
|
||||
this.$modal.msgSuccess(response.msg);
|
||||
this.getList();
|
||||
this.$router.push({
|
||||
path: '/work/todo'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user