From 5022ed2533d3f4e2b8334eb9018908bea8cc07b5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 16 Jan 2022 23:36:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=2060%=20-=20=E5=AE=A1=E6=89=B9=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/task/impl/BpmTaskServiceImpl.java | 5 +- .../src/views/bpm/processInstance/detail.vue | 82 ++++++++++++++++++- 2 files changed, 83 insertions(+), 4 deletions(-) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java index 21b9903a1..b988e2554 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java @@ -95,7 +95,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { // 获得任务列表 List tasks = historyService.createHistoricTaskInstanceQuery() .processInstanceId(processInstanceId) - .orderByTaskCreateTime().desc().list(); + .orderByHistoricTaskInstanceStartTime().desc() // 创建时间倒序 + .list(); if (CollUtil.isEmpty(tasks)) { return Collections.emptyList(); } @@ -401,7 +402,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { @Override public void updateTaskExtComplete(org.activiti.api.task.model.Task task) { BpmTaskExtDO taskExtDO = BpmTaskConvert.INSTANCE.convert(task) - .setEndTime(task.getCompletedDate()) + .setEndTime(new Date()) // 此时不能使用 task 的 completeData,因为还是空的。 .setResult(BpmProcessInstanceResultEnum.APPROVE.getResult()); taskExtMapper.updateByTaskId(taskExtDO); } diff --git a/yudao-admin-ui/src/views/bpm/processInstance/detail.vue b/yudao-admin-ui/src/views/bpm/processInstance/detail.vue index 7b11a4145..d7133b123 100644 --- a/yudao-admin-ui/src/views/bpm/processInstance/detail.vue +++ b/yudao-admin-ui/src/views/bpm/processInstance/detail.vue @@ -12,7 +12,37 @@ - + +
+ 审批记录 +
+ +
+ + +

任务:{{ item.name }}

+ + + + + + + + +

+ {{ item.comment }} +

+
+
+
+
+
+
@@ -31,6 +61,7 @@ import {decodeFields} from "@/utils/formGenerator"; import Parser from '@/components/parser/Parser' import {createProcessInstance, getMyProcessInstancePage, getProcessInstance} from "@/api/bpm/processInstance"; import {getHistoricTaskListByProcessInstanceId} from "@/api/bpm/task"; +import {getDate} from "@/utils/dateUtils"; // 流程实例的详情页,可用于审批 export default { @@ -114,7 +145,21 @@ export default { this.historicTasksLoad = true; getHistoricTaskListByProcessInstanceId(this.id).then(response => { this.historicTasks = response.data; - this.historicTasksLoad = true; + // 排序,将未完成的排在前面,已完成的排在后面; + this.historicTasks.sort((a, b) => { + // 有已完成的情况,按照完成时间倒序 + if (a.endTime && b.endTime) { + return b.endTime - a.endTime; + } else if (a.endTime) { + return 1; + } else if (b.endTime) { + return -1; + // 都是未完成,按照创建时间倒序 + } else { + return b.createTime - a.createTime; + } + }); + this.historicTasksLoad = false; }); }, /** 处理选择流程的按钮操作 **/ @@ -161,6 +206,39 @@ export default { conf.formBtns = true; // 按钮展示 }) }, + getDateStar(ms) { + return getDate(ms); + }, + getTimelineItemIcon(item) { + if (item.result === 1) { + return 'el-icon-time'; + } + if (item.result === 2) { + return 'el-icon-check'; + } + if (item.result === 3) { + return 'el-icon-close'; + } + if (item.result === 4) { + return 'el-icon-remove-outline'; + } + return ''; + }, + getTimelineItemType(item) { + if (item.result === 1) { + return 'primary'; + } + if (item.result === 2) { + return 'success'; + } + if (item.result === 3) { + return 'danger'; + } + if (item.result === 4) { + return 'info'; + } + return ''; + }, } };