Преглед изворни кода

取消驳回,支持回退

lamphua пре 1 година
родитељ
комит
e981ff4524

+ 0
- 12
oa-back/ruoyi-flowable/src/main/java/com/ruoyi/flowable/controller/FlowTaskController.java Прегледај датотеку

@@ -178,18 +178,6 @@ public class FlowTaskController {
178 178
         return flowTaskService.getNextFlowNodeByStart(flowTaskVo);
179 179
     }
180 180
 
181
-    @ApiOperation(value = "判断当前节点是否发起人节点")
182
-    @PostMapping(value = "/isStartUserNode")
183
-    public AjaxResult checkIsStartUserNode(@RequestBody FlowTaskVo flowTaskVo) {
184
-        return flowTaskService.checkIsStartUserNode(flowTaskVo);
185
-    }
186
-
187
-    @ApiOperation(value = "判断登录人是否当前节点人")
188
-    @PostMapping(value = "/isCurrentNodeAssignee")
189
-    public AjaxResult getCurrentNodeAssignee(@RequestBody FlowTaskVo flowTaskVo) {
190
-        return flowTaskService.getCurrentNodeAssignee(flowTaskVo);
191
-    }
192
-
193 181
     /**
194 182
      * 生成流程图
195 183
      *

+ 0
- 14
oa-back/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/IFlowTaskService.java Прегледај датотеку

@@ -186,20 +186,6 @@ public interface IFlowTaskService {
186 186
 
187 187
     AjaxResult getNextFlowNodeByStart(FlowTaskVo flowTaskVo);
188 188
 
189
-    /**
190
-     * 判断当前节点是否发起人节点
191
-     * @param flowTaskVo 任务
192
-     * @return
193
-     */
194
-    AjaxResult checkIsStartUserNode(FlowTaskVo flowTaskVo);
195
-
196
-    /**
197
-     * 判断登录人是否当前节点人
198
-     * @param flowTaskVo 任务
199
-     * @return
200
-     */
201
-    AjaxResult getCurrentNodeAssignee(FlowTaskVo flowTaskVo);
202
-
203 189
     /**
204 190
      * 流程初始化表单
205 191
      * @param deployId

+ 21
- 32
oa-back/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java Прегледај датотеку

@@ -39,7 +39,7 @@ import org.flowable.bpmn.model.*;
39 39
 import org.flowable.common.engine.api.FlowableException;
40 40
 import org.flowable.common.engine.api.FlowableObjectNotFoundException;
41 41
 import org.flowable.common.engine.impl.identity.Authentication;
42
-import org.flowable.engine.*;
42
+import org.flowable.engine.ProcessEngineConfiguration;
43 43
 import org.flowable.engine.history.HistoricActivityInstance;
44 44
 import org.flowable.engine.history.HistoricProcessInstance;
45 45
 import org.flowable.engine.history.HistoricProcessInstanceQuery;
@@ -99,24 +99,15 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
99 99
         if (Objects.isNull(task)) {
100 100
             return AjaxResult.error("任务不存在");
101 101
         }
102
-
103 102
         if (DelegationState.PENDING.equals(task.getDelegationState())) {
104
-            taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment());
103
+            taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getRemark(), taskVo.getComment());
105 104
             taskService.resolveTask(taskVo.getTaskId(), taskVo.getVariables());
106 105
         } else {
107
-            //如果pass变量是通过,存入流程任务变量表
108
-            if (Objects.nonNull(taskVo.getVariables().get("pass")) && taskVo.getVariables().get("pass").equals("通过")) {
109
-                runtimeService.setVariable(task.getExecutionId(), "pass", taskVo.getVariables().get("pass"));
110
-                taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getRemark(), taskVo.getComment());
111
-            }
112
-            else {
113
-                taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.REJECT.getRemark(), taskVo.getComment());
114
-                Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
115
-                taskService.setAssignee(taskVo.getTaskId(), userId.toString());
116
-                taskService.complete(taskVo.getTaskId(), taskVo.getVariables());
117
-            }
106
+            taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getRemark(), taskVo.getComment());
107
+            Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
108
+            taskService.setAssignee(taskVo.getTaskId(), userId.toString());
109
+            taskService.complete(taskVo.getTaskId(), taskVo.getVariables());
118 110
         }
119
-
120 111
         return AjaxResult.success();
121 112
     }
122 113
 
@@ -314,6 +305,18 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
314 305
             runtimeService.createChangeActivityStateBuilder()
315 306
                     .processInstanceId(task.getProcessInstanceId())
316 307
                     .moveActivityIdsToSingleActivityId(currentIds, flowTaskVo.getTargetKey()).changeState();
308
+            String currentTaskId = taskService.createTaskQuery().singleResult().getId();
309
+            List<HistoricTaskInstance> htiList = historyService.createHistoricTaskInstanceQuery()
310
+                    .processInstanceId(task.getProcessInstanceId()).taskDefinitionKey(flowTaskVo.getTargetKey())
311
+                    .list();
312
+            String taskAssignee = "";
313
+            for (HistoricTaskInstance hti: htiList) {
314
+                if (!hti.getId().equals(currentTaskId)) {
315
+                    taskAssignee = hti.getAssignee();
316
+                    break;
317
+                }
318
+            }
319
+            taskService.setAssignee(currentTaskId, taskAssignee);
317 320
         } catch (FlowableObjectNotFoundException e) {
318 321
             throw new CustomException("未找到流程实例,流程可能已发生变化");
319 322
         } catch (FlowableException e) {
@@ -1160,7 +1163,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
1160 1163
      * @param flowTaskVo 任务
1161 1164
      * @return
1162 1165
      */
1163
-    public AjaxResult checkIsStartUserNode(FlowTaskVo flowTaskVo) {
1166
+    public boolean checkIsStartUserNode(FlowTaskVo flowTaskVo) {
1164 1167
         //判断当前是否是第一个发起任务节点,若是就put变量isStartNode为True,让相应的表单可以编辑
1165 1168
         boolean isStartNode= false;
1166 1169
         // 当前任务 task
@@ -1192,22 +1195,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
1192 1195
                 }
1193 1196
             }
1194 1197
         }
1195
-        return AjaxResult.success(isStartNode);
1198
+        return isStartNode;
1196 1199
     }
1197
-
1198
-    /**
1199
-     * 判断登录人是否当前节点人
1200
-     *
1201
-     * @param flowTaskVo 任务
1202
-     * @return
1203
-     */
1204
-    public AjaxResult getCurrentNodeAssignee(FlowTaskVo flowTaskVo) {
1205
-        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
1206
-        TaskService taskService = processEngine.getTaskService();
1207
-        String assignee = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().getAssignee();
1208
-        return AjaxResult.success(Objects.equals(assignee, SecurityUtils.getLoginUser().getUser().getUserId().toString()));
1209
-    }
1210
-
1211 1200
     /**
1212 1201
      * 流程初始化表单
1213 1202
      *
@@ -1325,7 +1314,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
1325 1314
                 Map<String, Object> newParameters = JSON.parseObject(JSON.toJSONString(parameters.get("variables")), Map.class);
1326 1315
                 FlowTaskVo flowTaskVo = new FlowTaskVo();
1327 1316
                 flowTaskVo.setTaskId(taskId);
1328
-//                newParameters.put("disabled", !((Boolean) checkIsStartUserNode(flowTaskVo).get("data")));
1317
+//                newParameters.put("disabled", !checkIsStartUserNode(flowTaskVo));
1329 1318
                 result.put("formData", newParameters);
1330 1319
                 return AjaxResult.success("", result);
1331 1320
             }

+ 6
- 130
oa-back/sql/tony-flowable.sql
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 0
- 18
oa-ui/src/api/flowable/todo.js Прегледај датотеку

@@ -73,24 +73,6 @@ export function getNextFlowNodeByStart(data) {
73 73
   })
74 74
 }
75 75
 
76
-// 判断当前节点是否发起人节点
77
-export function checkIsStartUserNode(data) {
78
-  return request({
79
-    url: '/flowable/task/isStartUserNode',
80
-    method: 'post',
81
-    data: data
82
-  })
83
-}
84
-
85
-// 判断登录人是否当前节点人
86
-export function getCurrentNodeAssignee(data) {
87
-  return request({
88
-    url: '/flowable/task/isCurrentNodeAssignee',
89
-    method: 'post',
90
-    data: data
91
-  })
92
-}
93
-
94 76
 // 部署流程实例
95 77
 export function deployStart(deployId) {
96 78
   return request({

+ 4
- 4
oa-ui/src/views/flowable/form/scTable.vue Прегледај датотеку

@@ -1536,7 +1536,7 @@
1536 1536
       </tr>
1537 1537
     </table>
1538 1538
     <el-row justify="center" type="flex" style="margin-top:20px;"
1539
-      v-if="tableForm.taskName == undefined || tableForm.taskName == '员工修改'">
1539
+      v-if="tableForm.taskName == undefined || tableForm.taskName == '员工填报'">
1540 1540
       <el-button type="primary" @click="submit">提交</el-button>
1541 1541
       <el-button>取消</el-button>
1542 1542
     </el-row>
@@ -1600,7 +1600,7 @@ export default {
1600 1600
             this.form['role' + i] = this.tableForm['role' + i]
1601 1601
         }
1602 1602
       }
1603
-      if (this.tableForm.taskName == '项目负责人审核') {
1603
+      if (this.tableForm.taskName == '负责人审核') {
1604 1604
         this.isPiLeader = true;
1605 1605
         this.isDeptLeader = false;
1606 1606
         this.isManager = false;
@@ -1610,12 +1610,12 @@ export default {
1610 1610
         this.isDeptLeader = true;
1611 1611
         this.isManager = false;
1612 1612
         this.isStaff = false;
1613
-      } else if (this.tableForm.taskName == '分管领导审核') {
1613
+      } else if (this.tableForm.taskName == '分管审核') {
1614 1614
         this.isPiLeader = false;
1615 1615
         this.isDeptLeader = false;
1616 1616
         this.isManager = true;
1617 1617
         this.isStaff = false;
1618
-      } else if (this.tableForm.taskName == '员工修改') {
1618
+      } else if (this.tableForm.taskName == '员工填报') {
1619 1619
         this.isPiLeader = false;
1620 1620
         this.isDeptLeader = false;
1621 1621
         this.isManager = false;

+ 16
- 8
oa-ui/src/views/flowable/task/myProcess/send/index.vue Прегледај датотеку

@@ -224,18 +224,26 @@ export default {
224 224
             this.taskOpen = true;
225 225
             this.taskTitle = "选择任务接收";
226 226
           } else {
227
-            const variables = this.formData.valData;
228
-            const formData = this.formData.formData;
229
-            formData.disabled = true;
230
-            formData.formBtns = false;
231
-            if (this.procDefId) {
232
-              variables.variables = formData;
233
-              // 启动流程并将表单数据加入流程变量
234
-              definitionStart(this.procDefId, JSON.stringify(variables)).then(res => {
227
+            if (this.formData.formData == undefined) {
228
+              definitionStart(this.procDefId, { approval: this.checkValues, formId: this.formId }).then(res => {
235 229
                 this.$modal.msgSuccess(res.msg);
236 230
                 this.goBack();
237 231
               })
238 232
             }
233
+            else {
234
+              const variables = this.formData.valData;
235
+              const formData = this.formData.formData;
236
+              formData.disabled = true;
237
+              formData.formBtns = false;
238
+              if (this.procDefId) {
239
+                variables.variables = formData;
240
+                // 启动流程并将表单数据加入流程变量
241
+                definitionStart(this.procDefId, JSON.stringify(variables)).then(res => {
242
+                  this.$modal.msgSuccess(res.msg);
243
+                  this.goBack();
244
+                })
245
+              }
246
+            }
239 247
           }
240 248
         }
241 249
       })

+ 47
- 60
oa-ui/src/views/flowable/task/todo/detail/index.vue Прегледај датотеку

@@ -11,12 +11,12 @@
11 11
         <!--表单信息-->
12 12
         <el-tab-pane label="表单信息" name="1">
13 13
           <ScTable :tableForm="tableForm" @submit="handleComplete"></ScTable>
14
-          <el-row type="flex" justify="center" v-if="taskName != '员工修改'">
14
+          <el-row type="flex" justify="center" v-if="taskName != '员工填报'">
15 15
             <el-button v-if="!formKeyExist" icon="el-icon-edit-outline" type="success" size="mini"
16 16
               @click="handleComplete">审核通过
17 17
             </el-button>
18
-            <!-- <el-button icon="el-icon-refresh-left" type="warning" size="mini" @click="handleReturn">退回</el-button> -->
19
-            <el-button icon="el-icon-circle-close" type="danger" size="mini" @click="handleReject">驳回</el-button>
18
+            <el-button icon="el-icon-refresh-left" type="warning" size="mini" @click="handleReturn">退回</el-button>
19
+            <!-- <el-button icon="el-icon-circle-close" type="danger" size="mini" @click="handleReject">驳回</el-button> -->
20 20
           </el-row>
21 21
         </el-tab-pane>
22 22
         <!--流程流转记录-->
@@ -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>
@@ -118,6 +121,7 @@
118 121
   </div>
119 122
 </template>
120 123
 
124
+
121 125
 <script>
122 126
 import { flowRecord } from "@/api/flowable/finished";
123 127
 import FlowUser from '@/components/flow/User'
@@ -132,15 +136,12 @@ import {
132 136
   getNextFlowNode,
133 137
   delegate,
134 138
   flowTaskForm,
135
-  checkIsStartUserNode
136 139
 } from "@/api/flowable/todo";
137
-import { getAssess, modifyAssess } from '@/api/oa/assess/assess'
138 140
 import flow from '@/views/flowable/task/todo/detail/flow'
139 141
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
140 142
 import { listUser } from "@/api/system/user";
143
+import { getAssess, modifyAssess, submitAssess } from '@/api/oa/assess/assess';
141 144
 import ScTable from "../../../form/scTable.vue";
142
-import { submitAssess } from '@/api/oa/assess/assess.js'
143
-import { MessageBox } from 'element-ui'
144 145
 
145 146
 export default {
146 147
   name: "Record",
@@ -192,7 +193,6 @@ export default {
192 193
         variables: {
193 194
           variables: {}
194 195
         },
195
-        check: true
196 196
       },
197 197
       assignee: null,
198 198
       formConf: {}, // 默认表单数据
@@ -347,7 +347,6 @@ export default {
347 347
       let formData = new FormData();
348 348
       let form = JSON.stringify(this.tableForm);
349 349
       formData.append("form", form);
350
-      debugger
351 350
       this.submitForm(formData);
352 351
     },
353 352
     /** 用户审批任务 */
@@ -360,7 +359,10 @@ export default {
360 359
         this.$modal.msgError("请选择流程接收角色组!");
361 360
         return;
362 361
       }
363
-      this.$delete(this.taskForm.variables, "pass");
362
+      // if (!this.taskForm.comment) {
363
+      //   this.$modal.msgError("请输入审批意见!");
364
+      //   return;
365
+      // }
364 366
       if (this.taskForm && this.formKeyExist) {
365 367
         // 表单是否禁用
366 368
         this.taskForm.formData.formData.disabled = true;
@@ -398,27 +400,17 @@ export default {
398 400
     handleReject() {
399 401
       this.rejectOpen = true;
400 402
       this.rejectTitle = "驳回流程";
401
-      console.log(this.flowRecordList);
402
-      
403 403
     },
404 404
     /** 驳回任务 */
405 405
     taskReject() {
406
-      if (this.taskForm.variables === null) {
407
-        this.taskForm.variables = {};
408
-      }
409
-      this.$set(this.taskForm.variables, "pass", "驳回");
410
-      complete(this.taskForm).then(response => {
411
-        this.$modal.msgSuccess(response.msg);
412
-        this.goBack();
406
+      this.$refs["taskForm"].validate(valid => {
407
+        if (valid) {
408
+          rejectTask(this.taskForm).then(res => {
409
+            this.$modal.msgSuccess(res.msg);
410
+            this.goBack();
411
+          });
412
+        }
413 413
       });
414
-      // this.$refs["taskForm"].validate(valid => {
415
-      //   if (valid) {
416
-      //     rejectTask(this.taskForm).then(res => {
417
-      //       this.$modal.msgSuccess(res.msg);
418
-      //       this.goBack();
419
-      //     });
420
-      //   }
421
-      // });
422 414
     },
423 415
     /** 可退回任务列表 */
424 416
     handleReturn() {
@@ -470,37 +462,32 @@ export default {
470 462
       if (this.taskForm.variables === null) {
471 463
         this.taskForm.variables = {};
472 464
       }
473
-      //排他网关,表达式,多节点情况下,审核通过,先将流程表达式pass变量存入,便于查找流程下一节点
474
-      this.$set(this.taskForm.variables, "pass", "通过");
475
-      complete(this.taskForm).then(response => {
476
-        const params = { taskId: this.taskForm.taskId }
477
-        // 根据当前任务或者流程设计配置的下一步节点 todo 暂时未涉及到考虑网关、表达式和多节点情况(todo已在上一步实现)
478
-        getNextFlowNode(params).then(res => {
479
-          const data = res.data;
480
-          debugger
481
-          this.taskForm.formData = formData;
482
-          if (data) {
483
-            if (data.dataType === 'dynamic') {
484
-              if (data.type === 'assignee') { // 指定人员
485
-                this.checkSendUser = true;
486
-                this.checkType = "single";
487
-              } else if (data.type === 'candidateUsers') {  // 候选人员(多个)
488
-                this.checkSendUser = true;
489
-                this.checkType = "multiple";
490
-              } else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务)
491
-                this.checkSendRole = true;
492
-              } else { // 会签
493
-                // 流程设计指定的 elementVariable 作为会签人员列表
494
-                this.multiInstanceVars = data.vars;
495
-                this.checkSendUser = true;
496
-                this.checkType = "multiple";
497
-              }
465
+      // 根据当前任务或者流程设计配置的下一步节点 todo 暂时未涉及到考虑网关、表达式和多节点情况
466
+      const params = { taskId: this.taskForm.taskId }
467
+      getNextFlowNode(params).then(res => {
468
+        const data = res.data;
469
+        this.taskForm.formData = formData;
470
+        if (data) {
471
+          if (data.dataType === 'dynamic') {
472
+            if (data.type === 'assignee') { // 指定人员
473
+              this.checkSendUser = true;
474
+              this.checkType = "single";
475
+            } else if (data.type === 'candidateUsers') {  // 候选人员(多个)
476
+              this.checkSendUser = true;
477
+              this.checkType = "multiple";
478
+            } else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务)
479
+              this.checkSendRole = true;
480
+            } else { // 会签
481
+              // 流程设计指定的 elementVariable 作为会签人员列表
482
+              this.multiInstanceVars = data.vars;
483
+              this.checkSendUser = true;
484
+              this.checkType = "multiple";
498 485
             }
499 486
           }
500
-          this.completeOpen = true;
501
-          this.completeTitle = "选择下一节点审核人";
502
-        })
503
-      });
487
+        }
488
+        this.completeOpen = true;
489
+        this.completeTitle = "选择下一节点审核人";
490
+      })
504 491
     },
505 492
   },
506 493
 };
@@ -508,8 +495,8 @@ export default {
508 495
 <style lang="scss" scoped>
509 496
 .test-form {
510 497
   margin: 15px auto;
511
-  // width: 800px;
512
-  padding: 20px;
498
+  width: 800px;
499
+  padding: 15px;
513 500
 }
514 501
 
515 502
 .clearfix:before,

Loading…
Откажи
Сачувај