Browse Source

驳回至员工修改,不需选人,驳回至审批人,需要选人

lamphua 1 year ago
parent
commit
645008e4da

+ 7
- 5
oa-back/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java View File

@@ -2,11 +2,9 @@ package com.ruoyi.flowable.service.impl;
2 2
 
3 3
 
4 4
 import com.alibaba.fastjson2.JSON;
5
-import com.alibaba.fastjson2.JSONArray;
6 5
 import com.alibaba.fastjson2.JSONObject;
7 6
 import com.alibaba.fastjson2.TypeReference;
8 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9
-import com.ruoyi.common.core.domain.model.LoginUser;
10 8
 import com.ruoyi.flowable.common.constant.ProcessConstants;
11 9
 import com.ruoyi.common.core.domain.AjaxResult;
12 10
 import com.ruoyi.common.core.domain.entity.SysRole;
@@ -38,13 +36,11 @@ import org.flowable.bpmn.model.Process;
38 36
 import org.flowable.bpmn.model.*;
39 37
 import org.flowable.common.engine.api.FlowableException;
40 38
 import org.flowable.common.engine.api.FlowableObjectNotFoundException;
41
-import org.flowable.common.engine.impl.identity.Authentication;
42 39
 import org.flowable.engine.*;
43 40
 import org.flowable.engine.history.HistoricActivityInstance;
44 41
 import org.flowable.engine.history.HistoricProcessInstance;
45 42
 import org.flowable.engine.history.HistoricProcessInstanceQuery;
46 43
 import org.flowable.engine.repository.ProcessDefinition;
47
-import org.flowable.engine.runtime.ActivityInstance;
48 44
 import org.flowable.engine.runtime.Execution;
49 45
 import org.flowable.engine.runtime.ProcessInstance;
50 46
 import org.flowable.engine.task.Comment;
@@ -109,10 +105,16 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
109 105
                 runtimeService.setVariable(task.getExecutionId(), "pass", taskVo.getVariables().get("pass"));
110 106
                 taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getRemark(), taskVo.getComment());
111 107
             }
112
-            else {
108
+            else if (Objects.nonNull(taskVo.getVariables().get("pass")) && taskVo.getVariables().get("pass").equals("驳回")) {
109
+                runtimeService.setVariable(task.getExecutionId(), "pass", taskVo.getVariables().get("pass"));
113 110
                 taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.REJECT.getRemark(), taskVo.getComment());
114 111
                 Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
115 112
                 taskService.setAssignee(taskVo.getTaskId(), userId.toString());
113
+            }
114
+            else {
115
+                taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getRemark(), taskVo.getComment());
116
+                Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
117
+                taskService.setAssignee(taskVo.getTaskId(), userId.toString());
116 118
                 taskService.complete(taskVo.getTaskId(), taskVo.getVariables());
117 119
             }
118 120
         }

+ 1
- 1
oa-ui/src/components/flow/User/index.vue View File

@@ -144,7 +144,7 @@ export default {
144 144
       // 查询参数
145 145
       queryParams: {
146 146
         pageNum: 1,
147
-        pageSize: 5,
147
+        pageSize: 8,
148 148
         userName: undefined,
149 149
         phonenumber: undefined,
150 150
         status: undefined,

+ 55
- 7
oa-ui/src/views/flowable/task/todo/detail/index.vue View File

@@ -103,8 +103,11 @@
103 103
         </span>
104 104
       </el-dialog>
105 105
       <!--驳回流程-->
106
-      <el-dialog :title="rejectTitle" :visible.sync="rejectOpen" width="40%" append-to-body>
107
-        <el-form ref="taskForm" :model="taskForm" label-width="80px">
106
+      <el-dialog :title="rejectTitle" :visible.sync="rejectOpen" width="60%" append-to-body>
107
+        <el-form ref="taskForm" :model="taskForm">
108
+          <el-form-item prop="targetKey">
109
+            <flow-user v-if="checkSendUser" :checkType="checkType" @handleUserSelect="handleUserSelect"></flow-user>
110
+          </el-form-item>
108 111
           <el-form-item label="驳回意见" prop="comment" :rules="[{ required: true, message: '请输入意见', trigger: 'blur' }]">
109 112
             <el-input style="width: 50%" type="textarea" v-model="taskForm.comment" placeholder="请输入意见" />
110 113
           </el-form-item>
@@ -398,17 +401,62 @@ export default {
398 401
     handleReject() {
399 402
       this.rejectOpen = true;
400 403
       this.rejectTitle = "驳回流程";
401
-    },
402
-    /** 驳回任务 */
403
-    taskReject() {
404 404
       if (this.taskForm.variables === null) {
405 405
         this.taskForm.variables = {};
406 406
       }
407
+      //排他网关,表达式,多节点情况下,审核通过,先将流程表达式pass变量存入,便于查找流程下一节点
407 408
       this.$set(this.taskForm.variables, "pass", "驳回");
408 409
       complete(this.taskForm).then(response => {
409
-        this.$modal.msgSuccess(response.msg);
410
-        this.goBack();
410
+        const params = { taskId: this.taskForm.taskId }
411
+        // 根据当前任务或者流程设计配置的下一步节点 todo 暂时未涉及到考虑网关、表达式和多节点情况(todo已在上一步实现)
412
+        getNextFlowNode(params).then(res => {
413
+          const data = res.data;
414
+          if (data) {
415
+            if (data.dataType === 'dynamic') {
416
+              if (data.type === 'assignee') { // 指定人员
417
+                this.checkSendUser = true;
418
+                this.checkType = "single";
419
+              } else if (data.type === 'candidateUsers') {  // 候选人员(多个)
420
+                this.checkSendUser = true;
421
+                this.checkType = "multiple";
422
+              } else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务)
423
+                this.checkSendRole = true;
424
+              } else { // 会签
425
+                // 流程设计指定的 elementVariable 作为会签人员列表
426
+                this.multiInstanceVars = data.vars;
427
+                this.checkSendUser = true;
428
+                this.checkType = "multiple";
429
+              }
430
+            }
431
+          }
432
+        })
411 433
       });
434
+    },
435
+    /** 驳回任务 */
436
+    taskReject() {      
437
+      if (!this.taskForm.variables && this.checkSendUser) {
438
+        this.$modal.msgError("请选择流程接收人员!");
439
+        return;
440
+      }
441
+      this.$delete(this.taskForm.variables, "pass");
442
+      if (this.taskForm && this.formKeyExist) {
443
+        // 表单是否禁用
444
+        this.taskForm.formData.formData.disabled = true;
445
+        // 是否显示按钮
446
+        this.taskForm.formData.formData.formBtns = false;
447
+        this.taskForm.variables = Object.assign({}, this.taskForm.variables, this.taskForm.formData.valData);
448
+        this.taskForm.variables.variables = this.taskForm.formData.formData;
449
+        complete(this.taskForm).then(response => {
450
+          this.$modal.msgSuccess(response.msg);
451
+          this.goBack();
452
+        });
453
+      } else {
454
+        // 流程设计人员类型配置为固定人员接收任务时,直接提交任务到下一步
455
+        complete(this.taskForm).then(response => {
456
+          this.$modal.msgSuccess(response.msg);
457
+          this.goBack();
458
+        });
459
+      }
412 460
       // this.$refs["taskForm"].validate(valid => {
413 461
       //   if (valid) {
414 462
       //     rejectTask(this.taskForm).then(res => {

Loading…
Cancel
Save