Ver código fonte

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

lamphua 1 ano atrás
pai
commit
645008e4da

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

2
 
2
 
3
 
3
 
4
 import com.alibaba.fastjson2.JSON;
4
 import com.alibaba.fastjson2.JSON;
5
-import com.alibaba.fastjson2.JSONArray;
6
 import com.alibaba.fastjson2.JSONObject;
5
 import com.alibaba.fastjson2.JSONObject;
7
 import com.alibaba.fastjson2.TypeReference;
6
 import com.alibaba.fastjson2.TypeReference;
8
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9
-import com.ruoyi.common.core.domain.model.LoginUser;
10
 import com.ruoyi.flowable.common.constant.ProcessConstants;
8
 import com.ruoyi.flowable.common.constant.ProcessConstants;
11
 import com.ruoyi.common.core.domain.AjaxResult;
9
 import com.ruoyi.common.core.domain.AjaxResult;
12
 import com.ruoyi.common.core.domain.entity.SysRole;
10
 import com.ruoyi.common.core.domain.entity.SysRole;
38
 import org.flowable.bpmn.model.*;
36
 import org.flowable.bpmn.model.*;
39
 import org.flowable.common.engine.api.FlowableException;
37
 import org.flowable.common.engine.api.FlowableException;
40
 import org.flowable.common.engine.api.FlowableObjectNotFoundException;
38
 import org.flowable.common.engine.api.FlowableObjectNotFoundException;
41
-import org.flowable.common.engine.impl.identity.Authentication;
42
 import org.flowable.engine.*;
39
 import org.flowable.engine.*;
43
 import org.flowable.engine.history.HistoricActivityInstance;
40
 import org.flowable.engine.history.HistoricActivityInstance;
44
 import org.flowable.engine.history.HistoricProcessInstance;
41
 import org.flowable.engine.history.HistoricProcessInstance;
45
 import org.flowable.engine.history.HistoricProcessInstanceQuery;
42
 import org.flowable.engine.history.HistoricProcessInstanceQuery;
46
 import org.flowable.engine.repository.ProcessDefinition;
43
 import org.flowable.engine.repository.ProcessDefinition;
47
-import org.flowable.engine.runtime.ActivityInstance;
48
 import org.flowable.engine.runtime.Execution;
44
 import org.flowable.engine.runtime.Execution;
49
 import org.flowable.engine.runtime.ProcessInstance;
45
 import org.flowable.engine.runtime.ProcessInstance;
50
 import org.flowable.engine.task.Comment;
46
 import org.flowable.engine.task.Comment;
109
                 runtimeService.setVariable(task.getExecutionId(), "pass", taskVo.getVariables().get("pass"));
105
                 runtimeService.setVariable(task.getExecutionId(), "pass", taskVo.getVariables().get("pass"));
110
                 taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getRemark(), taskVo.getComment());
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
                 taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.REJECT.getRemark(), taskVo.getComment());
110
                 taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.REJECT.getRemark(), taskVo.getComment());
114
                 Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
111
                 Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
115
                 taskService.setAssignee(taskVo.getTaskId(), userId.toString());
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
                 taskService.complete(taskVo.getTaskId(), taskVo.getVariables());
118
                 taskService.complete(taskVo.getTaskId(), taskVo.getVariables());
117
             }
119
             }
118
         }
120
         }

+ 1
- 1
oa-ui/src/components/flow/User/index.vue Ver arquivo

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

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

103
         </span>
103
         </span>
104
       </el-dialog>
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
           <el-form-item label="驳回意见" prop="comment" :rules="[{ required: true, message: '请输入意见', trigger: 'blur' }]">
111
           <el-form-item label="驳回意见" prop="comment" :rules="[{ required: true, message: '请输入意见', trigger: 'blur' }]">
109
             <el-input style="width: 50%" type="textarea" v-model="taskForm.comment" placeholder="请输入意见" />
112
             <el-input style="width: 50%" type="textarea" v-model="taskForm.comment" placeholder="请输入意见" />
110
           </el-form-item>
113
           </el-form-item>
398
     handleReject() {
401
     handleReject() {
399
       this.rejectOpen = true;
402
       this.rejectOpen = true;
400
       this.rejectTitle = "驳回流程";
403
       this.rejectTitle = "驳回流程";
401
-    },
402
-    /** 驳回任务 */
403
-    taskReject() {
404
       if (this.taskForm.variables === null) {
404
       if (this.taskForm.variables === null) {
405
         this.taskForm.variables = {};
405
         this.taskForm.variables = {};
406
       }
406
       }
407
+      //排他网关,表达式,多节点情况下,审核通过,先将流程表达式pass变量存入,便于查找流程下一节点
407
       this.$set(this.taskForm.variables, "pass", "驳回");
408
       this.$set(this.taskForm.variables, "pass", "驳回");
408
       complete(this.taskForm).then(response => {
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
       // this.$refs["taskForm"].validate(valid => {
460
       // this.$refs["taskForm"].validate(valid => {
413
       //   if (valid) {
461
       //   if (valid) {
414
       //     rejectTask(this.taskForm).then(res => {
462
       //     rejectTask(this.taskForm).then(res => {

Carregando…
Cancelar
Salvar