diff --git a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/vo/FlowTaskVo.java b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/vo/FlowTaskVo.java index 33cc3ec7..6e240d49 100644 --- a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/vo/FlowTaskVo.java +++ b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/vo/FlowTaskVo.java @@ -35,7 +35,7 @@ public class FlowTaskVo { private String deploymentId; @ApiModelProperty("流程变量信息") - private Map values; + private Map variables; @ApiModelProperty("审批人") private String assignee; diff --git a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowDefinitionServiceImpl.java b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowDefinitionServiceImpl.java index 9e6a04c2..aa218794 100644 --- a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowDefinitionServiceImpl.java +++ b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowDefinitionServiceImpl.java @@ -181,7 +181,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl /** * 根据流程定义ID启动流程实例 * - * @param procDefId 流程定义Id + * @param procDefId 流程模板ID * @param variables 流程变量 * @return */ @@ -193,13 +193,15 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) { return AjaxResult.error("流程已被挂起,请先激活流程"); } -// variables.put("skip", true); -// variables.put(ProcessConstants.FLOWABLE_SKIP_EXPRESSION_ENABLED, true); + // 设置流程发起人Id到流程中 SysUser sysUser = SecurityUtils.getLoginUser().getUser(); identityService.setAuthenticatedUserId(sysUser.getUserId().toString()); - variables.put(ProcessConstants.PROCESS_INITIATOR, ""); - ProcessInstance processInstance = runtimeService.startProcessInstanceById(procDefId, variables); + variables.put(ProcessConstants.PROCESS_INITIATOR, sysUser.getUserId()); + runtimeService.startProcessInstanceById(procDefId, variables); +// variables.put(ProcessConstants.PROCESS_INITIATOR, sysUser.getUserId()); + // variables.put("skip", true); +// variables.put(ProcessConstants.FLOWABLE_SKIP_EXPRESSION_ENABLED, true); // // 给第一步申请人节点设置任务执行人和意见 todo:第一个节点不设置为申请人节点有点问题? // Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult(); // if (Objects.nonNull(task)) { diff --git a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java index 1bc508ca..153a671c 100644 --- a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java +++ b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java @@ -90,12 +90,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask } if (DelegationState.PENDING.equals(task.getDelegationState())) { taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment()); - taskService.resolveTask(taskVo.getTaskId(), taskVo.getValues()); + taskService.resolveTask(taskVo.getTaskId(), taskVo.getVariables()); } else { taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment()); Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); taskService.setAssignee(taskVo.getTaskId(), userId.toString()); - taskService.complete(taskVo.getTaskId(), taskVo.getValues()); + taskService.complete(taskVo.getTaskId(), taskVo.getVariables()); } return AjaxResult.success(); } @@ -616,6 +616,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask @Override public AjaxResult todoList(Integer pageNum, Integer pageSize) { Page page = new Page<>(); + // 只查看自己的数据 Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); TaskQuery taskQuery = taskService.createTaskQuery() .active() @@ -648,8 +649,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask .processInstanceId(task.getProcessInstanceId()) .singleResult(); SysUser startUser = sysUserService.selectUserById(Long.parseLong(historicProcessInstance.getStartUserId())); -// SysUser startUser = sysUserService.selectUserById(Long.parseLong(task.getAssignee())); - flowTask.setStartUserId(startUser.getNickName()); + flowTask.setStartUserId(startUser.getUserId().toString()); flowTask.setStartUserName(startUser.getNickName()); flowTask.setStartDeptName(startUser.getDept().getDeptName()); flowList.add(flowTask); @@ -916,6 +916,11 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask */ @Override public AjaxResult processVariables(String taskId) { +// HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() +// .processInstanceId(task.getProcessInstanceId()) +// .singleResult(); +// SysUser startUser = sysUserService.selectUserById(Long.parseLong(historicProcessInstance.getStartUserId())); + // 流程变量 HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().finished().taskId(taskId).singleResult(); if (Objects.nonNull(historicTaskInstance)) { @@ -946,10 +951,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics(); // 会签节点 if (Objects.nonNull(multiInstance)) { - List list = sysUserService.selectUserList(new SysUser()); flowNextDto.setVars(ProcessConstants.PROCESS_MULTI_INSTANCE_USER); flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE); - flowNextDto.setUserList(list); } else { // 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组 String dataType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_DATA_TYPE); @@ -982,16 +985,14 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask // Step 1. 获取当前节点并找到下一步节点 FlowNextDto flowNextDto = new FlowNextDto(); // Step 2. 获取当前流程所有流程变量(网关节点时需要校验表达式) - List nextUserTask = FindNextNodeUtil.getNextUserTasksByStart(repositoryService, processDefinition, new HashMap<>()); + List nextUserTask = FindNextNodeUtil.getNextUserTasksByStart(repositoryService, processDefinition, flowTaskVo.getVariables()); if (CollectionUtils.isNotEmpty(nextUserTask)) { for (UserTask userTask : nextUserTask) { MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics(); // 会签节点 if (Objects.nonNull(multiInstance)) { - List list = sysUserService.selectUserList(new SysUser()); flowNextDto.setVars(ProcessConstants.PROCESS_MULTI_INSTANCE_USER); flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE); - flowNextDto.setUserList(list); } else { // 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组 String dataType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_DATA_TYPE); diff --git a/ruoyi-ui/src/components/flow/Role/index.vue b/ruoyi-ui/src/components/flow/Role/index.vue index 9b0221bc..8bb4518b 100644 --- a/ruoyi-ui/src/components/flow/Role/index.vue +++ b/ruoyi-ui/src/components/flow/Role/index.vue @@ -75,7 +75,7 @@ export default { checkType: { type: String, default: 'multiple', - required: true + required: false }, }, data() { @@ -126,7 +126,7 @@ export default { }, roleList: { handler(newVal) { - if (newVal) { + if (newVal && this.selectRoleList) { this.$nextTick(() => { this.$refs.dataTable.clearSelection(); this.selectRoleList?.split(',').forEach(key => { diff --git a/ruoyi-ui/src/components/flow/User/index.vue b/ruoyi-ui/src/components/flow/User/index.vue index b0abad01..90b4b827 100644 --- a/ruoyi-ui/src/components/flow/User/index.vue +++ b/ruoyi-ui/src/components/flow/User/index.vue @@ -35,7 +35,7 @@ v-model="queryParams.userName" placeholder="请输入用户名称" clearable - style="width: 240px" + style="width: 150px" @keyup.enter.native="handleQuery" /> @@ -44,7 +44,7 @@ v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable - style="width: 240px" + style="width: 150px" @keyup.enter.native="handleQuery" /> @@ -181,7 +181,7 @@ export default { }, userList: { handler(newVal) { - if (newVal) { + if (newVal && this.selectUserList) { this.$nextTick(() => { this.$refs.dataTable.clearSelection(); this.selectUserList?.split(',').forEach(key => { @@ -234,7 +234,7 @@ export default { // 单选框选中数据 handleSingleUserSelect(selection) { this.radioSelected = selection.userId;//点击当前行时,radio同样有选中效果 - this.$emit('handleUserSelect', selection.toString()); + this.$emit('handleUserSelect', selection); }, /** 搜索按钮操作 */ handleQuery() { diff --git a/ruoyi-ui/src/views/flowable/task/finished/detail/index.vue b/ruoyi-ui/src/views/flowable/task/finished/detail/index.vue index 0df7afea..c03f1496 100644 --- a/ruoyi-ui/src/views/flowable/task/finished/detail/index.vue +++ b/ruoyi-ui/src/views/flowable/task/finished/detail/index.vue @@ -1,24 +1,21 @@ @@ -76,7 +73,7 @@ import {flowRecord} from "@/api/flowable/finished"; import Parser from '@/components/parser/Parser' import {getProcessVariables, readXml, getFlowViewer} from "@/api/flowable/definition"; -import flow from '@/views/flowable/task/record/flow' +import flow from '@/views/flowable/task/finished/detail/flow' import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import Treeselect from "@riophae/vue-treeselect"; @@ -137,6 +134,9 @@ export default { this.getFlowRecordList( this.taskForm.procInsId, this.taskForm.deployId); }, methods: { + handleClick(tab, event) { + console.log(tab, event); + }, /** xml 文件 */ getModelDetail(deployId) { // 发送请求,获取xml diff --git a/ruoyi-ui/src/views/flowable/task/myProcess/detail/index.vue b/ruoyi-ui/src/views/flowable/task/myProcess/detail/index.vue index e3400d48..9493e387 100644 --- a/ruoyi-ui/src/views/flowable/task/myProcess/detail/index.vue +++ b/ruoyi-ui/src/views/flowable/task/myProcess/detail/index.vue @@ -1,23 +1,21 @@ @@ -75,7 +74,7 @@ import {flowRecord} from "@/api/flowable/finished"; import Parser from '@/components/parser/Parser' import {getProcessVariables, readXml, getFlowViewer} from "@/api/flowable/definition"; -import flow from '@/views/flowable/task/record/flow' +import flow from '@/views/flowable/task/myProcess/detail/flow' import "@riophae/vue-treeselect/dist/vue-treeselect.css"; export default { @@ -121,6 +120,9 @@ export default { this.getFlowRecordList(this.taskForm.procInsId, this.taskForm.deployId); }, methods: { + handleClick(tab, event) { + console.log(tab, event); + }, /** xml 文件 */ getModelDetail(deployId) { // 发送请求,获取xml diff --git a/ruoyi-ui/src/views/flowable/task/myProcess/send/flow.vue b/ruoyi-ui/src/views/flowable/task/myProcess/send/flow.vue index 7cd8334b..095d2547 100644 --- a/ruoyi-ui/src/views/flowable/task/myProcess/send/flow.vue +++ b/ruoyi-ui/src/views/flowable/task/myProcess/send/flow.vue @@ -6,7 +6,7 @@ :is-view="true" :taskList="taskData" />--> - + @@ -202,33 +121,6 @@ export default { min-height: 650px; } - .highlight.djs-shape .djs-visual > :nth-child(1) { - fill: green !important; - stroke: green !important; - fill-opacity: 0.2 !important; - } - .highlight.djs-shape .djs-visual > :nth-child(2) { - fill: green !important; - } - .highlight.djs-shape .djs-visual > path { - fill: green !important; - fill-opacity: 0.2 !important; - stroke: green !important; - } - .highlight.djs-connection > .djs-visual > path { - stroke: green !important; - } - .highlight-todo.djs-connection > .djs-visual > path { - stroke: orange !important; - stroke-dasharray: 4px !important; - fill-opacity: 0.2 !important; - } - .highlight-todo.djs-shape .djs-visual > :nth-child(1) { - fill: orange !important; - stroke: orange !important; - stroke-dasharray: 4px !important; - fill-opacity: 0.2 !important; - } .overlays-div { font-size: 10px; color: red; diff --git a/ruoyi-ui/src/views/flowable/task/myProcess/send/index.vue b/ruoyi-ui/src/views/flowable/task/myProcess/send/index.vue index 52fa0da4..df66fea9 100644 --- a/ruoyi-ui/src/views/flowable/task/myProcess/send/index.vue +++ b/ruoyi-ui/src/views/flowable/task/myProcess/send/index.vue @@ -2,42 +2,34 @@
- 基础信息 - 返回 + 发起任务 + 关闭
- - -
- -
-
-
- - - - - - - - - - - - - - - - 取 消 - 确 定 - - - - - -
- 流程图 -
- + + + + + +
+ +
+
+
+ + + + +
+ 关闭 + + + + + + 取 消 + 提 交 + +
@@ -45,26 +37,25 @@