Commit b784bf3e129088f180cf84663c3620dabbf61b5d

Authored by jason
1 parent d0a59f7e

修改请假流程

Showing 25 changed files with 495 additions and 872 deletions
sql/ruoyi-vue-pro.sql
... ... @@ -269,12 +269,6 @@ CREATE TABLE `oa_leave` (
269 269 PRIMARY KEY (`id`)
270 270 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='请假申请表';
271 271  
272   --- ----------------------------
273   --- Records of oa_leave
274   --- ----------------------------
275   -BEGIN;
276   -INSERT INTO `oa_leave` VALUES (1, '659d1c4f-3943-11ec-854f-3e6e3d9df205', 2, 'admin', '2021-10-01 00:00:00', '2021-10-30 00:00:00', '1', NULL, '2021-10-12 00:00:00', '1', '2021-10-30 13:36:57', '1', '2021-10-30 13:41:53', b'0');
277   -COMMIT;
278 272  
279 273 -- ----------------------------
280 274 -- Table structure for pay_app
... ... @@ -842,9 +836,10 @@ INSERT INTO `sys_dict_data` VALUES (85, 202, '强制登出', '202', 'sys_login_t
842 836 INSERT INTO `sys_dict_data` VALUES (86, 0, '病假', '1', 'oa_leave_type', 0, NULL, '1', '2021-09-21 22:35:28', '1', '2021-09-21 14:59:27', b'0');
843 837 INSERT INTO `sys_dict_data` VALUES (87, 1, '事假', '2', 'oa_leave_type', 0, NULL, '1', '2021-09-21 22:36:11', '1', '2021-09-21 14:59:27', b'0');
844 838 INSERT INTO `sys_dict_data` VALUES (88, 2, '婚假', '3', 'oa_leave_type', 0, NULL, '1', '2021-09-21 22:36:38', '1', '2021-09-21 14:59:27', b'0');
845   -INSERT INTO `sys_dict_data` VALUES (89, 0, '处理中', '1', 'oa_leave_status', 0, NULL, '1', '2021-09-21 22:46:46', '1', '2021-10-12 22:12:20', b'0');
846   -INSERT INTO `sys_dict_data` VALUES (90, 1, '流程结束', '2', 'oa_leave_status', 0, NULL, '1', '2021-09-21 22:47:03', '1', '2021-10-12 22:12:58', b'0');
847   -INSERT INTO `sys_dict_data` VALUES (91, 2, '完成', '3', 'oa_leave_status', 0, NULL, '1', '2021-09-21 22:47:25', '1', '2021-10-12 14:13:06', b'1');
  839 +INSERT INTO `sys_dict_data` VALUES (89, 0, '处理中', '1', 'flow_status', 0, NULL, '1', '2021-09-21 22:46:46', '1', '2021-10-12 22:12:20', b'0');
  840 +INSERT INTO `sys_dict_data` VALUES (90, 1, '审批通过', '2', 'flow_status', 0, NULL, '1', '2021-09-21 22:47:03', '1', '2021-10-12 22:12:58', b'0');
  841 +INSERT INTO `sys_dict_data` VALUES (91, 2, '完成', '3', 'flow_status', 0, NULL, '1', '2021-09-21 22:47:25', '1', '2021-10-12 14:13:06', b'1');
  842 +INSERT INTO `sys_dict_data` VALUES (92, 2, '审批未通过', '3', 'flow_status', 0, NULL, '1', '2021-09-21 22:47:25', '1', '2021-10-12 14:13:06', b'0');
848 843 COMMIT;
849 844  
850 845 -- ----------------------------
... ... @@ -894,7 +889,7 @@ INSERT INTO `sys_dict_type` VALUES (114, '短信接收状态', 'sys_sms_receive_
894 889 INSERT INTO `sys_dict_type` VALUES (115, '错误码的类型', 'sys_error_code_type', 0, NULL, '1', '2021-04-21 00:06:30', '1', '2021-04-13 22:07:12', b'0');
895 890 INSERT INTO `sys_dict_type` VALUES (116, '登陆日志的类型', 'sys_login_type', 0, '登陆日志的类型', '1', '2021-10-06 00:50:46', '1', '2021-10-06 00:50:46', b'0');
896 891 INSERT INTO `sys_dict_type` VALUES (117, '请假类型', 'oa_leave_type', 0, NULL, '1', '2021-09-21 22:34:33', '1', '2021-09-21 15:00:38', b'0');
897   -INSERT INTO `sys_dict_type` VALUES (118, '请假流程状态', 'oa_leave_status', 0, NULL, '1', '2021-09-21 22:46:04', '1', '2021-09-21 15:00:38', b'0');
  892 +INSERT INTO `sys_dict_type` VALUES (118, '流程状态', 'flow_status', 0, NULL, '1', '2021-09-21 22:46:04', '1', '2021-09-21 15:00:38', b'0');
898 893 COMMIT;
899 894  
900 895 -- ----------------------------
... ... @@ -1191,14 +1186,14 @@ INSERT INTO `sys_menu` VALUES (1113, '错误码更新', 'system:error-code:updat
1191 1186 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');
1192 1187 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');
1193 1188 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');
1194   -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', b'0');
  1189 +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', b'0');
1195 1190 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', b'0');
1196 1191 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', b'0');
1197 1192 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', b'0');
1198 1193 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', b'0');
1199 1194 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', b'0');
1200   -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', b'0');
1201   -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', b'0');
  1195 +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', b'0');
  1196 +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', b'0');
1202 1197 COMMIT;
1203 1198  
1204 1199 -- ----------------------------
... ... @@ -1290,10 +1285,11 @@ CREATE TABLE `sys_post` (
1290 1285 -- ----------------------------
1291 1286 BEGIN;
1292 1287 INSERT INTO `sys_post` VALUES (1, 'ceo', '董事长', 1, 0, '', 'admin', '2021-01-05 17:03:48', '1', '2021-03-14 20:39:03', b'0');
1293   -INSERT INTO `sys_post` VALUES (2, 'se', '项目经理', 2, 0, '', 'admin', '2021-01-05 17:03:48', '1', '2021-03-14 20:39:05', b'0');
  1288 +INSERT INTO `sys_post` VALUES (2, 'pm', '项目经理', 2, 0, '', 'admin', '2021-01-05 17:03:48', '1', '2021-03-14 20:39:05', b'0');
1294 1289 INSERT INTO `sys_post` VALUES (3, 'hr', '人力资源', 3, 0, '', 'admin', '2021-01-05 17:03:48', '', '2021-01-05 17:03:48', b'0');
1295 1290 INSERT INTO `sys_post` VALUES (4, 'user', '普通员工', 4, 0, '', 'admin', '2021-01-05 17:03:48', '', '2021-01-05 17:03:48', b'0');
1296 1291 INSERT INTO `sys_post` VALUES (5, 'test', '测试岗位', 0, 1, '132', '', '2021-01-07 15:07:44', '', '2021-01-07 15:10:35', b'1');
  1292 +INSERT INTO `sys_post` VALUES (6, 'bm', '部门经理', 0, 1, '部门经理', '', '2021-01-07 15:07:44', '', '2021-01-07 15:10:35', b'0');
1297 1293 COMMIT;
1298 1294  
1299 1295 -- ----------------------------
... ... @@ -1721,6 +1717,9 @@ INSERT INTO `sys_user` VALUES (103, 'yuanma', '', '源码', NULL, 100, NULL, 'yu
1721 1717 INSERT INTO `sys_user` VALUES (104, 'test', '$2a$10$.TOFpaIiI3PzEwkGrNq0Eu6Cc3rOqJMxTb1DqeSEM8StxaGPBRKoi', '测试号', NULL, 100, '[]', '', '15601691200', 1, '', 0, '', NULL, '', '2021-01-21 02:13:53', '1', '2021-03-14 22:36:38', b'0');
1722 1718 INSERT INTO `sys_user` VALUES (105, 'hradmin', '$2a$10$JEhJOL25X1eMnFfR3PILo.MoAljf29YukpL2w6H9GvVGjmqOCuh.O', 'hr-mgr', 'hr 管理员', 100, '[3]', '', '', 1, '', 0, '127.0.0.1', '2021-10-30 13:41:04', '1', '2021-09-25 16:50:41', NULL, '2021-10-30 13:41:04', b'0');
1723 1719 INSERT INTO `sys_user` VALUES (106, 'zhijiantianya', '$2a$10$Y0hSfV2udA8quqMeWukhTuHEoKpQ5tDhclG8WUWSOH7o/MGw185Ti', '芋道源码', '', NULL, NULL, '', '', 3, 'https://portrait.gitee.com/uploads/avatars/user/0/176_zhijiantianya_1578913741.png', 0, '', NULL, NULL, '2021-09-28 09:40:59', NULL, '2021-09-28 09:40:59', b'0');
  1720 +INSERT INTO `sys_user` VALUES (107, 'projectmgr', '$2a$10$Ky9dvdSU9xWCJYzPL8/pk.Tyx2WkDlxVFTSJWOYGCYqT6x1cTsIU2', 'project-mgr', '项目经理', 100, '[2]', '', '', 1, '', 0, '127.0.0.1', '2021-10-30 13:41:04', '1', '2021-09-25 16:50:41', NULL, '2021-10-30 13:41:04', b'0');
  1721 +INSERT INTO `sys_user` VALUES (108, 'depmgr', '$2a$10$q/w2v.3pnjjERehoOvHCYOl0I0MvAEw54Bt5ch09IUuwPVsIr3.oa', 'bm', '部门经理', 100, '[6]', '', '', 1, '', 0, '127.0.0.1', '2021-10-30 13:41:04', '1', '2021-09-25 16:50:41', NULL, '2021-10-30 13:41:04', b'0');
  1722 +INSERT INTO `sys_user` VALUES (109, 'normal', '$2a$10$q3lIAjzzaNWuTGN2kIURfOzTkc2iPXvAM1n425sNcE5w3asymw2hK', 'general', '普通用户', 100, '[4]', '', '', 1, '', 0, '127.0.0.1', '2021-10-30 13:41:04', '1', '2021-09-25 16:50:41', NULL, '2021-10-30 13:41:04', b'0');
1724 1723 COMMIT;
1725 1724  
1726 1725 -- ----------------------------
... ... @@ -1752,6 +1751,9 @@ INSERT INTO `sys_user_role` VALUES (6, 100, 2, '', NULL, '', NULL, b'0');
1752 1751 INSERT INTO `sys_user_role` VALUES (7, 104, 101, '', NULL, '', NULL, b'0');
1753 1752 INSERT INTO `sys_user_role` VALUES (8, 106, 1, NULL, '2021-09-28 09:40:59', NULL, '2021-09-28 09:40:59', b'0');
1754 1753 INSERT INTO `sys_user_role` VALUES (9, 105, 1, '1', '2021-10-30 13:40:48', '1', '2021-10-30 13:40:48', b'0');
  1754 +INSERT INTO `sys_user_role` VALUES (10, 107, 1, '1', '2021-10-30 13:40:48', '1', '2021-10-30 13:40:48', b'0');
  1755 +INSERT INTO `sys_user_role` VALUES (11, 108, 1, '1', '2021-10-30 13:40:48', '1', '2021-10-30 13:40:48', b'0');
  1756 +INSERT INTO `sys_user_role` VALUES (12, 109, 1, '1', '2021-10-30 13:40:48', '1', '2021-10-30 13:40:48', b'0');
1755 1757 COMMIT;
1756 1758  
1757 1759 -- ----------------------------
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/oa/OALeaveController.java
... ... @@ -36,25 +36,21 @@ public class OALeaveController {
36 36 @Resource
37 37 private OALeaveService leaveService;
38 38  
39   - @PostMapping("/create")
40   - @ApiOperation("创建请假申请")
41   - @PreAuthorize("@ss.hasPermission('oa:leave:create')")
42   - public CommonResult<Long> createLeave(@Valid @RequestBody OALeaveCreateReqVO createReqVO) {
43   - // TODO @芋艿:processKey 自己去理解下。不过得把 leave 变成枚举
44   - // TODO @芋艿 该方法没有用到, 是前一个版本的, 可以删掉。
45   - createReqVO.setProcessKey("leave");
46   - return success(leaveService.createLeave(createReqVO));
47   - }
  39 +
48 40  
49 41 @PostMapping("/form-key/create")
50 42 @ApiOperation("创建外置请假申请")
51 43 public CommonResult<Long> createFormKeyLeave(@Valid @RequestBody OALeaveCreateReqVO createReqVO) {
52   - // TODO @芋艿:processKey 自己去理解下。不过得把 formkey 变成枚举
53   - // TODO @芋艿 : processKey 是 bpmn <process> 中定义的id, 提交业务表单时候, 需要启动流程, 或许从前台传更合适
54   - createReqVO.setProcessKey("leave-formkey");
  44 + // processKey 前台传入
55 45 return success(leaveService.createLeave(createReqVO));
56 46 }
57 47  
  48 + @GetMapping("/getLeaveApplyMembers")
  49 + @ApiOperation("获取本人请假申请流程中审批人员,可先检查这些人员是否存在")
  50 + public CommonResult<OALeaveApplyMembersVO> getLeaveApplyMembers() {
  51 + return success(leaveService.getLeaveApplyMembers());
  52 + }
  53 +
58 54 @PutMapping("/update")
59 55 @ApiOperation("更新请假申请")
60 56 @PreAuthorize("@ss.hasPermission('oa:leave:update')")
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/oa/vo/OALeaveApplyMembersVO.java 0 → 100644
  1 +package cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Builder;
  6 +import lombok.Data;
  7 +import lombok.EqualsAndHashCode;
  8 +import lombok.ToString;
  9 +
  10 +@ApiModel("请假申请审批人员 Response VO")
  11 +@Data
  12 +@Builder
  13 +@EqualsAndHashCode
  14 +@ToString
  15 +public class OALeaveApplyMembersVO {
  16 +
  17 + @ApiModelProperty(value = "部门的hr")
  18 + private String hr;
  19 +
  20 + @ApiModelProperty(value = "部门的项目经理")
  21 + private String pm;
  22 +
  23 + @ApiModelProperty(value = "部门的部门经理")
  24 + private String bm;
  25 +}
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/oa/vo/OALeaveCreateReqVO.java
... ... @@ -3,11 +3,21 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo;
3 3 import lombok.*;
4 4 import io.swagger.annotations.*;
5 5  
  6 +import java.util.Map;
  7 +
6 8 @ApiModel("请假申请创建 Request VO")
7 9 @Data
8 10 @EqualsAndHashCode(callSuper = true)
9 11 @ToString(callSuper = true)
10 12 public class OALeaveCreateReqVO extends OALeaveBaseVO {
11 13  
  14 + /**
  15 + * 对应 bpmn 文件 <process> 的 id
  16 + */
  17 + @ApiModelProperty(value = "流程key")
12 18 private String processKey;
  19 +
  20 +
  21 + @ApiModelProperty(value = "流程用户任务的变量")
  22 + private Map<String,Object> taskVariables;
13 23 }
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/FlowStatusEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.adminserver.modules.bpm.enums;
  2 +
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Getter;
  5 +
  6 +/**
  7 + * 流程状态
  8 + */
  9 +@Getter
  10 +@AllArgsConstructor
  11 +public enum FlowStatusEnum {
  12 +
  13 + HANDLE(1, "处理中"),
  14 +
  15 + PASS(2, "审批通过"),
  16 +
  17 + REJECTED(3, "审批不通过");
  18 +
  19 + /**
  20 + * 状态
  21 + */
  22 + private final Integer status;
  23 +
  24 +
  25 + /**
  26 + * 描述
  27 + */
  28 + private final String desc;
  29 +}
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/oa/OAErrorCodeConstants.java
... ... @@ -10,4 +10,10 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
10 10 */
11 11 public interface OAErrorCodeConstants {
12 12 ErrorCode LEAVE_NOT_EXISTS = new ErrorCode(1003001001, "请假申请不存在");
  13 + ErrorCode PM_POST_NOT_EXISTS = new ErrorCode(1003001002, "项目经理岗位未设置");
  14 + ErrorCode DEPART_PM_POST_NOT_EXISTS = new ErrorCode(1003001003, "部门的项目经理不存在");
  15 + ErrorCode BM_POST_NOT_EXISTS = new ErrorCode(1003001004, "部门经理岗位未设置");
  16 + ErrorCode DEPART_BM_POST_NOT_EXISTS = new ErrorCode(1003001005, "部门的部门经理不存在");
  17 + ErrorCode HR_POST_NOT_EXISTS = new ErrorCode(1003001006, "HR岗位未设置");
  18 + ErrorCode DAY_LEAVE_ERROR = new ErrorCode(1003001007, "请假天数必须大于0");
13 19 }
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/oa/ReportBackEndProcessor.java renamed to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/oa/LeaveApplyEndProcessor.java
... ... @@ -2,16 +2,21 @@ package cn.iocoder.yudao.adminserver.modules.bpm.service.oa;
2 2  
3 3 import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.leave.OALeaveDO;
4 4 import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.oa.OALeaveMapper;
  5 +import cn.iocoder.yudao.adminserver.modules.bpm.enums.FlowStatusEnum;
5 6 import org.activiti.engine.delegate.DelegateExecution;
6 7 import org.activiti.engine.delegate.ExecutionListener;
7 8 import org.springframework.stereotype.Component;
8 9 import org.springframework.transaction.annotation.Transactional;
9 10  
10 11 import javax.annotation.Resource;
  12 +import java.util.Objects;
11 13  
12   -// TODO @jason:类注释
  14 +
  15 +/**
  16 + * 请假流程结束流程监听处理服务, 根据请假申请审批通过,还是未通过, 更新请假表单
  17 + */
13 18 @Component
14   -public class ReportBackEndProcessor implements ExecutionListener {
  19 +public class LeaveApplyEndProcessor implements ExecutionListener {
15 20  
16 21 @Resource
17 22 private OALeaveMapper leaveMapper;
... ... @@ -20,10 +25,14 @@ public class ReportBackEndProcessor implements ExecutionListener {
20 25 @Transactional(rollbackFor = Exception.class)
21 26 public void notify(DelegateExecution delegateExecution) {
22 27 final String businessKey = delegateExecution.getProcessInstanceBusinessKey();
  28 + final Object approved = delegateExecution.getVariable("approved");
23 29 OALeaveDO updateDo = new OALeaveDO();
24 30 updateDo.setId(Long.valueOf(businessKey));
25   - // TODO @json:status 要枚举起来,不要出现 magic number
26   - updateDo.setStatus(2);
  31 + if (Objects.equals(approved, true)) {
  32 + updateDo.setStatus(FlowStatusEnum.PASS.getStatus());
  33 + }else{
  34 + updateDo.setStatus(FlowStatusEnum.REJECTED.getStatus());
  35 + }
27 36 leaveMapper.updateById(updateDo);
28 37 }
29 38  
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/oa/OALeaveService.java
1 1 package cn.iocoder.yudao.adminserver.modules.bpm.service.oa;
2 2  
3 3  
4   -import cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo.OALeaveCreateReqVO;
5   -import cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo.OALeaveUpdateReqVO;
6   -import cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo.OALeaveExportReqVO;
7   -import cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo.OALeavePageReqVO;
  4 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo.*;
8 5 import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.leave.OALeaveDO;
9 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
10 7  
... ... @@ -73,4 +70,11 @@ public interface OALeaveService {
73 70 */
74 71 List<OALeaveDO> getLeaveList(OALeaveExportReqVO exportReqVO);
75 72  
  73 +
  74 +
  75 + /**
  76 + * 获取本人请假申请流程中审批人员
  77 + * @return 包括,本人部门的项目经理, 部门经理, HR
  78 + */
  79 + OALeaveApplyMembersVO getLeaveApplyMembers();
76 80 }
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/oa/impl/OALeaveServiceImpl.java
1 1 package cn.iocoder.yudao.adminserver.modules.bpm.service.oa.impl;
2 2  
3   -import cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo.OALeaveCreateReqVO;
4   -import cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo.OALeaveUpdateReqVO;
5   -import cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo.OALeaveExportReqVO;
6   -import cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo.OALeavePageReqVO;
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.date.DateUtil;
  5 +import cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo.*;
7 6 import cn.iocoder.yudao.adminserver.modules.bpm.convert.oa.OALeaveConvert;
8 7 import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.leave.OALeaveDO;
9 8 import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.oa.OALeaveMapper;
  9 +import cn.iocoder.yudao.adminserver.modules.bpm.enums.FlowStatusEnum;
10 10 import cn.iocoder.yudao.adminserver.modules.bpm.service.oa.OALeaveService;
  11 +import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.SysUserBaseVO;
  12 +import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysPostDO;
  13 +import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.dept.SysPostMapper;
  14 +import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.user.SysUserMapper;
  15 +import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
  16 +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
11 17 import cn.iocoder.yudao.framework.common.pojo.PageResult;
12 18 import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
13 19 import org.activiti.api.task.model.Task;
... ... @@ -20,9 +26,11 @@ import org.springframework.transaction.annotation.Transactional;
20 26 import org.springframework.validation.annotation.Validated;
21 27  
22 28 import javax.annotation.Resource;
  29 +import javax.validation.constraints.NotNull;
23 30 import java.util.*;
24 31  
25   -import static cn.iocoder.yudao.adminserver.modules.bpm.enums.oa.OAErrorCodeConstants.LEAVE_NOT_EXISTS;
  32 +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.oa.OAErrorCodeConstants.*;
  33 +import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.POST_CODE_DUPLICATE;
26 34 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
27 35  
28 36 /**
... ... @@ -46,23 +54,33 @@ public class OALeaveServiceImpl implements OALeaveService {
46 54 @Resource
47 55 private TaskRuntime taskRuntime;
48 56  
  57 + @Resource
  58 + private SysPostMapper sysPostMapper;
  59 +
  60 + @Resource
  61 + private SysUserMapper sysUserMapper;
  62 +
49 63 @Override
50 64 @Transactional(rollbackFor = Exception.class)
51 65 public Long createLeave(OALeaveCreateReqVO createReqVO) {
52 66 // 插入 OA 请假单
53 67 OALeaveDO leave = OALeaveConvert.INSTANCE.convert(createReqVO);
54   - leave.setStatus(1);
  68 + leave.setStatus(FlowStatusEnum.HANDLE.getStatus());
55 69 // TODO @jason:应该是存储 userId??
56 70 leave.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername());
57 71 leaveMapper.insert(leave);
58   -
  72 + Date startTime = createReqVO.getStartTime();
  73 + Date endTime = createReqVO.getEndTime();
  74 + long day = DateUtil.betweenDay(startTime, endTime, false);
  75 + if (day <= 0) {
  76 + throw ServiceExceptionUtil.exception(DAY_LEAVE_ERROR);
  77 + }
  78 + Map<String, Object> taskVariables = createReqVO.getTaskVariables();
  79 + taskVariables.put("day", day);
59 80 // 创建工作流
60   - Map<String, Object> variables = new HashMap<>();
61   - // 如何得到部门领导人,暂时写死
62   - variables.put("deptLeader", "admin"); // TODO @芋艿:需要部门的负责人
63 81 Long id = leave.getId();
64 82 String businessKey = String.valueOf(id);
65   - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(createReqVO.getProcessKey(), businessKey, variables);
  83 + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(createReqVO.getProcessKey(), businessKey, taskVariables);
66 84 String processInstanceId = processInstance.getProcessInstanceId();
67 85  
68 86 // 将工作流的编号,更新到 OA 请假单中
... ... @@ -104,9 +122,6 @@ public class OALeaveServiceImpl implements OALeaveService {
104 122 this.validateLeaveExists(id);
105 123 // 删除
106 124 leaveMapper.deleteById(id);
107   - // TODO @jason:需要调用 runtimeService 的 delete 方法,删除???
108   - // TOTO @芋道源码 目前页面暂时没有实现基于业务表单的删除, 该代码自动生成的。
109   - // TODO @芋道源码 我理解提交流程后,是不允许删除的? , 只能在流程处理中作废流程
110 125 }
111 126  
112 127 private void validateLeaveExists(Long id) {
... ... @@ -135,4 +150,64 @@ public class OALeaveServiceImpl implements OALeaveService {
135 150 return leaveMapper.selectList(exportReqVO);
136 151 }
137 152  
  153 +
  154 + /**
  155 + * 获取本人请假申请流程中审批人员
  156 + * @return 包括,本人部门的项目经理, 部门经理, hr
  157 + */
  158 + @Override
  159 + public OALeaveApplyMembersVO getLeaveApplyMembers() {
  160 + final Long id = SecurityFrameworkUtils.getLoginUser().getId();
  161 + //项目经理
  162 + //TODO jason 定义enum
  163 + SysPostDO pmPostDO = sysPostMapper.selectByCode("pm");
  164 + if (Objects.isNull(pmPostDO)) {
  165 + throw ServiceExceptionUtil.exception(PM_POST_NOT_EXISTS);
  166 + }
  167 + SysUserDO userDO = sysUserMapper.selectById(id);
  168 + Set<Long> postIds = new HashSet<>(8);
  169 + postIds.add( pmPostDO.getId());
  170 + SysUserBaseVO baseVO = new SysUserBaseVO();
  171 + baseVO.setDeptId(userDO.getDeptId())
  172 + .setPostIds(postIds);
  173 + final List<SysUserDO> pmUsers = sysUserMapper.selectListByBaseVO(baseVO);
  174 + if (CollUtil.isEmpty(pmUsers)) {
  175 + throw ServiceExceptionUtil.exception(DEPART_PM_POST_NOT_EXISTS);
  176 + }
  177 +
  178 + //部门经理
  179 + SysPostDO bmPostDO = sysPostMapper.selectByCode("bm");
  180 + if (Objects.isNull(bmPostDO)) {
  181 + throw ServiceExceptionUtil.exception(BM_POST_NOT_EXISTS);
  182 + }
  183 + userDO = sysUserMapper.selectById(id);
  184 + postIds = new HashSet<>(8);
  185 + postIds.add( bmPostDO.getId());
  186 + baseVO = new SysUserBaseVO();
  187 + baseVO.setDeptId(userDO.getDeptId())
  188 + .setPostIds(postIds);
  189 + final List<SysUserDO> bmUsers = sysUserMapper.selectListByBaseVO(baseVO);
  190 + if (CollUtil.isEmpty(bmUsers)) {
  191 + throw ServiceExceptionUtil.exception(DEPART_BM_POST_NOT_EXISTS);
  192 + }
  193 + //人事
  194 + SysPostDO hrPostDO = sysPostMapper.selectByCode("hr");
  195 + if (Objects.isNull(hrPostDO)) {
  196 + throw ServiceExceptionUtil.exception(HR_POST_NOT_EXISTS);
  197 + }
  198 + userDO = sysUserMapper.selectById(id);
  199 + postIds = new HashSet<>(8);
  200 + postIds.add( hrPostDO.getId());
  201 + baseVO = new SysUserBaseVO();
  202 + baseVO.setDeptId(userDO.getDeptId())
  203 + .setPostIds(postIds);
  204 + final List<SysUserDO> hrUsers = sysUserMapper.selectListByBaseVO(baseVO);
  205 + if (CollUtil.isEmpty(hrUsers)) {
  206 + throw ServiceExceptionUtil.exception(DEPART_BM_POST_NOT_EXISTS);
  207 + }
  208 + return OALeaveApplyMembersVO.builder().pm(pmUsers.get(0).getUsername())
  209 + .bm(bmUsers.get(0).getUsername())
  210 + .hr(hrUsers.get(0).getUsername()).build();
  211 + }
  212 +
138 213 }
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/workflow/TaskService.java
... ... @@ -6,22 +6,50 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 6 import javax.servlet.http.HttpServletResponse;
7 7 import java.util.List;
8 8  
9   -// TODO @芋艿:前缀,注释
10   -// TODO @json:类和方法的注释。咱是开源项目,有注释,大家才能更容易读懂
  9 +
  10 +/**
  11 + * 用户任务服务接口
  12 + */
11 13 public interface TaskService {
12 14  
  15 +
  16 + /**
  17 + * 获取当前用户的待办任务, 分页
  18 + */
13 19 PageResult<TodoTaskRespVO> getTodoTaskPage(TodoTaskPageReqVO pageReqVO);
14 20  
  21 +
  22 + /**
  23 + * 签收任务
  24 + * @param taskId 用户任务id
  25 + */
15 26 void claimTask(String taskId);
16 27  
17 28  
  29 + /**
  30 + * 办理完成用户任务
  31 + * @param taskReq 任务参数, 包含任务的参数,和 评论
  32 + */
18 33 void completeTask(TaskReqVO taskReq);
19 34  
20   -// void flowImage(String taskId, HttpServletResponse response);
  35 +
  36 + /**
  37 + * 根据任务id, 查询已经完成的用户任务,未完成的用户任务
  38 + * @param taskQuery 查询参数 一般 taskId
  39 + */
21 40 TaskHandleVO getTaskSteps(TaskQueryReqVO taskQuery);
22 41  
  42 + /**
  43 + * 根据流程实例id, 查询历史用户任务,包括已完成,未完成
  44 + * @param processInstanceId 流程实例id
  45 + */
23 46 List<TaskStepVO> getHistorySteps(String processInstanceId);
24 47  
  48 +
  49 + /**
  50 + * 获取用户任务的 formKey, 对应外置表单, 需要根据formKey 对应业务表单
  51 + * @param taskQuery 查询参数 ,一般taskId
  52 + */
25 53 TodoTaskRespVO getTaskFormKey(TaskQueryReqVO taskQuery);
26 54  
27 55  
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/workflow/impl/TaskServiceImpl.java
... ... @@ -89,7 +89,7 @@ public class TaskServiceImpl implements TaskService {
89 89 /**
90 90 * 工作流,完成 userTask, 完成用户任务 一般传入参数 1。是否同意(variables). 2. 评论(comment)
91 91 * variables 变量名 和 评论 由前台传入
92   - * @param taskReq
  92 + * @param taskReq 任务参数
93 93 */
94 94 @Override
95 95 @Transactional
... ... @@ -103,25 +103,7 @@ public class TaskServiceImpl implements TaskService {
103 103 .build());
104 104 }
105 105  
106   -// @Override
107   -// public void flowImage(String taskId, HttpServletResponse response) {
108   -//
109   -// final Task task = taskRuntime.task(taskId);
110   -// BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
111   -// final Process process = bpmnModel.getMainProcess();
112   -// ProcessDefinitionEntity processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
113   -// List<String> activeActivityIds = runtimeService.getActiveActivityIds(executionId);
114   -// List<String> highLightedFlows = getHighLightedFlows(processDefinition, processInstance.getId());
115   -// ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
116   -// InputStream imageStream =diagramGenerator.generateDiagram(bpmnModel, "png", activeActivityIds, highLightedFlows);
117   -//
118   -// // 输出资源内容到相应对象
119   -// byte[] b = new byte[1024];
120   -// int len;
121   -// while ((len = imageStream.read(b, 0, 1024)) != -1) {
122   -// response.getOutputStream().write(b, 0, len);
123   -// }
124   -// }
  106 +
125 107  
126 108 @Override
127 109 public TaskHandleVO getTaskSteps(TaskQueryReqVO taskQuery) {
... ... @@ -148,8 +130,7 @@ public class TaskServiceImpl implements TaskService {
148 130 // TODO @jason:可以考虑把 comments 读取后,在统一调用 convert 拼接。另外 Comment 是废弃的类,有没其它可以使用的哈?
149 131 List<Comment> comments = activitiTaskService.getTaskComments(instance.getTaskId());
150 132 if (!CollUtil.isEmpty(comments)) {
151   - // TODO @jason:IDEA 在 t.getFullMessage() 有提示告警,可以解决下。
152   - stepVO.setComment(Optional.ofNullable(comments.get(0)).map(t->t.getFullMessage()).orElse(""));
  133 + stepVO.setComment(Optional.ofNullable(comments.get(0)).map(Comment::getFullMessage).orElse(""));
153 134 }
154 135 steps.add(stepVO);
155 136 });
... ... @@ -188,45 +169,11 @@ public class TaskServiceImpl implements TaskService {
188 169 return respVO;
189 170 }
190 171  
191   -// private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinition, String processInstanceId) {
192   -//
193   -// List<String> highLightedFlows = new ArrayList<String>();
194   -// List<HistoricActivityInstance> historicActivityInstances = historyService
195   -// .createHistoricActivityInstanceQuery()
196   -// .processInstanceId(processInstanceId)
197   -// .orderByHistoricActivityInstanceStartTime().asc().list();
198   -//
199   -// List<String> historicActivityInstanceList = new ArrayList<String>();
200   -// for (HistoricActivityInstance hai : historicActivityInstances) {
201   -// historicActivityInstanceList.add(hai.getActivityId());
202   -// }
203   -
204   -// // add current activities to list
205   -// List<String> highLightedActivities = runtimeService.getActiveActivityIds(processInstanceId);
206   -// historicActivityInstanceList.addAll(highLightedActivities);
207   -
208   - // activities and their sequence-flows
209   -// for (ActivityImpl activity : processDefinition.getActivities()) {
210   -// int index = historicActivityInstanceList.indexOf(activity.getId());
211   -//
212   -// if (index >= 0 && index + 1 < historicActivityInstanceList.size()) {
213   -// List<PvmTransition> pvmTransitionList = activity
214   -// .getOutgoingTransitions();
215   -// for (PvmTransition pvmTransition : pvmTransitionList) {
216   -// String destinationFlowId = pvmTransition.getDestination().getId();
217   -// if (destinationFlowId.equals(historicActivityInstanceList.get(index + 1))) {
218   -// highLightedFlows.add(pvmTransition.getId());
219   -// }
220   -// }
221   -// }
222   -// }
223   -// return highLightedFlows;
224   -// }
225   -
226 172  
227 173 @Override
228 174 public void getHighlightImg(String processInstanceId, HttpServletResponse response) {
229 175 // 查询历史
  176 + //TODO 云扬四海 貌似流程结束后,点击审批进度会报错
230 177 HistoricProcessInstance hpi = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
231 178 // 如果有结束时间
232 179 if (hpi == null) {
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/dal/mysql/user/SysUserMapper.java
1 1 package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.user;
2 2  
  3 +import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.SysUserBaseVO;
3 4 import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
  5 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 7 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
6 8 import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
... ... @@ -8,9 +10,11 @@ import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.SysUs
8 10 import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.SysUserPageReqVO;
9 11 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
10 12 import org.apache.ibatis.annotations.Mapper;
  13 +import org.apache.logging.log4j.util.Strings;
11 14  
12 15 import java.util.Collection;
13 16 import java.util.List;
  17 +import java.util.Optional;
14 18  
15 19 @Mapper
16 20 public interface SysUserMapper extends BaseMapperX<SysUserDO> {
... ... @@ -52,5 +56,13 @@ public interface SysUserMapper extends BaseMapperX&lt;SysUserDO&gt; {
52 56 return selectList(new QueryWrapperX<SysUserDO>().like("username", username));
53 57 }
54 58  
  59 + default List<SysUserDO> selectListByBaseVO(SysUserBaseVO reqVO) {
  60 + return selectList(new QueryWrapperX<SysUserDO>().likeIfPresent("username", reqVO.getUsername())
  61 + .likeIfPresent("nickname", reqVO.getNickname())
  62 + .eq("status", CommonStatusEnum.ENABLE.getStatus())
  63 + .eq("dept_id", reqVO.getDeptId())
  64 + .likeIfPresent("post_ids", Optional.ofNullable(reqVO.getPostIds()).map(t -> Strings.join(t, ',')).orElse("")));
  65 + }
  66 +
55 67 }
56 68  
... ...
yudao-admin-server/src/main/resources/mybatis-config/mybatis-config.xml
... ... @@ -6,6 +6,7 @@
6 6 <settings>
7 7 <setting name="lazyLoadingEnabled" value="false" />
8 8 <setting name="mapUnderscoreToCamelCase" value="true"/>
  9 +<!-- <setting name="logImpl" value="STDOUT_LOGGING"/>-->
9 10 </settings>
10 11 <typeAliases>
11 12 <typeAlias type="org.activiti.engine.impl.persistence.ByteArrayRefTypeHandler" alias="ByteArrayRefTypeHandler"/>
... ...
yudao-admin-server/src/main/resources/processes/leave-formkey.bpmn deleted
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://bpmn.io/schema/bpmn">
3   - <process id="leave-formkey" name="请假流程-外置表单" isExecutable="true">
4   - <documentation>外置表单</documentation>
5   - <startEvent id="startevent1" name="Start" activiti:initiator="applyUserId" activiti:formKey="/flow/leave/apply"></startEvent>
6   - <userTask id="deptLeaderVerify" name="部门经理审批" activiti:assignee="${deptLeader}" activiti:formKey="/flow/leave/approve-leader"></userTask>
7   - <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
8   - <userTask id="hrVerify" name="人事经理审批" activiti:candidateGroups="hr" activiti:formKey="/flow/leave/approve-hr"></userTask>
9   - <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
10   - <userTask id="reportBack" name="申请人确认" activiti:assignee="${applyUserId}" activiti:formKey="/flow/leave/confirm">
11   - </userTask>
12   - <endEvent id="endevent1" name="End"></endEvent>
13   - <userTask id="modifyApply" name="调整申请内容" activiti:assignee="${applyUserId}" activiti:formKey="/flow/leave/modify"></userTask>
14   - <exclusiveGateway id="exclusivegateway3" name="Exclusive Gateway"></exclusiveGateway>
15   - <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="deptLeaderVerify"></sequenceFlow>
16   - <sequenceFlow id="flow2" sourceRef="deptLeaderVerify" targetRef="exclusivegateway1"></sequenceFlow>
17   - <sequenceFlow id="flow3" name="同意" sourceRef="exclusivegateway1" targetRef="hrVerify">
18   - <conditionExpression xsi:type="tFormalExpression"><![CDATA[${deptLeaderApproved == 'true'}]]></conditionExpression>
19   - </sequenceFlow>
20   - <sequenceFlow id="flow4" sourceRef="hrVerify" targetRef="exclusivegateway2"></sequenceFlow>
21   - <sequenceFlow id="flow5" name="同意" sourceRef="exclusivegateway2" targetRef="reportBack">
22   - <conditionExpression xsi:type="tFormalExpression"><![CDATA[${hrApproved == 'true'}]]></conditionExpression>
23   - </sequenceFlow>
24   - <sequenceFlow id="flow6" sourceRef="reportBack" targetRef="endevent1">
25   - <extensionElements>
26   - <activiti:executionListener event="take" delegateExpression="${reportBackEndProcessor}"></activiti:executionListener>
27   - </extensionElements>
28   - </sequenceFlow>
29   - <sequenceFlow id="flow7" name="不同意" sourceRef="exclusivegateway2" targetRef="modifyApply">
30   - <conditionExpression xsi:type="tFormalExpression"><![CDATA[${hrApproved == 'false'}]]></conditionExpression>
31   - </sequenceFlow>
32   - <sequenceFlow id="flow8" name="不同意" sourceRef="exclusivegateway1" targetRef="modifyApply">
33   - <conditionExpression xsi:type="tFormalExpression"><![CDATA[${deptLeaderApproved == 'false'}]]></conditionExpression>
34   - </sequenceFlow>
35   - <sequenceFlow id="flow9" sourceRef="modifyApply" targetRef="exclusivegateway3"></sequenceFlow>
36   - <sequenceFlow id="flow10" name="调整后继续申请" sourceRef="exclusivegateway3" targetRef="deptLeaderVerify">
37   - <conditionExpression xsi:type="tFormalExpression"><![CDATA[${reApply == 'true'}]]></conditionExpression>
38   - </sequenceFlow>
39   - <sequenceFlow id="flow11" name="取消申请,并设置取消标志" sourceRef="exclusivegateway3" targetRef="endevent1">
40   - <extensionElements>
41   - <activiti:executionListener event="take" delegateExpression="${reportBackEndProcessor}"></activiti:executionListener>
42   - </extensionElements>
43   - <conditionExpression xsi:type="tFormalExpression"><![CDATA[${reApply == 'false'}]]></conditionExpression>
44   - </sequenceFlow>
45   - <textAnnotation id="textannotation1" textFormat="text/plain">
46   - <text>请求被驳回后员工可以选择继续申请,或者取消本次申请</text>
47   - </textAnnotation>
48   - <association id="association1" sourceRef="modifyApply" targetRef="textannotation1"></association>
49   - </process>
50   - <bpmndi:BPMNDiagram id="BPMNDiagram_leave-formkey">
51   - <bpmndi:BPMNPlane bpmnElement="leave-formkey" id="BPMNPlane_leave-formkey">
52   - <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
53   - <omgdc:Bounds height="35.0" width="35.0" x="10.0" y="50.0"></omgdc:Bounds>
54   - </bpmndi:BPMNShape>
55   - <bpmndi:BPMNShape bpmnElement="deptLeaderVerify" id="BPMNShape_deptLeaderVerify">
56   - <omgdc:Bounds height="55.0" width="105.0" x="90.0" y="40.0"></omgdc:Bounds>
57   - </bpmndi:BPMNShape>
58   - <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
59   - <omgdc:Bounds height="40.0" width="40.0" x="230.0" y="47.0"></omgdc:Bounds>
60   - </bpmndi:BPMNShape>
61   - <bpmndi:BPMNShape bpmnElement="hrVerify" id="BPMNShape_hrVerify">
62   - <omgdc:Bounds height="55.0" width="105.0" x="310.0" y="40.0"></omgdc:Bounds>
63   - </bpmndi:BPMNShape>
64   - <bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
65   - <omgdc:Bounds height="40.0" width="40.0" x="470.0" y="47.0"></omgdc:Bounds>
66   - </bpmndi:BPMNShape>
67   - <bpmndi:BPMNShape bpmnElement="reportBack" id="BPMNShape_reportBack">
68   - <omgdc:Bounds height="55.0" width="105.0" x="580.0" y="40.0"></omgdc:Bounds>
69   - </bpmndi:BPMNShape>
70   - <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
71   - <omgdc:Bounds height="35.0" width="35.0" x="615.0" y="213.0"></omgdc:Bounds>
72   - </bpmndi:BPMNShape>
73   - <bpmndi:BPMNShape bpmnElement="modifyApply" id="BPMNShape_modifyApply">
74   - <omgdc:Bounds height="55.0" width="105.0" x="198.0" y="120.0"></omgdc:Bounds>
75   - </bpmndi:BPMNShape>
76   - <bpmndi:BPMNShape bpmnElement="exclusivegateway3" id="BPMNShape_exclusivegateway3">
77   - <omgdc:Bounds height="40.0" width="40.0" x="230.0" y="210.0"></omgdc:Bounds>
78   - </bpmndi:BPMNShape>
79   - <bpmndi:BPMNShape bpmnElement="textannotation1" id="BPMNShape_textannotation1">
80   - <omgdc:Bounds height="57.0" width="112.0" x="340.0" y="168.0"></omgdc:Bounds>
81   - </bpmndi:BPMNShape>
82   - <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
83   - <omgdi:waypoint x="45.0" y="67.0"></omgdi:waypoint>
84   - <omgdi:waypoint x="90.0" y="67.0"></omgdi:waypoint>
85   - </bpmndi:BPMNEdge>
86   - <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
87   - <omgdi:waypoint x="195.0" y="67.0"></omgdi:waypoint>
88   - <omgdi:waypoint x="230.0" y="67.0"></omgdi:waypoint>
89   - </bpmndi:BPMNEdge>
90   - <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
91   - <omgdi:waypoint x="270.0" y="67.0"></omgdi:waypoint>
92   - <omgdi:waypoint x="310.0" y="67.0"></omgdi:waypoint>
93   - <bpmndi:BPMNLabel>
94   - <omgdc:Bounds height="11.0" width="22.0" x="269.0" y="50.0"></omgdc:Bounds>
95   - </bpmndi:BPMNLabel>
96   - </bpmndi:BPMNEdge>
97   - <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
98   - <omgdi:waypoint x="415.0" y="67.0"></omgdi:waypoint>
99   - <omgdi:waypoint x="470.0" y="67.0"></omgdi:waypoint>
100   - </bpmndi:BPMNEdge>
101   - <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
102   - <omgdi:waypoint x="510.0" y="67.0"></omgdi:waypoint>
103   - <omgdi:waypoint x="580.0" y="67.0"></omgdi:waypoint>
104   - <bpmndi:BPMNLabel>
105   - <omgdc:Bounds height="11.0" width="22.0" x="529.0" y="50.0"></omgdc:Bounds>
106   - </bpmndi:BPMNLabel>
107   - </bpmndi:BPMNEdge>
108   - <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
109   - <omgdi:waypoint x="632.0" y="95.0"></omgdi:waypoint>
110   - <omgdi:waypoint x="632.0" y="213.0"></omgdi:waypoint>
111   - </bpmndi:BPMNEdge>
112   - <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
113   - <omgdi:waypoint x="490.0" y="87.0"></omgdi:waypoint>
114   - <omgdi:waypoint x="490.0" y="147.0"></omgdi:waypoint>
115   - <omgdi:waypoint x="303.0" y="147.0"></omgdi:waypoint>
116   - <bpmndi:BPMNLabel>
117   - <omgdc:Bounds height="11.0" width="33.0" x="438.0" y="119.0"></omgdc:Bounds>
118   - </bpmndi:BPMNLabel>
119   - </bpmndi:BPMNEdge>
120   - <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
121   - <omgdi:waypoint x="250.0" y="87.0"></omgdi:waypoint>
122   - <omgdi:waypoint x="250.0" y="120.0"></omgdi:waypoint>
123   - <bpmndi:BPMNLabel>
124   - <omgdc:Bounds height="11.0" width="33.0" x="260.0" y="87.0"></omgdc:Bounds>
125   - </bpmndi:BPMNLabel>
126   - </bpmndi:BPMNEdge>
127   - <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
128   - <omgdi:waypoint x="250.0" y="175.0"></omgdi:waypoint>
129   - <omgdi:waypoint x="250.0" y="210.0"></omgdi:waypoint>
130   - </bpmndi:BPMNEdge>
131   - <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
132   - <omgdi:waypoint x="230.0" y="230.0"></omgdi:waypoint>
133   - <omgdi:waypoint x="142.0" y="230.0"></omgdi:waypoint>
134   - <omgdi:waypoint x="142.0" y="95.0"></omgdi:waypoint>
135   - <bpmndi:BPMNLabel>
136   - <omgdc:Bounds height="11.0" width="77.0" x="159.0" y="210.0"></omgdc:Bounds>
137   - </bpmndi:BPMNLabel>
138   - </bpmndi:BPMNEdge>
139   - <bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
140   - <omgdi:waypoint x="270.0" y="230.0"></omgdi:waypoint>
141   - <omgdi:waypoint x="615.0" y="230.0"></omgdi:waypoint>
142   - <bpmndi:BPMNLabel>
143   - <omgdc:Bounds height="33.0" width="100.0" x="58.0" y="-37.0"></omgdc:Bounds>
144   - </bpmndi:BPMNLabel>
145   - </bpmndi:BPMNEdge>
146   - <bpmndi:BPMNEdge bpmnElement="association1" id="BPMNEdge_association1">
147   - <omgdi:waypoint x="303.0" y="147.0"></omgdi:waypoint>
148   - <omgdi:waypoint x="396.0" y="168.0"></omgdi:waypoint>
149   - </bpmndi:BPMNEdge>
150   - </bpmndi:BPMNPlane>
151   - </bpmndi:BPMNDiagram>
152   -</definitions>
153 0 \ No newline at end of file
yudao-admin-server/src/main/resources/processes/leave-update.bpmn 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.activiti.org/processdef">
  3 + <process id="leave-update" name="leave-update" isExecutable="true">
  4 + <startEvent id="start" name="开始" activiti:initiator="applyUserId" activiti:formKey="/flow/leave/apply" />
  5 + <exclusiveGateway id="sid-AA8342FE-0C98-4CDC-B90F-B09B1AFB8F18" name="请假天数" />
  6 + <sequenceFlow id="sid-8022586B-8169-44C2-84FA-46E8278EB2EC" sourceRef="start" targetRef="sid-AA8342FE-0C98-4CDC-B90F-B09B1AFB8F18" />
  7 + <userTask id="pmVerify" name="项目经理审批" activiti:assignee="${pm}" activiti:formKey="/flow/leave/approve"/>
  8 + <userTask id="bmVerify" name="部门经理审批" activiti:assignee="${bm}" activiti:formKey="/flow/leave/approve" />
  9 + <sequenceFlow id="sid-DE7C5477-8C20-42C5-ADE5-AB4A9A13D58D" name="大于3天" sourceRef="sid-AA8342FE-0C98-4CDC-B90F-B09B1AFB8F18" targetRef="bmVerify">
  10 + <conditionExpression xsi:type="tFormalExpression">${day&gt;3}</conditionExpression>
  11 + </sequenceFlow>
  12 + <sequenceFlow id="sid-B8A78811-23EE-47FA-9913-F04F056EBF99" name="小于等于3天" sourceRef="sid-AA8342FE-0C98-4CDC-B90F-B09B1AFB8F18" targetRef="pmVerify">
  13 + <conditionExpression xsi:type="tFormalExpression">${day&lt;=3}</conditionExpression>
  14 + </sequenceFlow>
  15 + <exclusiveGateway id="sid-57610114-27FA-4024-94BF-B0FFE4A02E90" name="" />
  16 + <exclusiveGateway id="sid-287EF265-9109-4233-AEF1-14DF6FEF4B24" name="" />
  17 + <userTask id="hrVerify" name="人事审批" activiti:assignee="${hr}" activiti:formKey="/flow/leave/approve"/>
  18 + <endEvent id="end" />
  19 + <sequenceFlow id="sid-3BDD734B-CF1F-4ECA-A234-92BB81132A1E" name="不同意" sourceRef="sid-57610114-27FA-4024-94BF-B0FFE4A02E90" targetRef="end">
  20 + <extensionElements>
  21 + <activiti:executionListener event="take" delegateExpression="${leaveApplyEndProcessor}"></activiti:executionListener>
  22 + </extensionElements>
  23 + <conditionExpression xsi:type="tFormalExpression">${approved =='false'}</conditionExpression>
  24 + </sequenceFlow>
  25 + <exclusiveGateway id="sid-76B28F95-2D0C-4364-B898-AB1EC8182879" name="" />
  26 + <sequenceFlow id="sid-31C8FAA6-11F1-4744-99F6-D7DB98AB1B10" name="不同意" sourceRef="sid-76B28F95-2D0C-4364-B898-AB1EC8182879" targetRef="end">
  27 + <extensionElements>
  28 + <activiti:executionListener event="take" delegateExpression="${leaveApplyEndProcessor}"></activiti:executionListener>
  29 + </extensionElements>
  30 + <conditionExpression xsi:type="tFormalExpression">${approved =='false'}</conditionExpression>
  31 + </sequenceFlow>
  32 + <sequenceFlow id="sid-63703246-F9C8-4C23-966B-DBC627A81C96" sourceRef="bmVerify" targetRef="sid-287EF265-9109-4233-AEF1-14DF6FEF4B24" />
  33 + <sequenceFlow id="sid-F94C3FB1-CD76-4ED1-BDEC-57B9FCA97E16" name="同意" sourceRef="sid-287EF265-9109-4233-AEF1-14DF6FEF4B24" targetRef="hrVerify">
  34 + <conditionExpression xsi:type="tFormalExpression">${approved =='true'}</conditionExpression>
  35 + </sequenceFlow>
  36 + <sequenceFlow id="sid-FA244B53-B5C2-41AB-85C6-CB2F40879779" name="同意" sourceRef="sid-57610114-27FA-4024-94BF-B0FFE4A02E90" targetRef="hrVerify">
  37 + <conditionExpression xsi:type="tFormalExpression">${approved =='true'}</conditionExpression>
  38 + </sequenceFlow>
  39 + <sequenceFlow id="sid-924D40AA-1A8E-4EC9-B73C-41D2A7DEFCCD" sourceRef="pmVerify" targetRef="sid-57610114-27FA-4024-94BF-B0FFE4A02E90" />
  40 + <sequenceFlow id="sid-ED1242F0-B0A6-4677-A02C-D0D06715DEBD" sourceRef="hrVerify" targetRef="sid-76B28F95-2D0C-4364-B898-AB1EC8182879" />
  41 + <sequenceFlow id="sid-B82F41EA-B147-4A19-AD93-A4EC3C40C92E" name="不同意" sourceRef="sid-287EF265-9109-4233-AEF1-14DF6FEF4B24" targetRef="end">
  42 + <extensionElements>
  43 + <activiti:executionListener event="take" delegateExpression="${leaveApplyEndProcessor}"></activiti:executionListener>
  44 + </extensionElements>
  45 + <conditionExpression xsi:type="tFormalExpression">${approved =='false'}</conditionExpression>
  46 + </sequenceFlow>
  47 + <sequenceFlow id="sid-028073A9-C8C6-4B60-B0AC-6B61B79C17C4" name="同意" sourceRef="sid-76B28F95-2D0C-4364-B898-AB1EC8182879" targetRef="end">
  48 + <extensionElements>
  49 + <activiti:executionListener event="take" delegateExpression="${leaveApplyEndProcessor}"></activiti:executionListener>
  50 + </extensionElements>
  51 + <conditionExpression xsi:type="tFormalExpression">${approved =='true'}</conditionExpression>
  52 + </sequenceFlow>
  53 + </process>
  54 + <bpmndi:BPMNDiagram id="BPMNDiagram_leave-update">
  55 + <bpmndi:BPMNPlane id="BPMNPlane_leave-update" bpmnElement="leave-update">
  56 + <bpmndi:BPMNEdge id="BPMNEdge_sid-8022586B-8169-44C2-84FA-46E8278EB2EC" bpmnElement="sid-8022586B-8169-44C2-84FA-46E8278EB2EC">
  57 + <omgdi:waypoint x="112.75714598551785" y="126.17405584019453" />
  58 + <omgdi:waypoint x="143.71121010641568" y="126.40818009529674" />
  59 + </bpmndi:BPMNEdge>
  60 + <bpmndi:BPMNEdge id="BPMNEdge_sid-DE7C5477-8C20-42C5-ADE5-AB4A9A13D58D" bpmnElement="sid-DE7C5477-8C20-42C5-ADE5-AB4A9A13D58D">
  61 + <omgdi:waypoint x="163.86363505003538" y="106.56060503891644" />
  62 + <omgdi:waypoint x="163.86363505003538" y="53.13651552996619" />
  63 + <omgdi:waypoint x="234.27272508339232" y="53.13651552996619" />
  64 + <bpmndi:BPMNLabel>
  65 + <omgdc:Bounds x="159" y="77" width="40" height="14" />
  66 + </bpmndi:BPMNLabel>
  67 + </bpmndi:BPMNEdge>
  68 + <bpmndi:BPMNEdge id="BPMNEdge_sid-B8A78811-23EE-47FA-9913-F04F056EBF99" bpmnElement="sid-B8A78811-23EE-47FA-9913-F04F056EBF99">
  69 + <omgdi:waypoint x="163.36363505003538" y="146.06060503891644" />
  70 + <omgdi:waypoint x="163.36363505003538" y="189.4949990648568" />
  71 + <omgdi:waypoint x="234.27272508339232" y="189.4949990648568" />
  72 + <bpmndi:BPMNLabel>
  73 + <omgdc:Bounds x="148" y="165" width="62" height="14" />
  74 + </bpmndi:BPMNLabel>
  75 + </bpmndi:BPMNEdge>
  76 + <bpmndi:BPMNEdge id="BPMNEdge_sid-924D40AA-1A8E-4EC9-B73C-41D2A7DEFCCD" bpmnElement="sid-924D40AA-1A8E-4EC9-B73C-41D2A7DEFCCD">
  77 + <omgdi:waypoint x="331.23231804130836" y="189.49499906485684" />
  78 + <omgdi:waypoint x="385.7878751389872" y="189.49499906485684" />
  79 + </bpmndi:BPMNEdge>
  80 + <bpmndi:BPMNEdge id="BPMNEdge_sid-63703246-F9C8-4C23-966B-DBC627A81C96" bpmnElement="sid-63703246-F9C8-4C23-966B-DBC627A81C96">
  81 + <omgdi:waypoint x="326.19171605111364" y="53.34371922706731" />
  82 + <omgdi:waypoint x="371.04578381953866" y="53.54593921607711" />
  83 + </bpmndi:BPMNEdge>
  84 + <bpmndi:BPMNEdge id="BPMNEdge_sid-3BDD734B-CF1F-4ECA-A234-92BB81132A1E" bpmnElement="sid-3BDD734B-CF1F-4ECA-A234-92BB81132A1E">
  85 + <omgdi:waypoint x="425.32578782529805" y="189.957086378546" />
  86 + <omgdi:waypoint x="643.3636579939932" y="189.52287904122937" />
  87 + <bpmndi:BPMNLabel>
  88 + <omgdc:Bounds x="518" y="172" width="33" height="14" />
  89 + </bpmndi:BPMNLabel>
  90 + </bpmndi:BPMNEdge>
  91 + <bpmndi:BPMNEdge id="BPMNEdge_sid-FA244B53-B5C2-41AB-85C6-CB2F40879779" bpmnElement="sid-FA244B53-B5C2-41AB-85C6-CB2F40879779">
  92 + <omgdi:waypoint x="410.4195073141635" y="174.12663124003316" />
  93 + <omgdi:waypoint x="446.39393516122516" y="123.49474452854777" />
  94 + <bpmndi:BPMNLabel>
  95 + <omgdc:Bounds x="417" y="131" width="23" height="14" />
  96 + </bpmndi:BPMNLabel>
  97 + </bpmndi:BPMNEdge>
  98 + <bpmndi:BPMNEdge id="BPMNEdge_sid-F94C3FB1-CD76-4ED1-BDEC-57B9FCA97E16" bpmnElement="sid-F94C3FB1-CD76-4ED1-BDEC-57B9FCA97E16">
  99 + <omgdi:waypoint x="396.41667858914667" y="67.35619707424723" />
  100 + <omgdi:waypoint x="446.39393516122516" y="100.69330097746277" />
  101 + <bpmndi:BPMNLabel>
  102 + <omgdc:Bounds x="410" y="66" width="23" height="14" />
  103 + </bpmndi:BPMNLabel>
  104 + </bpmndi:BPMNEdge>
  105 + <bpmndi:BPMNEdge id="BPMNEdge_sid-B82F41EA-B147-4A19-AD93-A4EC3C40C92E" bpmnElement="sid-B82F41EA-B147-4A19-AD93-A4EC3C40C92E">
  106 + <omgdi:waypoint x="410.23752422668827" y="53.53535143670566" />
  107 + <omgdi:waypoint x="704.9797941833938" y="53.53535143670566" />
  108 + <omgdi:waypoint x="704.9797941833938" y="190.5669944706311" />
  109 + <omgdi:waypoint x="671.3600836513306" y="189.81010495572275" />
  110 + <bpmndi:BPMNLabel>
  111 + <omgdc:Bounds x="703" y="119" width="33" height="14" />
  112 + </bpmndi:BPMNLabel>
  113 + </bpmndi:BPMNEdge>
  114 + <bpmndi:BPMNEdge id="BPMNEdge_sid-ED1242F0-B0A6-4677-A02C-D0D06715DEBD" bpmnElement="sid-ED1242F0-B0A6-4677-A02C-D0D06715DEBD">
  115 + <omgdi:waypoint x="542.3536331797492" y="111.73247557218357" />
  116 + <omgdi:waypoint x="567.6060552057011" y="111.73247557218357" />
  117 + </bpmndi:BPMNEdge>
  118 + <bpmndi:BPMNEdge id="BPMNEdge_sid-31C8FAA6-11F1-4744-99F6-D7DB98AB1B10" bpmnElement="sid-31C8FAA6-11F1-4744-99F6-D7DB98AB1B10">
  119 + <omgdi:waypoint x="589.3360756732812" y="130.00245510460337" />
  120 + <omgdi:waypoint x="646.8251334621888" y="180.27870448400202" />
  121 + <bpmndi:BPMNLabel>
  122 + <omgdc:Bounds x="602" y="137" width="33" height="14" />
  123 + </bpmndi:BPMNLabel>
  124 + </bpmndi:BPMNEdge>
  125 + <bpmndi:BPMNEdge id="BPMNEdge_sid-028073A9-C8C6-4B60-B0AC-6B61B79C17C4" bpmnElement="sid-028073A9-C8C6-4B60-B0AC-6B61B79C17C4">
  126 + <omgdi:waypoint x="607.1060552057011" y="112.23247557218357" />
  127 + <omgdi:waypoint x="657.3636302334985" y="112.23247557218357" />
  128 + <omgdi:waypoint x="657.3636302334985" y="175.49499906485684" />
  129 + <bpmndi:BPMNLabel>
  130 + <omgdc:Bounds x="621" y="94" width="23" height="14" />
  131 + </bpmndi:BPMNLabel>
  132 + </bpmndi:BPMNEdge>
  133 + <bpmndi:BPMNShape id="BPMNShape_startEvent1" bpmnElement="start">
  134 + <omgdc:Bounds x="83" y="111" width="30" height="30" />
  135 + <bpmndi:BPMNLabel>
  136 + <omgdc:Bounds x="87" y="148" width="22" height="14" />
  137 + </bpmndi:BPMNLabel>
  138 + </bpmndi:BPMNShape>
  139 + <bpmndi:BPMNShape id="BPMNShape_sid-AA8342FE-0C98-4CDC-B90F-B09B1AFB8F18" bpmnElement="sid-AA8342FE-0C98-4CDC-B90F-B09B1AFB8F18" isMarkerVisible="true">
  140 + <omgdc:Bounds x="143" y="106" width="40" height="40" />
  141 + <bpmndi:BPMNLabel>
  142 + <omgdc:Bounds x="217" y="116" width="44" height="14" />
  143 + </bpmndi:BPMNLabel>
  144 + </bpmndi:BPMNShape>
  145 + <bpmndi:BPMNShape id="BPMNShape_sid-815754A6-1E86-43E5-8287-6D2A1DF59121" bpmnElement="pmVerify">
  146 + <omgdc:Bounds x="234" y="167" width="97" height="46" />
  147 + </bpmndi:BPMNShape>
  148 + <bpmndi:BPMNShape id="BPMNShape_sid-1E8B3F37-4DF8-459A-921C-74F2C210E3E2" bpmnElement="bmVerify">
  149 + <omgdc:Bounds x="234" y="30" width="92" height="46" />
  150 + </bpmndi:BPMNShape>
  151 + <bpmndi:BPMNShape id="BPMNShape_sid-57610114-27FA-4024-94BF-B0FFE4A02E90" bpmnElement="sid-57610114-27FA-4024-94BF-B0FFE4A02E90" isMarkerVisible="true">
  152 + <omgdc:Bounds x="386" y="169" width="40" height="40" />
  153 + <bpmndi:BPMNLabel>
  154 + <omgdc:Bounds x="384" y="216" width="44" height="14" />
  155 + </bpmndi:BPMNLabel>
  156 + </bpmndi:BPMNShape>
  157 + <bpmndi:BPMNShape id="BPMNShape_sid-287EF265-9109-4233-AEF1-14DF6FEF4B24" bpmnElement="sid-287EF265-9109-4233-AEF1-14DF6FEF4B24" isMarkerVisible="true">
  158 + <omgdc:Bounds x="371" y="33" width="40" height="40" />
  159 + <bpmndi:BPMNLabel>
  160 + <omgdc:Bounds x="369" y="80" width="44" height="14" />
  161 + </bpmndi:BPMNLabel>
  162 + </bpmndi:BPMNShape>
  163 + <bpmndi:BPMNShape id="BPMNShape_sid-A9CA50A0-1773-4341-B123-85FD1F360277" bpmnElement="hrVerify">
  164 + <omgdc:Bounds x="446" y="91" width="96" height="42" />
  165 + </bpmndi:BPMNShape>
  166 + <bpmndi:BPMNShape id="BPMNShape_sid-1B06331A-52FE-4D1B-A62B-80E71ABB7D0E" bpmnElement="end">
  167 + <omgdc:Bounds x="643" y="175" width="28" height="28" />
  168 + </bpmndi:BPMNShape>
  169 + <bpmndi:BPMNShape id="BPMNShape_sid-76B28F95-2D0C-4364-B898-AB1EC8182879" bpmnElement="sid-76B28F95-2D0C-4364-B898-AB1EC8182879" isMarkerVisible="true">
  170 + <omgdc:Bounds x="568" y="92" width="40" height="40" />
  171 + <bpmndi:BPMNLabel>
  172 + <omgdc:Bounds x="566" y="139" width="44" height="14" />
  173 + </bpmndi:BPMNLabel>
  174 + </bpmndi:BPMNShape>
  175 + </bpmndi:BPMNPlane>
  176 + </bpmndi:BPMNDiagram>
  177 +</definitions>
0 178 \ No newline at end of file
... ...
yudao-admin-ui/src/api/oa/leave.js
... ... @@ -51,6 +51,13 @@ export function createFormKeyLeave(data) {
51 51 })
52 52 }
53 53  
  54 +export function getLeaveApplyMembers() {
  55 + return request({
  56 + url: '/oa/leave/getLeaveApplyMembers',
  57 + method: 'get'
  58 + })
  59 +}
  60 +
54 61 // 导出请假申请 Excel
55 62 export function exportLeaveExcel(query) {
56 63 return request({
... ...
yudao-admin-ui/src/router/index.js
... ... @@ -133,8 +133,8 @@ export const constantRoutes = [
133 133 {
134 134 path: 'leave/apply',
135 135 component: (resolve) => require(['@/views/oa/leave/apply/index'], resolve),
136   - name: '请假表单',
137   - meta: { title: '请假表单', icon: 'form' }
  136 + name: '请假表单-申请',
  137 + meta: { title: '请假表单-申请', icon: 'form' }
138 138 }
139 139 ]
140 140 },
... ... @@ -145,52 +145,10 @@ export const constantRoutes = [
145 145 redirect: 'noredirect',
146 146 children: [
147 147 {
148   - path: 'leave/approve-leader',
149   - component: (resolve) => require(['@/views/oa/leave/approve-leader/index'], resolve),
150   - name: '请假表单-部门领导审批',
151   - meta: { title: '请假表单-部门领导审批', icon: 'form' }
152   - }
153   - ]
154   - },
155   - {
156   - path: '/flow',
157   - component: Layout,
158   - hidden: true,
159   - redirect: 'noredirect',
160   - children: [
161   - {
162   - path: 'leave/approve-hr',
163   - component: (resolve) => require(['@/views/oa/leave/approve-hr/index'], resolve),
164   - name: '请假表单-人事审批',
165   - meta: { title: '请假表单-人事审批', icon: 'form' }
166   - }
167   - ]
168   - },
169   - {
170   - path: '/flow',
171   - component: Layout,
172   - hidden: true,
173   - redirect: 'noredirect',
174   - children: [
175   - {
176   - path: 'leave/confirm',
177   - component: (resolve) => require(['@/views/oa/leave/confirm/index'], resolve),
178   - name: '请假表单-确认',
179   - meta: { title: '请假表单-确认', icon: 'form' }
180   - }
181   - ]
182   - },
183   - {
184   - path: '/flow',
185   - component: Layout,
186   - hidden: true,
187   - redirect: 'noredirect',
188   - children: [
189   - {
190   - path: 'leave/modify',
191   - component: (resolve) => require(['@/views/oa/leave/modify/index'], resolve),
192   - name: '请假表单-修改',
193   - meta: { title: '请假表单-修改', icon: 'form' }
  148 + path: 'leave/approve',
  149 + component: (resolve) => require(['@/views/oa/leave/approve/index'], resolve),
  150 + name: '请假表单-审批',
  151 + meta: { title: '请假表单-审批', icon: 'form' }
194 152 }
195 153 ]
196 154 }
... ...
yudao-admin-ui/src/utils/dict.js
... ... @@ -31,7 +31,7 @@ export const DICT_TYPE = {
31 31  
32 32 TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type',
33 33  
34   - OA_LEAVE_STATUS: 'oa_leave_status',
  34 + OA_LEAVE_STATUS: 'flow_status',
35 35 OA_LEAVE_TYPE: 'oa_leave_type'
36 36 }
37 37  
... ...
yudao-admin-ui/src/views/oa/flow/index.vue
1 1 <template>
2 2 <div class="app-container">
3 3 <el-row>
4   - <el-button type="primary" v-on:click="leave">请假申请</el-button>
  4 + <div>TODO @芋艿, 待办请假和 已办请假,感觉可以做成通用,不同的业务表单对应的待办任务和已办任务可以通用,或许可以想个更通用的名字 </div>
5 5 </el-row>
6 6 </div>
7 7 </template>
... ... @@ -25,12 +25,12 @@ export default {
25 25  
26 26 },
27 27 methods: {
28   - leave() {
29   - getStartForm('leave-formkey').then(response => {
30   - const route = response.data;
31   - this.$router.replace(route);
32   - });
33   - }
  28 + // leave() {
  29 + // getStartForm('leave-formkey').then(response => {
  30 + // const route = response.data;
  31 + // this.$router.replace(route);
  32 + // });
  33 + // }
34 34 }
35 35 };
36 36 </script>
... ...
yudao-admin-ui/src/views/oa/leave/apply/index.vue
... ... @@ -38,7 +38,7 @@
38 38 </template>
39 39  
40 40 <script>
41   -import { createFormKeyLeave } from "@/api/oa/leave"
  41 +import { createFormKeyLeave} from "@/api/oa/leave"
42 42 import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
43 43 export default {
44 44 name: "ApplyLeave",
... ... @@ -47,13 +47,21 @@ export default {
47 47 data() {
48 48 return {
49 49 // 表单参数
50   - form: {},
  50 + form: {
  51 + processKey: 'leave-update',
  52 + taskVariables:{
  53 + hr: "",
  54 + pm: "",
  55 + bm: ""
  56 + }
  57 + },
51 58 // 表单校验
52 59 rules: {
53 60 startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }],
54 61 endTime: [{ required: true, message: "结束时间不能为空", trigger: "blur" }],
55 62 applyTime: [{ required: true, message: "申请时间不能为空", trigger: "blur" }],
56 63 },
  64 +
57 65 statusFormat(row, column) {
58 66 return getDictDataLabel(DICT_TYPE.OA_LEAVE_STATUS, row.status)
59 67 },
... ... @@ -62,6 +70,9 @@ export default {
62 70 };
63 71 },
64 72 created() {
  73 + this.form.taskVariables.hr = this.$route.query.hr;
  74 + this.form.taskVariables.pm = this.$route.query.pm;
  75 + this.form.taskVariables.bm = this.$route.query.bm;
65 76 },
66 77 methods: {
67 78 /** 提交按钮 */
... ... @@ -70,13 +81,7 @@ export default {
70 81 if (!valid) {
71 82 return;
72 83 }
73   - // 修改的提交
74   - // if (this.form.id != null) {
75   - // updateLeave(this.form).then(response => {
76   - // this.msgSuccess("修改成功");
77   - // });
78   - // return;
79   - // }
  84 +
80 85 // 添加的提交
81 86 createFormKeyLeave(this.form).then(response => {
82 87 this.msgSuccess("新增成功");
... ...
yudao-admin-ui/src/views/oa/leave/approve-leader/index.vue deleted
1   -<template>
2   - <div class="app-container">
3   - <el-tabs type="border-card">
4   - <el-tab-pane label="任务处理">
5   - <el-form ref="form" :model="form" label-width="80px">
6   - <el-row :gutter="20">
7   - <el-col :span="6"><el-form-item label="申请人" >{{form.userId}}</el-form-item></el-col>
8   - <el-col :span="6">
9   - <el-form-item label="请假类型" prop="leaveType">
10   - {{ getDictDataLabel(DICT_TYPE.OA_LEAVE_TYPE, form.leaveType) }}
11   - </el-form-item>
12   - </el-col>
13   - <el-col :span="6"><el-form-item label="原因" prop="reason">{{form.reason}}</el-form-item></el-col>
14   - </el-row>
15   - <el-row :gutter="20">
16   - <el-col :span="6"><el-form-item label="开始时间" >{{ parseTime(form.startTime) }}</el-form-item></el-col>
17   - <el-col :span="6"><el-form-item label="结束时间" prop="endTime">{{ parseTime(form.endTime) }}</el-form-item></el-col>
18   - <el-form-item label="申请时间" prop="applyTime">{{ parseTime(form.applyTime) }}</el-form-item>
19   - </el-row>
20   - </el-form>
21   - <el-divider></el-divider>
22   - <el-form ref="taskForm" :model="leaveApprove" :rules="rules" label-width="80px">
23   - <el-form-item label="是否同意" prop="approved">
24   - <el-select v-model="leaveApprove.approved" placeholder="是否同意" v-on:change="approveChange">
25   - <el-option
26   - v-for="dict in approvedData"
27   - :key="parseInt(dict.value)"
28   - :label="dict.label"
29   - :value="parseInt(dict.value)"
30   - />
31   - </el-select>
32   - </el-form-item>
33   - <el-form-item label="处理意见" prop="comment">
34   - <el-col :span="11">
35   - <el-input
36   - type="textarea"
37   - :rows="3"
38   - v-model="leaveApprove.comment">
39   - </el-input>
40   - </el-col>
41   - </el-form-item>
42   - <el-form-item>
43   - <el-button type="primary" @click="submitForm">确 定</el-button>
44   - </el-form-item>
45   - </el-form>
46   - </el-tab-pane>
47   - <el-tab-pane label="历史跟踪">
48   - <el-steps :active="stepActive" simple finish-status="success">
49   - <el-step :title="stepTitle(item)" icon="el-icon-edit" v-for="(item) in handleTask.historyTask" ></el-step>
50   - </el-steps>
51   - <br/>
52   - <el-steps direction="vertical" :active="stepActive" space="65px">
53   - <el-step :title="stepTitle(item)" :description="stepDes(item)" v-for="(item) in handleTask.historyTask" ></el-step>
54   - </el-steps>
55   - </el-tab-pane>
56   - <el-tab-pane label="流程图">流程图-TODO</el-tab-pane>
57   - </el-tabs>
58   - </div>
59   -</template>
60   -
61   -<script>
62   -import { getLeave } from "@/api/oa/leave"
63   -import { completeTask,taskSteps } from "@/api/oa/todo";
64   -import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
65   -export default {
66   - name: "ApproveLeaderLeave",
67   - components: {
68   - },
69   - data() {
70   - return {
71   - // 表单参数
72   - form: {},
73   - // 表单校验
74   - rules: {
75   - comment: [{ required: true, message: "意见不能为空", trigger: "blur" }]
76   - },
77   - handleTask: {
78   - historyTask:[]
79   - },
80   - leaveApprove: {
81   - approved : 1,
82   - variables: {},
83   - taskId: "",
84   - comment: "同意"
85   - },
86   - approvedData: [
87   - {
88   - value: 1,
89   - label: '同意'
90   - },
91   - {
92   - value: 0,
93   - label: '不同意'
94   - }
95   - ],
96   - statusFormat(row, column) {
97   - return getDictDataLabel(DICT_TYPE.OA_LEAVE_STATUS, row.status)
98   - },
99   - leaveTypeDictData: getDictDatas(DICT_TYPE.OA_LEAVE_TYPE),
100   - leaveStatusData: getDictDatas(DICT_TYPE.OA_LEAVE_STATUS)
101   - };
102   - },
103   - created() {
104   - const businessKey = this.$route.query.businessKey;
105   - const taskId = this.$route.query.taskId;
106   - this.leaveApprove.taskId = taskId;
107   - this.getForm(businessKey);
108   - },
109   - computed:{
110   - stepActive: function () {
111   - let idx = 0;
112   - for(let i=0; i<this.handleTask.historyTask.length; i++){
113   - if(this.handleTask.historyTask[i].status === 1){
114   - idx= idx+1;
115   - }else{
116   - break;
117   - }
118   - }
119   - return idx;
120   - },
121   - stepTitle() {
122   - return function (item) {
123   - let name = item.stepName;
124   - if (item.status === 1) {
125   - name += '(已完成)'
126   - }
127   - if (item.status === 0) {
128   - name += '(进行中)'
129   - }
130   - return name;
131   - }
132   - },
133   - stepDes(){
134   - return function (item) {
135   - let desc = "";
136   - if (item.status === 1) {
137   - desc+="审批人:["+ item.assignee +"] 审批意见: [" + item.comment + "] 审批时间: " + this.parseTime(item.endTime);
138   - }
139   - return desc;
140   - }
141   - }
142   - },
143   - methods: {
144   - /** 提交按钮 */
145   - submitForm() {
146   - this.$refs["taskForm"].validate(valid => {
147   - if (!valid) {
148   - return;
149   - }
150   - if (this.leaveApprove.approved == 1) {
151   - this.leaveApprove.variables["deptLeaderApproved"] = true;
152   - }
153   - if (this.leaveApprove.approved == 0) {
154   - this.leaveApprove.variables["deptLeaderApproved"] = false;
155   - }
156   - completeTask(this.leaveApprove).then(response => {
157   - this.msgSuccess("执行任务成功");
158   - this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => {
159   - //if (this.isActive(this.$route)) {
160   - this.$router.push({path: '/oa/todo'})
161   - //}
162   - })
163   - });
164   - });
165   -
166   - },
167   - getForm(id){
168   - getLeave(id).then(response => {
169   - this.form = response.data;
170   - });
171   - const data = {
172   - taskId : this.leaveApprove.taskId,
173   - businessKey: id,
174   - }
175   - taskSteps(data).then(response => {
176   - this.handleTask = response.data;
177   -
178   - });
179   - },
180   - approveChange(){
181   - if (this.leaveApprove.approved === 1) {
182   - this.leaveApprove.comment = "同意"
183   - }
184   - if(this.leaveApprove.approved === 0){
185   - this.leaveApprove.comment = "不同意"
186   - }
187   - }
188   - }
189   -};
190   -</script>
yudao-admin-ui/src/views/oa/leave/approve-hr/index.vue renamed to yudao-admin-ui/src/views/oa/leave/approve/index.vue
... ... @@ -62,11 +62,11 @@
62 62 </template>
63 63  
64 64 <script>
65   -import { getLeave } from "@/api/oa/leave"
  65 +import { getLeave,getLeaveApplyMembers } from "@/api/oa/leave"
66 66 import { completeTask,taskSteps, getHighlightImg } from "@/api/oa/todo";
67 67 import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
68 68 export default {
69   - name: "HrApproveLeave",
  69 + name: "ApproveLeave",
70 70 components: {
71 71 },
72 72 data() {
... ... @@ -82,7 +82,11 @@ export default {
82 82 },
83 83 leaveApprove: {
84 84 approved : 1,
85   - variables: {},
  85 + variables: {
  86 + hr: "",
  87 + pm: "",
  88 + bm: ""
  89 + },
86 90 taskId: "",
87 91 processInstanceId: "",
88 92 comment: "同意"
... ... @@ -161,12 +165,13 @@ export default {
161 165 return;
162 166 }
163 167 if (this.leaveApprove.approved == 1) {
164   - this.leaveApprove.variables["hrApproved"] = true;
  168 + this.leaveApprove.variables["approved"] = true;
165 169 }
166 170 if (this.leaveApprove.approved == 0) {
167   - this.leaveApprove.variables["hrApproved"] = false;
  171 + this.leaveApprove.variables["approved"] = false;
168 172 }
169 173 completeTask(this.leaveApprove).then(response => {
  174 +
170 175 this.msgSuccess("执行任务成功");
171 176 this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => {
172 177 //if (this.isActive(this.$route)) {
... ... @@ -187,6 +192,12 @@ export default {
187 192 taskSteps(data).then(response => {
188 193 this.handleTask = response.data;
189 194 });
  195 +
  196 + getLeaveApplyMembers().then(response => {
  197 + this.leaveApprove.variables.hr = response.data.hr;
  198 + this.leaveApprove.variables.bm = response.data.bm;
  199 + this.leaveApprove.variables.pm = response.data.pm;
  200 + });
190 201 },
191 202 approveChange(){
192 203 if (this.leaveApprove.approved === 1) {
... ...
yudao-admin-ui/src/views/oa/leave/confirm/index.vue deleted
1   -<template>
2   - <div class="app-container">
3   - <el-tabs type="border-card">
4   - <el-tab-pane label="任务处理">
5   - <el-form ref="form" :model="form" label-width="80px">
6   - <el-row :gutter="20">
7   - <el-col :span="6"><el-form-item label="申请人" >{{form.userId}}</el-form-item></el-col>
8   - <el-col :span="6">
9   - <el-form-item label="请假类型" prop="leaveType">
10   - {{ getDictDataLabel(DICT_TYPE.OA_LEAVE_TYPE, form.leaveType) }}
11   - </el-form-item>
12   - </el-col>
13   - <el-col :span="6"><el-form-item label="原因" prop="reason">{{form.reason}}</el-form-item></el-col>
14   - </el-row>
15   - <el-row :gutter="20">
16   - <el-col :span="6"><el-form-item label="开始时间" >{{ parseTime(form.startTime) }}</el-form-item></el-col>
17   - <el-col :span="6"><el-form-item label="结束时间" prop="endTime">{{ parseTime(form.endTime) }}</el-form-item></el-col>
18   - <el-form-item label="申请时间" prop="applyTime">{{ parseTime(form.applyTime) }}</el-form-item>
19   - </el-row>
20   - <el-row :gutter="20">
21   - <el-col :span="6"><el-button type="primary" @click="submitForm">确 定</el-button></el-col>
22   - </el-row>
23   - </el-form>
24   - </el-tab-pane>
25   - <el-tab-pane label="历史跟踪">
26   - <el-steps :active="stepActive" simple finish-status="success">
27   - <el-step :title="stepTitle(item)" icon="el-icon-edit" v-for="(item) in handleTask.historyTask" ></el-step>
28   - </el-steps>
29   - <br/>
30   - <el-steps direction="vertical" :active="stepActive" space="65px">
31   - <el-step :title="stepTitle(item)" :description="stepDes(item)" v-for="(item) in handleTask.historyTask" ></el-step>
32   - </el-steps>
33   - </el-tab-pane>
34   - <el-tab-pane label="流程图">流程图-TODO</el-tab-pane>
35   - </el-tabs>
36   - </div>
37   -</template>
38   -
39   -<script>
40   -import { getLeave } from "@/api/oa/leave"
41   -import { completeTask,taskSteps } from "@/api/oa/todo";
42   -import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
43   -export default {
44   - name: "ConfirmLeave",
45   - components: {
46   - },
47   - data() {
48   - return {
49   - // 表单参数
50   - form: {},
51   - // 表单校验
52   - rules: {
53   - },
54   - handleTask: {
55   - historyTask:[]
56   - },
57   - leaveApprove: {
58   - variables: {},
59   - taskId: "",
60   - comment: ""
61   - },
62   - statusFormat(row, column) {
63   - return getDictDataLabel(DICT_TYPE.OA_LEAVE_STATUS, row.status)
64   - },
65   - leaveTypeDictData: getDictDatas(DICT_TYPE.OA_LEAVE_TYPE),
66   - leaveStatusData: getDictDatas(DICT_TYPE.OA_LEAVE_STATUS)
67   - };
68   - },
69   - created() {
70   - const businessKey = this.$route.query.businessKey;
71   - const taskId = this.$route.query.taskId;
72   - this.leaveApprove.taskId = taskId;
73   - this.getForm(businessKey);
74   - },
75   - computed:{
76   - stepActive: function () {
77   - let idx = 0;
78   - for(let i=0; i<this.handleTask.historyTask.length; i++){
79   - if(this.handleTask.historyTask[i].status === 1){
80   - idx= idx+1;
81   - }else{
82   - break;
83   - }
84   - }
85   - return idx;
86   - },
87   - stepTitle() {
88   - return function (item) {
89   - let name = item.stepName;
90   - if (item.status === 1) {
91   - name += '(已完成)'
92   - }
93   - if (item.status === 0) {
94   - name += '(进行中)'
95   - }
96   - return name;
97   - }
98   - },
99   - stepDes(){
100   - return function (item) {
101   - let desc = "";
102   - if (item.status === 1) {
103   - desc+="审批人:["+ item.assignee +"] 审批意见: [" + item.comment + "] 审批时间: " + this.parseTime(item.endTime);
104   - }
105   - return desc;
106   - }
107   - }
108   - },
109   - methods: {
110   - /** 提交按钮 */
111   - submitForm() {
112   - completeTask(this.leaveApprove).then(response => {
113   - this.msgSuccess("执行任务成功");
114   - this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => {
115   - //if (this.isActive(this.$route)) {
116   - this.$router.push({path: '/oa/todo'})
117   - //}
118   - })
119   - })
120   - },
121   - getForm(id){
122   - getLeave(id).then(response => {
123   - this.form = response.data;
124   - });
125   - const data = {
126   - taskId : this.leaveApprove.taskId,
127   - businessKey: id,
128   - }
129   - taskSteps(data).then(response => {
130   - this.handleTask = response.data;
131   -
132   - });
133   -
134   - }
135   - }
136   -};
137   -</script>
yudao-admin-ui/src/views/oa/leave/index.vue
... ... @@ -49,6 +49,9 @@
49 49  
50 50 <!-- 操作工具栏 -->
51 51 <el-row :gutter="10" class="mb8">
  52 + <el-col :span="1.5">
  53 + <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
  54 + </el-col>
52 55 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
53 56 </el-row>
54 57  
... ... @@ -155,7 +158,7 @@
155 158 </template>
156 159  
157 160 <script>
158   -import { createLeave, updateLeave, deleteLeave, getLeave, getLeavePage, exportLeaveExcel } from "@/api/oa/leave"
  161 +import { createLeave, updateLeave, getLeaveApplyMembers, getLeave, getLeavePage, exportLeaveExcel } from "@/api/oa/leave"
159 162 import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
160 163 import { processHistorySteps,getHighlightImg } from '@/api/oa/todo'
161 164 export default {
... ... @@ -319,9 +322,17 @@ export default {
319 322 },
320 323 /** 新增按钮操作 */
321 324 handleAdd() {
322   - this.reset();
323   - this.open = true;
324   - this.title = "添加请假申请";
  325 + getLeaveApplyMembers().then(response => {
  326 + const route = {
  327 + path: '/flow/leave/apply',
  328 + query: {
  329 + hr: response.data.hr,
  330 + pm: response.data.pm,
  331 + bm : response.data.bm
  332 + }
  333 + }
  334 + this.$router.replace(route);
  335 + });
325 336 },
326 337 /** 详情按钮操作 */
327 338 handleDetail(row) {
... ...
yudao-admin-ui/src/views/oa/leave/modify/index.vue deleted
1   -<template>
2   - <div class="app-container">
3   - <el-tabs type="border-card">
4   - <el-tab-pane label="任务处理">
5   - <el-form ref="form" :model="form" :rules="rules" label-width="100px">
6   - <el-row>
7   - <el-col :span="15">
8   - <el-form-item label="是否调整申请" prop="reApply">
9   - <el-select v-model="reApplySelect" placeholder="是否调整申请" v-on:change="reApplyChange">
10   - <el-option
11   - v-for="dict in reApplyData"
12   - :key="parseInt(dict.value)"
13   - :label="dict.label"
14   - :value="parseInt(dict.value)"
15   - />
16   - </el-select>
17   - </el-form-item>
18   - </el-col>
19   - </el-row>
20   - <el-row :gutter="20" v-show="modifyShow">
21   - <el-col :span="8"><el-form-item label="申请人" >{{form.userId}}</el-form-item></el-col>
22   - <el-col :span="8">
23   - <el-form-item label="申请时间" prop="applyTime">{{ parseTime(form.applyTime) }}</el-form-item>
24   - </el-col>
25   - </el-row>
26   - <el-row :gutter="20" v-show="modifyShow">
27   - <el-col :span="8">
28   - <el-form-item label="开始时间" prop="startTime">
29   - <el-date-picker clearable size="small" v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择开始时间" />
30   - </el-form-item>
31   - </el-col>
32   - <el-col :span="8">
33   - <el-form-item label="结束时间" prop="endTime">
34   - <el-date-picker clearable size="small" v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择结束时间" />
35   - </el-form-item>
36   - </el-col>
37   - </el-row>
38   - <el-row v-show="modifyShow" >
39   - <el-col :span="8">
40   - <el-form-item label="请假类型" prop="leaveType">
41   - <el-select v-model="form.leaveType" placeholder="请选择">
42   - <el-option
43   - v-for="dict in leaveTypeDictData"
44   - :key="dict.value"
45   - :label="dict.label"
46   - :value="dict.value"
47   - />
48   - </el-select>
49   - </el-form-item>
50   - </el-col>
51   - </el-row>
52   - <el-row v-show="modifyShow">
53   - <el-col :span="15">
54   - <el-form-item label="原因" prop="reason">
55   - <el-input
56   - type="textarea"
57   - :rows="3"
58   - v-model="form.reason"
59   - placeholder="请输入原因" />
60   - </el-form-item>
61   - </el-col>
62   - </el-row>
63   - <el-form-item>
64   - <el-button type="primary" @click="submitForm">确 定</el-button>
65   - </el-form-item>
66   - </el-form>
67   - </el-tab-pane>
68   - <el-tab-pane label="历史跟踪">
69   - <el-steps :active="stepActive" simple finish-status="success">
70   - <el-step :title="stepTitle(item)" icon="el-icon-edit" v-for="(item) in handleTask.historyTask" ></el-step>
71   - </el-steps>
72   - <br/>
73   - <el-steps direction="vertical" :active="stepActive" space="65px">
74   - <el-step :title="stepTitle(item)" :description="stepDes(item)" v-for="(item) in handleTask.historyTask" ></el-step>
75   - </el-steps>
76   - </el-tab-pane>
77   - <el-tab-pane label="流程图">流程图-TODO</el-tab-pane>
78   - </el-tabs>
79   -
80   - </div>
81   -</template>
82   -
83   -<script>
84   -import { getLeave,updateLeave } from "@/api/oa/leave"
85   -import { taskSteps } from "@/api/oa/todo"
86   -import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
87   -export default {
88   - name: "HrApproveLeave",
89   - components: {
90   - },
91   - data() {
92   - return {
93   - // 表单参数
94   - form: {},
95   - // 表单校验
96   - rules: {
97   - },
98   - handleTask: {
99   - historyTask:[]
100   - },
101   - modifyShow: true,
102   - reApplySelect: 1,
103   - reApplyData: [
104   - {
105   - value: 0,
106   - label: '取消申请'
107   - },
108   - {
109   - value: 1,
110   - label: '继续申请'
111   - }
112   - ],
113   - statusFormat(row, column) {
114   - return getDictDataLabel(DICT_TYPE.OA_LEAVE_STATUS, row.status)
115   - },
116   - leaveTypeDictData: getDictDatas(DICT_TYPE.OA_LEAVE_TYPE),
117   - leaveStatusData: getDictDatas(DICT_TYPE.OA_LEAVE_STATUS)
118   - };
119   - },
120   - mounted() {
121   - const businessKey = this.$route.query.businessKey;
122   - const taskId = this.$route.query.taskId;
123   -
124   - this.getForm(businessKey,taskId);
125   - },
126   - computed:{
127   - stepActive: function () {
128   - let idx = 0;
129   - for(let i=0; i<this.handleTask.historyTask.length; i++){
130   - if(this.handleTask.historyTask[i].status === 1){
131   - idx= idx+1;
132   - }else{
133   - break;
134   - }
135   - }
136   - return idx;
137   - },
138   - stepTitle() {
139   - return function (item) {
140   - let name = item.stepName;
141   - if (item.status === 1) {
142   - name += '(已完成)'
143   - }
144   - if (item.status === 0) {
145   - name += '(进行中)'
146   - }
147   - return name;
148   - }
149   - },
150   - stepDes(){
151   - return function (item) {
152   - let desc = "";
153   - if (item.status === 1) {
154   - desc+="审批人:["+ item.assignee +"] 审批意见: [" + item.comment + "] 审批时间: " + this.parseTime(item.endTime);
155   - }
156   - return desc;
157   - }
158   - }
159   - },
160   - methods: {
161   - /** 提交按钮 */
162   - submitForm() {
163   - this.$refs["form"].validate(valid => {
164   - if (!valid) {
165   - return;
166   - }
167   - if (this.reApplySelect === 1) {
168   - this.form.variables["reApply"] = true;
169   - this.form.comment = '调整请假申请';
170   - }
171   - if (this.reApplySelect === 0) {
172   - this.form.variables["reApply"] = false;
173   - this.form.comment = '取消请假申请';
174   - }
175   - updateLeave(this.form).then(response => {
176   - this.msgSuccess("修改成功");
177   - this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => {
178   - //if (this.isActive(this.$route)) {
179   - this.$router.push({path: '/oa/todo'})
180   - //}
181   - })
182   - });
183   - });
184   - },
185   - getForm(id, taskId){
186   - getLeave(id).then(response => {
187   - this.form = response.data;
188   - this.form.taskId = taskId;
189   - this.form.variables = {};
190   - });
191   - const data = {
192   - taskId : taskId,
193   - businessKey: id,
194   - }
195   - taskSteps(data).then(response => {
196   - this.handleTask = response.data;
197   -
198   - });
199   - },
200   - reApplyChange(){
201   - if (this.reApplySelect === 1) {
202   - this.modifyShow = true;
203   - }
204   - if (this.reApplySelect === 0) {
205   - this.modifyShow = false;
206   - }
207   - }
208   -
209   - }
210   -};
211   -</script>