From d16185f87d06885df206946b2b949d7a7c78c3a7 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Thu, 28 Oct 2021 00:51:57 +0800 Subject: [PATCH] =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E4=B8=BA=E5=A4=96=E7=BD=AE=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/ruoyi-vue-pro.sql | 3 +- .../controller/oa/OaLeaveController.java | 8 + .../controller/oa/vo/OaLeaveCreateReqVO.java | 1 + .../controller/oa/vo/OaLeaveUpdateReqVO.java | 7 + .../workflow/ProcessDefinitionController.java | 34 +++ .../controller/workflow/TaskController.java | 5 + .../controller/workflow/vo/TaskStepVO.java | 2 + .../workflow/vo/TodoTaskRespVO.java | 3 + .../service/oa/ReportBackEndProcessor.java | 19 +- .../service/oa/impl/OaLeaveServiceImpl.java | 34 ++- .../service/workflow/TaskService.java | 2 + .../workflow/impl/TaskServiceImpl.java | 59 ++--- .../resources/processes/leave-formkey.bpmn | 152 +++++++++++++ .../src/main/resources/processes/leave.bpmn | 130 ----------- yudao-admin-ui/src/api/oa/flow.js | 9 + yudao-admin-ui/src/api/oa/leave.js | 8 + yudao-admin-ui/src/api/oa/todo.js | 8 + yudao-admin-ui/src/router/index.js | 70 ++++++ yudao-admin-ui/src/views/oa/flow/index.vue | 36 +++ .../src/views/oa/leave/apply/index.vue | 93 ++++++++ .../src/views/oa/leave/approve-hr/index.vue | 190 ++++++++++++++++ .../views/oa/leave/approve-leader/index.vue | 190 ++++++++++++++++ .../src/views/oa/leave/confirm/index.vue | 137 ++++++++++++ yudao-admin-ui/src/views/oa/leave/index.vue | 64 ++++-- .../src/views/oa/leave/modify/index.vue | 211 ++++++++++++++++++ yudao-admin-ui/src/views/oa/todo/index.vue | 25 ++- 更新日志.md | 11 + 27 files changed, 1328 insertions(+), 183 deletions(-) create mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/ProcessDefinitionController.java create mode 100644 yudao-admin-server/src/main/resources/processes/leave-formkey.bpmn delete mode 100644 yudao-admin-server/src/main/resources/processes/leave.bpmn create mode 100644 yudao-admin-ui/src/api/oa/flow.js create mode 100644 yudao-admin-ui/src/views/oa/flow/index.vue create mode 100644 yudao-admin-ui/src/views/oa/leave/apply/index.vue create mode 100644 yudao-admin-ui/src/views/oa/leave/approve-hr/index.vue create mode 100644 yudao-admin-ui/src/views/oa/leave/approve-leader/index.vue create mode 100644 yudao-admin-ui/src/views/oa/leave/confirm/index.vue create mode 100644 yudao-admin-ui/src/views/oa/leave/modify/index.vue diff --git a/sql/ruoyi-vue-pro.sql b/sql/ruoyi-vue-pro.sql index 2b9c359dd..f42642e2b 100644 --- a/sql/ruoyi-vue-pro.sql +++ b/sql/ruoyi-vue-pro.sql @@ -733,13 +733,14 @@ INSERT INTO `sys_menu` VALUES (1113, '错误码更新', 'system:error-code:updat INSERT INTO `sys_menu` VALUES (1114, '错误码删除', 'system:error-code:delete', 3, 4, 1110, '', '', '', 0, '', '2021-04-13 21:46:42', '', '2021-04-13 22:09:51', b'0'); INSERT INTO `sys_menu` VALUES (1115, '错误码导出', 'system:error-code:export', 3, 5, 1110, '', '', '', 0, '', '2021-04-13 21:46:42', '', '2021-04-13 22:09:55', b'0'); INSERT INTO `sys_menu` VALUES (1116, '日志中心', '', 2, 8, 2, 'log-center', 'log', 'infra/skywalking/log', 0, '1', '2021-04-26 22:35:45', '1', '2021-04-26 22:37:25', b'0'); -INSERT INTO `sys_menu` VALUES (1118,'请假申请','',2,0,5,'oa/leave','user','oa/leave/index',0,'','2021-09-20 08:51:03','1','2021-10-12 22:19:02',0x00); +INSERT INTO `sys_menu` VALUES (1118,'请假查询','',2,0,5,'oa/leave','user','oa/leave/index',0,'','2021-09-20 08:51:03','1','2021-10-12 22:19:02',0x00); INSERT INTO `sys_menu` VALUES (1119,'请假申请查询','oa:leave:query',3,1,1118,'','','',0,'','2021-09-20 08:51:03','','2021-09-20 08:51:03',0x00); INSERT INTO `sys_menu` VALUES (1120,'请假申请创建','oa:leave:create',3,2,1118,'','','',0,'','2021-09-20 08:51:03','','2021-09-20 08:51:03',0x00); INSERT INTO `sys_menu` VALUES (1121,'请假申请更新','oa:leave:update',3,3,1118,'','','',0,'','2021-09-20 08:51:03','','2021-09-20 08:51:03',0x00); INSERT INTO `sys_menu` VALUES (1122,'请假申请删除','oa:leave:delete',3,4,1118,'','','',0,'','2021-09-20 08:51:03','','2021-09-20 08:51:03',0x00); INSERT INTO `sys_menu` VALUES (1123,'请假申请导出','oa:leave:export',3,5,1118,'','','',0,'','2021-09-20 08:51:03','','2021-09-20 08:51:03',0x00); INSERT INTO `sys_menu` VALUES (1124,'待办任务','',2,2,5,'todo','edit','oa/todo/index',0,'1','2021-09-20 22:10:09','1','2021-09-21 23:17:12',0x00); +INSERT INTO `sys_menu` VALUES (1125,'流程申请','',2,3,5,'flow','form','oa/flow/index',0,'1','2021-10-23 22:10:09','1','2021-10-23 23:17:12',0x00); COMMIT; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/OaLeaveController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/OaLeaveController.java index e8dd527b9..679c667da 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/OaLeaveController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/OaLeaveController.java @@ -41,6 +41,14 @@ public class OaLeaveController { @ApiOperation("创建请假申请") @PreAuthorize("@ss.hasPermission('oa:leave:create')") public CommonResult createLeave(@Valid @RequestBody OaLeaveCreateReqVO createReqVO) { + createReqVO.setProcessKey("leave"); + return success(leaveService.createLeave(createReqVO)); + } + + @PostMapping("/form-key/create") + @ApiOperation("创建外置请假申请") + public CommonResult createFormKeyLeave(@Valid @RequestBody OaLeaveCreateReqVO createReqVO) { + createReqVO.setProcessKey("leave-formkey"); return success(leaveService.createLeave(createReqVO)); } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveCreateReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveCreateReqVO.java index 29cede1ff..ccbb70d71 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveCreateReqVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveCreateReqVO.java @@ -11,4 +11,5 @@ import javax.validation.constraints.*; @ToString(callSuper = true) public class OaLeaveCreateReqVO extends OaLeaveBaseVO { + private String processKey; } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveUpdateReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveUpdateReqVO.java index dc81fa31e..17a229d5f 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveUpdateReqVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveUpdateReqVO.java @@ -15,4 +15,11 @@ public class OaLeaveUpdateReqVO extends OaLeaveBaseVO { @NotNull(message = "请假表单主键不能为空") private Long id; + + private String taskId; + + private String comment; + + private Map variables; + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/ProcessDefinitionController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/ProcessDefinitionController.java new file mode 100644 index 000000000..d5241263c --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/ProcessDefinitionController.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import org.activiti.api.process.runtime.ProcessRuntime; +import org.activiti.engine.RepositoryService; +import org.activiti.engine.repository.ProcessDefinition; +import org.activiti.engine.repository.ProcessDefinitionQuery; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@RestController +@RequestMapping("/workflow/process/definition") +public class ProcessDefinitionController { + + @Resource + private RepositoryService repositoryService; + + @Resource + private ProcessRuntime processRuntime; + + + @GetMapping(value = "/getStartForm") + public CommonResult getStartForm(@RequestParam("processKey") String processKey){ + //这样查似乎有问题??, 暂时写死 +// final ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery(). +// processDefinitionKey(processKey).latestVersion().singleResult(); +// processRuntime.processDefinition(processDefinition.getId()).getFormKey(); + return CommonResult.success("/flow/leave/apply"); + } +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/TaskController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/TaskController.java index 3a717f116..9309cca9e 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/TaskController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/TaskController.java @@ -43,6 +43,11 @@ public class TaskController { return success( taskService.getTaskSteps(taskQuery)); } + @PostMapping("/formKey") + public CommonResult getTaskFormKey(@RequestBody TaskQueryReqVO taskQuery) { + return success( taskService.getTaskFormKey(taskQuery)); + } + @PostMapping("/complete") public CommonResult complete(@RequestBody TaskReqVO taskReq) { taskService.completeTask(taskReq); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/vo/TaskStepVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/vo/TaskStepVO.java index fe2335562..b1bb93ac6 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/vo/TaskStepVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/vo/TaskStepVO.java @@ -19,4 +19,6 @@ public class TaskStepVO { private String comment; + private Integer status; + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/vo/TodoTaskRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/vo/TodoTaskRespVO.java index 5fef60eb5..685324b1b 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/vo/TodoTaskRespVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/workflow/vo/TodoTaskRespVO.java @@ -27,4 +27,7 @@ public class TodoTaskRespVO { private String businessKey; + + private String formKey; + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/ReportBackEndProcessor.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/ReportBackEndProcessor.java index 05ed6fb7d..44991ec8c 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/ReportBackEndProcessor.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/ReportBackEndProcessor.java @@ -3,7 +3,9 @@ package cn.iocoder.yudao.adminserver.modules.activiti.service.oa; import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO; import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import org.activiti.engine.delegate.DelegateExecution; import org.activiti.engine.delegate.DelegateTask; +import org.activiti.engine.delegate.ExecutionListener; import org.activiti.engine.delegate.TaskListener; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -11,16 +13,27 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; @Component -public class ReportBackEndProcessor implements TaskListener { +public class ReportBackEndProcessor implements ExecutionListener { @Resource private OaLeaveMapper leaveMapper; +// @Override +// @Transactional(rollbackFor = Exception.class) +// public void notify(DelegateTask delegateTask) { +// final String businessKey = delegateTask.getExecution().getProcessInstanceBusinessKey(); +// UpdateWrapper updateWrapper = new UpdateWrapper<>(); +// updateWrapper.eq("id", Long.valueOf(businessKey)); +// OaLeaveDO updateDo = new OaLeaveDO(); +// updateDo.setStatus(2); +// leaveMapper.update(updateDo, updateWrapper); +// } + @Override @Transactional(rollbackFor = Exception.class) - public void notify(DelegateTask delegateTask) { - final String businessKey = delegateTask.getExecution().getProcessInstanceBusinessKey(); + public void notify(DelegateExecution delegateExecution) { + final String businessKey = delegateExecution.getProcessInstanceBusinessKey(); UpdateWrapper updateWrapper = new UpdateWrapper<>(); updateWrapper.eq("id", Long.valueOf(businessKey)); OaLeaveDO updateDo = new OaLeaveDO(); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/impl/OaLeaveServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/impl/OaLeaveServiceImpl.java index c82e7a100..0e78ef2b4 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/impl/OaLeaveServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/impl/OaLeaveServiceImpl.java @@ -2,6 +2,9 @@ package cn.iocoder.yudao.adminserver.modules.activiti.service.oa.impl; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import org.activiti.api.task.model.Task; +import org.activiti.api.task.model.builders.TaskPayloadBuilder; +import org.activiti.api.task.runtime.TaskRuntime; import org.activiti.engine.RuntimeService; import org.activiti.engine.runtime.ProcessInstance; import org.springframework.beans.factory.annotation.Autowired; @@ -38,6 +41,12 @@ public class OaLeaveServiceImpl implements OaLeaveService { @Resource private RuntimeService runtimeService; + @Resource + private org.activiti.engine.TaskService activitiTaskService; + + @Resource + private TaskRuntime taskRuntime; + @Override @Transactional(rollbackFor = Exception.class) public Long createLeave(OaLeaveCreateReqVO createReqVO) { @@ -52,7 +61,7 @@ public class OaLeaveServiceImpl implements OaLeaveService { variables.put("deptLeader", "admin"); final Long id = leave.getId(); String businessKey = String.valueOf(id); - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("leave", businessKey, variables); + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(createReqVO.getProcessKey(), businessKey, variables); final String processInstanceId = processInstance.getProcessInstanceId(); @@ -67,12 +76,29 @@ public class OaLeaveServiceImpl implements OaLeaveService { } @Override + @Transactional(rollbackFor = Exception.class) public void updateLeave(OaLeaveUpdateReqVO updateReqVO) { + // 校验存在 this.validateLeaveExists(updateReqVO.getId()); - // 更新 - OaLeaveDO updateObj = OaLeaveConvert.INSTANCE.convert(updateReqVO); - leaveMapper.updateById(updateObj); + + final Task task = taskRuntime.task(updateReqVO.getTaskId()); + activitiTaskService.addComment(task.getId(), task.getProcessInstanceId(), updateReqVO.getComment()); + Map variables = updateReqVO.getVariables(); + + //如何得到部门领导人, 暂时写死 + variables.put("deptLeader", "admin"); + taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(task.getId()) + .withVariables(variables) + .build()); + final Object reApply = variables.get("reApply"); + if((reApply instanceof Boolean) && (Boolean)reApply){ + // 更新 表单 + OaLeaveDO updateObj = OaLeaveConvert.INSTANCE.convert(updateReqVO); + leaveMapper.updateById(updateObj); + } + + } @Override diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/TaskService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/TaskService.java index ae0783b48..2f2aca24d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/TaskService.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/TaskService.java @@ -20,4 +20,6 @@ public interface TaskService { TaskHandleVO getTaskSteps(TaskQueryReqVO taskQuery); List getHistorySteps(String processInstanceId); + + TodoTaskRespVO getTaskFormKey(TaskQueryReqVO taskQuery); } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/impl/TaskServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/impl/TaskServiceImpl.java index aae12755b..44003e660 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/impl/TaskServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/impl/TaskServiceImpl.java @@ -117,14 +117,14 @@ public class TaskServiceImpl implements TaskService { .withVariables(taskReq.getVariables()) .build()); - if(variables.containsValue(Boolean.FALSE)){ - final String businessKey = task.getBusinessKey(); - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("id", Long.valueOf(businessKey)); - OaLeaveDO updateDo = new OaLeaveDO(); - updateDo.setStatus(2); - leaveMapper.update(updateDo, updateWrapper); - } +// if(variables.containsValue(Boolean.FALSE)){ +// final String businessKey = task.getBusinessKey(); +// UpdateWrapper updateWrapper = new UpdateWrapper<>(); +// updateWrapper.eq("id", Long.valueOf(businessKey)); +// OaLeaveDO updateDo = new OaLeaveDO(); +// updateDo.setStatus(2); +// leaveMapper.update(updateDo, updateWrapper); +// } } @@ -152,19 +152,19 @@ public class TaskServiceImpl implements TaskService { public TaskHandleVO getTaskSteps(TaskQueryReqVO taskQuery) { TaskHandleVO handleVO = new TaskHandleVO(); - String processKey = taskQuery.getProcessKey(); - if ("leave".equals(processKey)) { - String businessKey = taskQuery.getBusinessKey(); - final OaLeaveDO leave = leaveMapper.selectById(Long.valueOf(businessKey)); - handleVO.setFormObject( OaLeaveConvert.INSTANCE.convert(leave)); - } +// String processKey = taskQuery.getProcessKey(); +// if ("leave".equals(processKey)) { +// String businessKey = taskQuery.getBusinessKey(); +// final OaLeaveDO leave = leaveMapper.selectById(Long.valueOf(businessKey)); +// handleVO.setFormObject( OaLeaveConvert.INSTANCE.convert(leave)); +// } +// +// final String taskDefKey = task.getTaskDefinitionKey(); +// final String variableName = Optional.ofNullable(taskVariable.get(taskDefKey)).orElse(""); +// handleVO.setTaskVariable(variableName); final Task task = taskRuntime.task(taskQuery.getTaskId()); - final String taskDefKey = task.getTaskDefinitionKey(); - final String variableName = Optional.ofNullable(taskVariable.get(taskDefKey)).orElse(""); - - handleVO.setTaskVariable(variableName); List steps = getTaskSteps(task.getProcessInstanceId()); handleVO.setHistoryTask(steps); @@ -189,6 +189,7 @@ public class TaskServiceImpl implements TaskService { step.setStartTime(instance.getStartTime()); step.setEndTime(instance.getEndTime()); step.setAssignee(instance.getAssignee()); + step.setStatus(1); final List comments = activitiTaskService.getTaskComments(instance.getTaskId()); if(comments.size()>0){ step.setComment(comments.get(0).getFullMessage()); @@ -204,15 +205,14 @@ public class TaskServiceImpl implements TaskService { .activityType("userTask") .unfinished().list(); - if(unfinished.size()>0) { - - final HistoricActivityInstance unFinishedActiviti = unfinished.get(0); + for (HistoricActivityInstance instance : unfinished) { TaskStepVO step = new TaskStepVO(); - step.setStepName(unFinishedActiviti.getActivityName()); - step.setStartTime(unFinishedActiviti.getStartTime()); - step.setEndTime(unFinishedActiviti.getEndTime()); - step.setAssignee(Optional.ofNullable(unFinishedActiviti.getAssignee()).orElse("")); + step.setStepName(instance.getActivityName()); + step.setStartTime(instance.getStartTime()); + step.setEndTime(instance.getEndTime()); + step.setAssignee(Optional.ofNullable(instance.getAssignee()).orElse("")); step.setComment(""); + step.setStatus(0); steps.add(step); } return steps; @@ -225,6 +225,15 @@ public class TaskServiceImpl implements TaskService { return getTaskSteps(processInstanceId); } + @Override + public TodoTaskRespVO getTaskFormKey(TaskQueryReqVO taskQuery) { + final Task task = taskRuntime.task(taskQuery.getTaskId()); + TodoTaskRespVO respVO = new TodoTaskRespVO(); + respVO.setFormKey(task.getFormKey()); + respVO.setBusinessKey(task.getBusinessKey()); + respVO.setId(task.getId()); + return respVO; + } // private List getHighLightedFlows(ProcessDefinitionEntity processDefinition, String processInstanceId) { diff --git a/yudao-admin-server/src/main/resources/processes/leave-formkey.bpmn b/yudao-admin-server/src/main/resources/processes/leave-formkey.bpmn new file mode 100644 index 000000000..d14ce9ba3 --- /dev/null +++ b/yudao-admin-server/src/main/resources/processes/leave-formkey.bpmn @@ -0,0 +1,152 @@ + + + + 外置表单 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 请求被驳回后员工可以选择继续申请,或者取消本次申请 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yudao-admin-server/src/main/resources/processes/leave.bpmn b/yudao-admin-server/src/main/resources/processes/leave.bpmn deleted file mode 100644 index 34eeea0a5..000000000 --- a/yudao-admin-server/src/main/resources/processes/leave.bpmn +++ /dev/null @@ -1,130 +0,0 @@ - - - - 请假流程演示 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/yudao-admin-ui/src/api/oa/flow.js b/yudao-admin-ui/src/api/oa/flow.js new file mode 100644 index 000000000..3c28cb418 --- /dev/null +++ b/yudao-admin-ui/src/api/oa/flow.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + + +export function getStartForm(processKey) { + return request({ + url: '/workflow/process/definition/getStartForm?processKey='+processKey, + method: 'get' + }) +} diff --git a/yudao-admin-ui/src/api/oa/leave.js b/yudao-admin-ui/src/api/oa/leave.js index 3fb0f806c..afb4e03d9 100644 --- a/yudao-admin-ui/src/api/oa/leave.js +++ b/yudao-admin-ui/src/api/oa/leave.js @@ -43,6 +43,14 @@ export function getLeavePage(query) { }) } +export function createFormKeyLeave(data) { + return request({ + url: '/oa/leave/form-key/create', + method: 'post', + data: data + }) +} + // 导出请假申请 Excel export function exportLeaveExcel(query) { return request({ diff --git a/yudao-admin-ui/src/api/oa/todo.js b/yudao-admin-ui/src/api/oa/todo.js index 35f857988..1aed4b058 100644 --- a/yudao-admin-ui/src/api/oa/todo.js +++ b/yudao-admin-ui/src/api/oa/todo.js @@ -67,6 +67,14 @@ export function taskSteps(data) { }) } +export function getTaskFormKey(data) { + return request({ + url: '/workflow/task/formKey', + method: 'post', + data: data + }) +} + export function processHistorySteps(id) { return request({ url: '/workflow/task/process/history-steps?id='+id, diff --git a/yudao-admin-ui/src/router/index.js b/yudao-admin-ui/src/router/index.js index 63f44544b..5b24fa503 100644 --- a/yudao-admin-ui/src/router/index.js +++ b/yudao-admin-ui/src/router/index.js @@ -123,6 +123,76 @@ export const constantRoutes = [ meta: { title: '修改生成配置' } } ] + }, + { + path: '/flow', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: 'leave/apply', + component: (resolve) => require(['@/views/oa/leave/apply/index'], resolve), + name: '请假表单', + meta: { title: '请假表单', icon: 'form' } + } + ] + }, + { + path: '/flow', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: 'leave/approve-leader', + component: (resolve) => require(['@/views/oa/leave/approve-leader/index'], resolve), + name: '请假表单-部门领导审批', + meta: { title: '请假表单-部门领导审批', icon: 'form' } + } + ] + }, + { + path: '/flow', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: 'leave/approve-hr', + component: (resolve) => require(['@/views/oa/leave/approve-hr/index'], resolve), + name: '请假表单-人事审批', + meta: { title: '请假表单-人事审批', icon: 'form' } + } + ] + }, + { + path: '/flow', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: 'leave/confirm', + component: (resolve) => require(['@/views/oa/leave/confirm/index'], resolve), + name: '请假表单-确认', + meta: { title: '请假表单-确认', icon: 'form' } + } + ] + }, + { + path: '/flow', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: 'leave/modify', + component: (resolve) => require(['@/views/oa/leave/modify/index'], resolve), + name: '请假表单-修改', + meta: { title: '请假表单-修改', icon: 'form' } + } + ] } ] diff --git a/yudao-admin-ui/src/views/oa/flow/index.vue b/yudao-admin-ui/src/views/oa/flow/index.vue new file mode 100644 index 000000000..b0fb8f51e --- /dev/null +++ b/yudao-admin-ui/src/views/oa/flow/index.vue @@ -0,0 +1,36 @@ + + + diff --git a/yudao-admin-ui/src/views/oa/leave/apply/index.vue b/yudao-admin-ui/src/views/oa/leave/apply/index.vue new file mode 100644 index 000000000..41a3bd93a --- /dev/null +++ b/yudao-admin-ui/src/views/oa/leave/apply/index.vue @@ -0,0 +1,93 @@ + + + diff --git a/yudao-admin-ui/src/views/oa/leave/approve-hr/index.vue b/yudao-admin-ui/src/views/oa/leave/approve-hr/index.vue new file mode 100644 index 000000000..3016c96be --- /dev/null +++ b/yudao-admin-ui/src/views/oa/leave/approve-hr/index.vue @@ -0,0 +1,190 @@ + + + diff --git a/yudao-admin-ui/src/views/oa/leave/approve-leader/index.vue b/yudao-admin-ui/src/views/oa/leave/approve-leader/index.vue new file mode 100644 index 000000000..f47349c64 --- /dev/null +++ b/yudao-admin-ui/src/views/oa/leave/approve-leader/index.vue @@ -0,0 +1,190 @@ + + + diff --git a/yudao-admin-ui/src/views/oa/leave/confirm/index.vue b/yudao-admin-ui/src/views/oa/leave/confirm/index.vue new file mode 100644 index 000000000..b0d402565 --- /dev/null +++ b/yudao-admin-ui/src/views/oa/leave/confirm/index.vue @@ -0,0 +1,137 @@ + + + diff --git a/yudao-admin-ui/src/views/oa/leave/index.vue b/yudao-admin-ui/src/views/oa/leave/index.vue index d14706383..f0998a00a 100644 --- a/yudao-admin-ui/src/views/oa/leave/index.vue +++ b/yudao-admin-ui/src/views/oa/leave/index.vue @@ -28,9 +28,9 @@ @@ -49,10 +49,6 @@ - - 新增 - @@ -71,7 +67,7 @@ {{ parseTime(scope.row.endTime) }} - +