mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-11-04 08:06:12 +08:00 
			
		
		
		
	重命名历史任务的接口
This commit is contained in:
		@ -64,12 +64,12 @@ public class BpmTaskController {
 | 
				
			|||||||
        return success(true);
 | 
					        return success(true);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/historic-list-by-process-instance-id")
 | 
					    @GetMapping("/list-by-process-instance-id")
 | 
				
			||||||
    @ApiOperation(value = "获得指定流程实例的任务列表", notes = "包括完成的、未完成的")
 | 
					    @ApiOperation(value = "获得指定流程实例的任务列表", notes = "包括完成的、未完成的")
 | 
				
			||||||
    @ApiImplicitParam(name = "processInstanceId", value = "流程实例的编号", required = true, dataTypeClass = String.class)
 | 
					    @ApiImplicitParam(name = "processInstanceId", value = "流程实例的编号", required = true, dataTypeClass = String.class)
 | 
				
			||||||
    public CommonResult<List<BpmTaskRespVO>> getHistoricTaskListByProcessInstanceId(
 | 
					    public CommonResult<List<BpmTaskRespVO>> getTaskListByProcessInstanceId(
 | 
				
			||||||
            @RequestParam("processInstanceId") String processInstanceId) {
 | 
					            @RequestParam("processInstanceId") String processInstanceId) {
 | 
				
			||||||
        return success(taskService.getHistoricTaskListByProcessInstanceId(processInstanceId));
 | 
					        return success(taskService.getTaskListByProcessInstanceId(processInstanceId));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -30,7 +30,7 @@ public interface BpmTaskService {
 | 
				
			|||||||
     * @param processInstanceId 流程实例的编号
 | 
					     * @param processInstanceId 流程实例的编号
 | 
				
			||||||
     * @return 流程任务列表
 | 
					     * @return 流程任务列表
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<BpmTaskRespVO> getHistoricTaskListByProcessInstanceId(String processInstanceId);
 | 
					    List<BpmTaskRespVO> getTaskListByProcessInstanceId(String processInstanceId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 获得流程任务列表
 | 
					     * 获得流程任务列表
 | 
				
			||||||
 | 
				
			|||||||
@ -92,7 +92,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<BpmTaskRespVO> getHistoricTaskListByProcessInstanceId(String processInstanceId) {
 | 
					    public List<BpmTaskRespVO> getTaskListByProcessInstanceId(String processInstanceId) {
 | 
				
			||||||
        // 获得任务列表
 | 
					        // 获得任务列表
 | 
				
			||||||
        List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery()
 | 
					        List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery()
 | 
				
			||||||
                .processInstanceId(processInstanceId)
 | 
					                .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({
 | 
					  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',
 | 
					    method: 'get',
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -94,7 +94,7 @@ export default {
 | 
				
			|||||||
        let completeTask = this.tasks.find(m => m.definitionKey === n.id)
 | 
					        let completeTask = this.tasks.find(m => m.definitionKey === n.id)
 | 
				
			||||||
        let todoTask = this.tasks.find(m => !m.endTime)
 | 
					        let todoTask = this.tasks.find(m => !m.endTime)
 | 
				
			||||||
        let endTask = this.tasks[this.tasks.length - 1]
 | 
					        let endTask = this.tasks[this.tasks.length - 1]
 | 
				
			||||||
        if (n.$type === 'bpmn:UserTask') {
 | 
					        if (n.$type === 'bpmn:UserTask') { // 用户任务
 | 
				
			||||||
          if (completeTask) {
 | 
					          if (completeTask) {
 | 
				
			||||||
            canvas.addMarker(n.id, completeTask.endTime ? 'highlight' : 'highlight-todo');
 | 
					            canvas.addMarker(n.id, completeTask.endTime ? 'highlight' : 'highlight-todo');
 | 
				
			||||||
            // console.log(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 => {
 | 
					          n.outgoing?.forEach(nn => {
 | 
				
			||||||
            let targetTask = this.tasks.find(m => m.definitionKey === nn.targetRef.id)
 | 
					            let targetTask = this.tasks.find(m => m.definitionKey === nn.targetRef.id)
 | 
				
			||||||
            if (targetTask) {
 | 
					            if (targetTask) {
 | 
				
			||||||
              canvas.addMarker(nn.id, targetTask.endTime ? 'highlight' : 'highlight-todo');
 | 
					              canvas.addMarker(nn.id, targetTask.endTime ? 'highlight' : 'highlight-todo');
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
        } else if (n.$type === 'bpmn:ParallelGateway') {
 | 
					        } else if (n.$type === 'bpmn:ParallelGateway') { // 并行网关
 | 
				
			||||||
          if (completeTask) {
 | 
					          if (completeTask) {
 | 
				
			||||||
            canvas.addMarker(n.id, completeTask.endTime ? 'highlight' : 'highlight-todo')
 | 
					            canvas.addMarker(n.id, completeTask.endTime ? 'highlight' : 'highlight-todo')
 | 
				
			||||||
            n.outgoing?.forEach(nn => {
 | 
					            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 => {
 | 
					          n.outgoing?.forEach(nn => {
 | 
				
			||||||
            let completeTask = this.tasks.find(m => m.definitionKey === nn.targetRef.id)
 | 
					            let completeTask = this.tasks.find(m => m.definitionKey === nn.targetRef.id)
 | 
				
			||||||
            if (completeTask) {
 | 
					            if (completeTask) {
 | 
				
			||||||
@ -145,7 +145,7 @@ export default {
 | 
				
			|||||||
              return
 | 
					              return
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
        } else if (n.$type === 'bpmn:EndEvent') {
 | 
					        } else if (n.$type === 'bpmn:EndEvent') { // 结束节点
 | 
				
			||||||
          if (endTask.definitionKey === n.id && endTask.endTime) {
 | 
					          if (endTask.definitionKey === n.id && endTask.endTime) {
 | 
				
			||||||
            canvas.addMarker(n.id, 'highlight')
 | 
					            canvas.addMarker(n.id, 'highlight')
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <div class="app-container">
 | 
					  <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">
 | 
					      <div slot="header" class="clearfix">
 | 
				
			||||||
        <span class="el-icon-picture-outline">审批任务【{{ item.name }}】</span>
 | 
					        <span class="el-icon-picture-outline">审批任务【{{ item.name }}】</span>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
@ -38,14 +38,14 @@
 | 
				
			|||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </el-col>
 | 
					      </el-col>
 | 
				
			||||||
    </el-card>
 | 
					    </el-card>
 | 
				
			||||||
    <el-card class="box-card" v-loading="historicTasksLoad">
 | 
					    <el-card class="box-card" v-loading="tasksLoad">
 | 
				
			||||||
      <div slot="header" class="clearfix">
 | 
					      <div slot="header" class="clearfix">
 | 
				
			||||||
        <span class="el-icon-picture-outline">审批记录</span>
 | 
					        <span class="el-icon-picture-outline">审批记录</span>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <el-col :span="16" :offset="4" >
 | 
					      <el-col :span="16" :offset="4" >
 | 
				
			||||||
        <div class="block">
 | 
					        <div class="block">
 | 
				
			||||||
          <el-timeline>
 | 
					          <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)">
 | 
					                              :icon="getTimelineItemIcon(item)" :type="getTimelineItemType(item)">
 | 
				
			||||||
              <p style="font-weight: 700">任务:{{ item.name }}</p>
 | 
					              <p style="font-weight: 700">任务:{{ item.name }}</p>
 | 
				
			||||||
              <el-card :body-style="{ padding: '10px' }">
 | 
					              <el-card :body-style="{ padding: '10px' }">
 | 
				
			||||||
@ -73,7 +73,7 @@
 | 
				
			|||||||
      <div slot="header" class="clearfix">
 | 
					      <div slot="header" class="clearfix">
 | 
				
			||||||
        <span class="el-icon-picture-outline">流程图</span>
 | 
					        <span class="el-icon-picture-outline">流程图</span>
 | 
				
			||||||
      </div>
 | 
					      </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>
 | 
					    </el-card>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- 对话框(转派审批人) -->
 | 
					    <!-- 对话框(转派审批人) -->
 | 
				
			||||||
@ -100,7 +100,7 @@ import store from "@/store";
 | 
				
			|||||||
import {decodeFields} from "@/utils/formGenerator";
 | 
					import {decodeFields} from "@/utils/formGenerator";
 | 
				
			||||||
import Parser from '@/components/parser/Parser'
 | 
					import Parser from '@/components/parser/Parser'
 | 
				
			||||||
import {createProcessInstance, getProcessInstance} from "@/api/bpm/processInstance";
 | 
					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 {getDate} from "@/utils/dateUtils";
 | 
				
			||||||
import {listSimpleUsers} from "@/api/system/user";
 | 
					import {listSimpleUsers} from "@/api/system/user";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -130,11 +130,11 @@ export default {
 | 
				
			|||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // 审批记录
 | 
					      // 审批记录
 | 
				
			||||||
      historicTasksLoad: true,
 | 
					      tasksLoad: true,
 | 
				
			||||||
      historicTasks: [],
 | 
					      tasks: [],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // 审批表单
 | 
					      // 审批表单
 | 
				
			||||||
      tasks: [],
 | 
					      runningTasks: [],
 | 
				
			||||||
      auditForms: [],
 | 
					      auditForms: [],
 | 
				
			||||||
      auditRule: {
 | 
					      auditRule: {
 | 
				
			||||||
        comment: [{ required: true, message: "审批建议不能为空", trigger: "blur" }],
 | 
					        comment: [{ required: true, message: "审批建议不能为空", trigger: "blur" }],
 | 
				
			||||||
@ -208,14 +208,14 @@ export default {
 | 
				
			|||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // 获得流程任务列表(审批记录)
 | 
					      // 获得流程任务列表(审批记录)
 | 
				
			||||||
      this.historicTasksLoad = true;
 | 
					      this.tasksLoad = true;
 | 
				
			||||||
      this.tasks = [];
 | 
					      this.runningTasks = [];
 | 
				
			||||||
      this.auditForms = [];
 | 
					      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) {
 | 
					          if (a.endTime && b.endTime) {
 | 
				
			||||||
            return b.endTime - a.endTime;
 | 
					            return b.endTime - a.endTime;
 | 
				
			||||||
@ -231,21 +231,21 @@ export default {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // 需要审核的记录
 | 
					        // 需要审核的记录
 | 
				
			||||||
        const userId = store.getters.userId;
 | 
					        const userId = store.getters.userId;
 | 
				
			||||||
        this.historicTasks.forEach(task => {
 | 
					        this.tasks.forEach(task => {
 | 
				
			||||||
          if (task.result !== 1) { // 只有待处理才需要
 | 
					          if (task.result !== 1) { // 只有待处理才需要
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          if (!task.assigneeUser || task.assigneeUser.id !== userId) { // 自己不是处理人
 | 
					          if (!task.assigneeUser || task.assigneeUser.id !== userId) { // 自己不是处理人
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          this.tasks.push({...task});
 | 
					          this.runningTasks.push({...task});
 | 
				
			||||||
          this.auditForms.push({
 | 
					          this.auditForms.push({
 | 
				
			||||||
            comment: ''
 | 
					            comment: ''
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 取消加载中
 | 
					        // 取消加载中
 | 
				
			||||||
        this.historicTasksLoad = false;
 | 
					        this.tasksLoad = false;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    /** 处理选择流程的按钮操作 **/
 | 
					    /** 处理选择流程的按钮操作 **/
 | 
				
			||||||
@ -325,7 +325,7 @@ export default {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    /** 处理审批通过和不通过的操作 */
 | 
					    /** 处理审批通过和不通过的操作 */
 | 
				
			||||||
    handleAudit(task, pass) {
 | 
					    handleAudit(task, pass) {
 | 
				
			||||||
      const index = this.tasks.indexOf(task);
 | 
					      const index = this.runningTasks.indexOf(task);
 | 
				
			||||||
      this.$refs['form' + index][0].validate(valid => {
 | 
					      this.$refs['form' + index][0].validate(valid => {
 | 
				
			||||||
        if (!valid) {
 | 
					        if (!valid) {
 | 
				
			||||||
          return;
 | 
					          return;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user