重命名历史任务的接口
parent
2de81e438a
commit
adc6076deb
|
@ -64,12 +64,12 @@ public class BpmTaskController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/historic-list-by-process-instance-id")
|
||||
@GetMapping("/list-by-process-instance-id")
|
||||
@ApiOperation(value = "获得指定流程实例的任务列表", notes = "包括完成的、未完成的")
|
||||
@ApiImplicitParam(name = "processInstanceId", value = "流程实例的编号", required = true, dataTypeClass = String.class)
|
||||
public CommonResult<List<BpmTaskRespVO>> getHistoricTaskListByProcessInstanceId(
|
||||
public CommonResult<List<BpmTaskRespVO>> getTaskListByProcessInstanceId(
|
||||
@RequestParam("processInstanceId") String processInstanceId) {
|
||||
return success(taskService.getHistoricTaskListByProcessInstanceId(processInstanceId));
|
||||
return success(taskService.getTaskListByProcessInstanceId(processInstanceId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ public interface BpmTaskService {
|
|||
* @param processInstanceId 流程实例的编号
|
||||
* @return 流程任务列表
|
||||
*/
|
||||
List<BpmTaskRespVO> getHistoricTaskListByProcessInstanceId(String processInstanceId);
|
||||
List<BpmTaskRespVO> getTaskListByProcessInstanceId(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 获得流程任务列表
|
||||
|
|
|
@ -92,7 +92,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<BpmTaskRespVO> getHistoricTaskListByProcessInstanceId(String processInstanceId) {
|
||||
public List<BpmTaskRespVO> getTaskListByProcessInstanceId(String processInstanceId) {
|
||||
// 获得任务列表
|
||||
List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -48,9 +48,9 @@ export function updateTaskAssignee(data) {
|
|||
})
|
||||
}
|
||||
|
||||
export function getHistoricTaskListByProcessInstanceId(processInstanceId) {
|
||||
export function getTaskListByProcessInstanceId(processInstanceId) {
|
||||
return request({
|
||||
url: '/bpm/task/historic-list-by-process-instance-id?processInstanceId=' + processInstanceId,
|
||||
url: '/bpm/task/list-by-process-instance-id?processInstanceId=' + processInstanceId,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ export default {
|
|||
let completeTask = this.tasks.find(m => m.definitionKey === n.id)
|
||||
let todoTask = this.tasks.find(m => !m.endTime)
|
||||
let endTask = this.tasks[this.tasks.length - 1]
|
||||
if (n.$type === 'bpmn:UserTask') {
|
||||
if (n.$type === 'bpmn:UserTask') { // 用户任务
|
||||
if (completeTask) {
|
||||
canvas.addMarker(n.id, completeTask.endTime ? 'highlight' : 'highlight-todo');
|
||||
// console.log(n.id + ' : ' + (completeTask.endTime ? 'highlight' : 'highlight-todo'));
|
||||
|
@ -118,14 +118,14 @@ export default {
|
|||
}
|
||||
});
|
||||
}
|
||||
} else if (n.$type === 'bpmn:ExclusiveGateway') {
|
||||
} else if (n.$type === 'bpmn:ExclusiveGateway') { // 排它网关
|
||||
n.outgoing?.forEach(nn => {
|
||||
let targetTask = this.tasks.find(m => m.definitionKey === nn.targetRef.id)
|
||||
if (targetTask) {
|
||||
canvas.addMarker(nn.id, targetTask.endTime ? 'highlight' : 'highlight-todo');
|
||||
}
|
||||
})
|
||||
} else if (n.$type === 'bpmn:ParallelGateway') {
|
||||
} else if (n.$type === 'bpmn:ParallelGateway') { // 并行网关
|
||||
if (completeTask) {
|
||||
canvas.addMarker(n.id, completeTask.endTime ? 'highlight' : 'highlight-todo')
|
||||
n.outgoing?.forEach(nn => {
|
||||
|
@ -136,7 +136,7 @@ export default {
|
|||
}
|
||||
})
|
||||
}
|
||||
} else if (n.$type === 'bpmn:StartEvent') {
|
||||
} else if (n.$type === 'bpmn:StartEvent') { // 开始节点
|
||||
n.outgoing?.forEach(nn => {
|
||||
let completeTask = this.tasks.find(m => m.definitionKey === nn.targetRef.id)
|
||||
if (completeTask) {
|
||||
|
@ -145,7 +145,7 @@ export default {
|
|||
return
|
||||
}
|
||||
});
|
||||
} else if (n.$type === 'bpmn:EndEvent') {
|
||||
} else if (n.$type === 'bpmn:EndEvent') { // 结束节点
|
||||
if (endTask.definitionKey === n.id && endTask.endTime) {
|
||||
canvas.addMarker(n.id, 'highlight')
|
||||
return
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 审批信息 -->
|
||||
<el-card class="box-card" v-loading="processInstanceLoading" v-for="(item, index) in tasks" :key="index">
|
||||
<el-card class="box-card" v-loading="processInstanceLoading" v-for="(item, index) in runningTasks" :key="index">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="el-icon-picture-outline">审批任务【{{ item.name }}】</span>
|
||||
</div>
|
||||
|
@ -38,14 +38,14 @@
|
|||
</div>
|
||||
</el-col>
|
||||
</el-card>
|
||||
<el-card class="box-card" v-loading="historicTasksLoad">
|
||||
<el-card class="box-card" v-loading="tasksLoad">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="el-icon-picture-outline">审批记录</span>
|
||||
</div>
|
||||
<el-col :span="16" :offset="4" >
|
||||
<div class="block">
|
||||
<el-timeline>
|
||||
<el-timeline-item v-for="(item, index) in historicTasks" :key="index"
|
||||
<el-timeline-item v-for="(item, index) in tasks" :key="index"
|
||||
:icon="getTimelineItemIcon(item)" :type="getTimelineItemType(item)">
|
||||
<p style="font-weight: 700">任务:{{ item.name }}</p>
|
||||
<el-card :body-style="{ padding: '10px' }">
|
||||
|
@ -73,7 +73,7 @@
|
|||
<div slot="header" class="clearfix">
|
||||
<span class="el-icon-picture-outline">流程图</span>
|
||||
</div>
|
||||
<my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" :taskData="historicTasks" />
|
||||
<my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" :taskData="tasks" />
|
||||
</el-card>
|
||||
|
||||
<!-- 对话框(转派审批人) -->
|
||||
|
@ -100,7 +100,7 @@ import store from "@/store";
|
|||
import {decodeFields} from "@/utils/formGenerator";
|
||||
import Parser from '@/components/parser/Parser'
|
||||
import {createProcessInstance, getProcessInstance} from "@/api/bpm/processInstance";
|
||||
import {approveTask, getHistoricTaskListByProcessInstanceId, rejectTask, updateTaskAssignee} from "@/api/bpm/task";
|
||||
import {approveTask, getTaskListByProcessInstanceId, rejectTask, updateTaskAssignee} from "@/api/bpm/task";
|
||||
import {getDate} from "@/utils/dateUtils";
|
||||
import {listSimpleUsers} from "@/api/system/user";
|
||||
|
||||
|
@ -130,11 +130,11 @@ export default {
|
|||
},
|
||||
|
||||
// 审批记录
|
||||
historicTasksLoad: true,
|
||||
historicTasks: [],
|
||||
tasksLoad: true,
|
||||
tasks: [],
|
||||
|
||||
// 审批表单
|
||||
tasks: [],
|
||||
runningTasks: [],
|
||||
auditForms: [],
|
||||
auditRule: {
|
||||
comment: [{ required: true, message: "审批建议不能为空", trigger: "blur" }],
|
||||
|
@ -208,14 +208,14 @@ export default {
|
|||
});
|
||||
|
||||
// 获得流程任务列表(审批记录)
|
||||
this.historicTasksLoad = true;
|
||||
this.tasks = [];
|
||||
this.tasksLoad = true;
|
||||
this.runningTasks = [];
|
||||
this.auditForms = [];
|
||||
getHistoricTaskListByProcessInstanceId(this.id).then(response => {
|
||||
getTaskListByProcessInstanceId(this.id).then(response => {
|
||||
// 审批记录
|
||||
this.historicTasks = response.data;
|
||||
this.tasks = response.data;
|
||||
// 排序,将未完成的排在前面,已完成的排在后面;
|
||||
this.historicTasks.sort((a, b) => {
|
||||
this.tasks.sort((a, b) => {
|
||||
// 有已完成的情况,按照完成时间倒序
|
||||
if (a.endTime && b.endTime) {
|
||||
return b.endTime - a.endTime;
|
||||
|
@ -231,21 +231,21 @@ export default {
|
|||
|
||||
// 需要审核的记录
|
||||
const userId = store.getters.userId;
|
||||
this.historicTasks.forEach(task => {
|
||||
this.tasks.forEach(task => {
|
||||
if (task.result !== 1) { // 只有待处理才需要
|
||||
return;
|
||||
}
|
||||
if (!task.assigneeUser || task.assigneeUser.id !== userId) { // 自己不是处理人
|
||||
return;
|
||||
}
|
||||
this.tasks.push({...task});
|
||||
this.runningTasks.push({...task});
|
||||
this.auditForms.push({
|
||||
comment: ''
|
||||
})
|
||||
});
|
||||
|
||||
// 取消加载中
|
||||
this.historicTasksLoad = false;
|
||||
this.tasksLoad = false;
|
||||
});
|
||||
},
|
||||
/** 处理选择流程的按钮操作 **/
|
||||
|
@ -325,7 +325,7 @@ export default {
|
|||
},
|
||||
/** 处理审批通过和不通过的操作 */
|
||||
handleAudit(task, pass) {
|
||||
const index = this.tasks.indexOf(task);
|
||||
const index = this.runningTasks.indexOf(task);
|
||||
this.$refs['form' + index][0].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue