Commit f46090243faba1814dbf492af9e0365f19b6e211
1 parent
842cb6bd
BPM 模型重构 7:任务分配规则的前端,增加指定用户、自定义脚本等
Showing
23 changed files
with
391 additions
and
12 deletions
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmUserGroupController.java
| ... | ... | @@ -7,6 +7,10 @@ import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.group.B |
| 7 | 7 | import cn.iocoder.yudao.adminserver.modules.bpm.convert.definition.BpmUserGroupConvert; |
| 8 | 8 | import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmUserGroupDO; |
| 9 | 9 | import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmUserGroupService; |
| 10 | +import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.SysUserSimpleRespVO; | |
| 11 | +import cn.iocoder.yudao.adminserver.modules.system.convert.user.SysUserConvert; | |
| 12 | +import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; | |
| 13 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 10 | 14 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 11 | 15 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 12 | 16 | import io.swagger.annotations.Api; |
| ... | ... | @@ -19,6 +23,8 @@ import org.springframework.web.bind.annotation.*; |
| 19 | 23 | import javax.annotation.Resource; |
| 20 | 24 | import javax.validation.Valid; |
| 21 | 25 | |
| 26 | +import java.util.List; | |
| 27 | + | |
| 22 | 28 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 23 | 29 | |
| 24 | 30 | @Api(tags = "用户组") |
| ... | ... | @@ -71,4 +77,13 @@ public class BpmUserGroupController { |
| 71 | 77 | return success(BpmUserGroupConvert.INSTANCE.convertPage(pageResult)); |
| 72 | 78 | } |
| 73 | 79 | |
| 80 | + @GetMapping("/list-all-simple") | |
| 81 | + @ApiOperation(value = "获取用户组精简信息列表", notes = "只包含被开启的用户组,主要用于前端的下拉选项") | |
| 82 | + public CommonResult<List<BpmUserGroupRespVO>> getSimpleUserGroups() { | |
| 83 | + // 获用户门列表,只要开启状态的 | |
| 84 | + List<BpmUserGroupDO> list = userGroupService.getUserGroupListByStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 85 | + // 排序后,返回给前端 | |
| 86 | + return success(BpmUserGroupConvert.INSTANCE.convertList2(list)); | |
| 87 | + } | |
| 88 | + | |
| 74 | 89 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/vo/rule/BpmUserGroupSimpleRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.rule; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.AllArgsConstructor; | |
| 6 | +import lombok.Data; | |
| 7 | +import lombok.NoArgsConstructor; | |
| 8 | + | |
| 9 | +@ApiModel("用户组精简信息 Response VO") | |
| 10 | +@Data | |
| 11 | +@NoArgsConstructor | |
| 12 | +@AllArgsConstructor | |
| 13 | +public class BpmUserGroupSimpleRespVO { | |
| 14 | + | |
| 15 | + @ApiModelProperty(value = "用户组编号", required = true, example = "1024") | |
| 16 | + private Long id; | |
| 17 | + | |
| 18 | + @ApiModelProperty(value = "用户组名字", required = true, example = "芋道") | |
| 19 | + private String name; | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmUserGroupConvert.java
| ... | ... | @@ -9,6 +9,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmUse |
| 9 | 9 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 10 | 10 | |
| 11 | 11 | import org.mapstruct.Mapper; |
| 12 | +import org.mapstruct.Named; | |
| 12 | 13 | import org.mapstruct.factory.Mappers; |
| 13 | 14 | |
| 14 | 15 | /** |
| ... | ... | @@ -31,4 +32,6 @@ public interface BpmUserGroupConvert { |
| 31 | 32 | |
| 32 | 33 | PageResult<BpmUserGroupRespVO> convertPage(PageResult<BpmUserGroupDO> page); |
| 33 | 34 | |
| 35 | + @Named("convertList2") | |
| 36 | + List<BpmUserGroupRespVO> convertList2(List<BpmUserGroupDO> list); | |
| 34 | 37 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/definition/BpmUserGroupMapper.java
| ... | ... | @@ -7,6 +7,8 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 7 | 7 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 10 | 12 | /** |
| 11 | 13 | * 用户组 Mapper |
| 12 | 14 | * |
| ... | ... | @@ -23,4 +25,8 @@ public interface BpmUserGroupMapper extends BaseMapperX<BpmUserGroupDO> { |
| 23 | 25 | .orderByDesc("id")); |
| 24 | 26 | } |
| 25 | 27 | |
| 28 | + default List<BpmUserGroupDO> selectListByStatus(Integer status) { | |
| 29 | + return selectList("status", status); | |
| 30 | + } | |
| 31 | + | |
| 26 | 32 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java
| ... | ... | @@ -54,4 +54,6 @@ public interface BpmErrorCodeConstants { |
| 54 | 54 | |
| 55 | 55 | // ========== 用户组模块 1-009-011-000 ========== |
| 56 | 56 | ErrorCode USER_GROUP_NOT_EXISTS = new ErrorCode(1009011000, "用户组不存在"); |
| 57 | + ErrorCode USER_GROUP_IS_DISABLE = new ErrorCode(1009011001, "名字为【{}】的用户组已被禁用"); | |
| 58 | + | |
| 57 | 59 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/package-info.java
0 → 100644
| 1 | +/** | |
| 2 | + * 拓展 {@link org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior} 实现,基于 {@link cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmTaskAssignRuleDO} 实现自定义的任务分配规则。 | |
| 3 | + * 原因:BPMN 默认的 assign、candidateUsers、candidateGroups 拓展起来有一定的难度,所以选择放弃它们,使用自己定义的规则。 | |
| 4 | + * | |
| 5 | + * @author 芋道源码 | |
| 6 | + */ | |
| 7 | +package cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavior; | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/script/BpmTaskAssignScript.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavior.script; | |
| 2 | + | |
| 3 | +import org.activiti.engine.impl.persistence.entity.TaskEntity; | |
| 4 | + | |
| 5 | +import java.util.List; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Bpm 任务分配的自定义 Script 脚本 | |
| 9 | + * 使用场景: | |
| 10 | + * 1. 设置审批人为发起人 | |
| 11 | + * 2. 设置审批人为发起人的 Leader | |
| 12 | + * 3. 甚至审批人为发起人的 Leader 的 Leader | |
| 13 | + * | |
| 14 | + * @author 芋道源码 | |
| 15 | + */ | |
| 16 | +public interface BpmTaskAssignScript { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 基于流程任务,获得任务的候选用户们 | |
| 20 | + * | |
| 21 | + * @param task 任务 | |
| 22 | + * @return 候选人用户的编号数组 | |
| 23 | + */ | |
| 24 | + List<Long> calculateTaskCandidateUsers(TaskEntity task); | |
| 25 | + | |
| 26 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/listener/package-info.java
0 → 100644
| 1 | +/** | |
| 2 | + * 自定义各种 Activiti 的监听器,实现流程示例、流程任务的拓展表信息的同步 | |
| 3 | + * 例如说,{@link org.activiti.api.task.model.Task} 新建时,我们也要新建对应的 {@link cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.task.BpmTaskExtDO} 记录 | |
| 4 | + * | |
| 5 | + * @author 芋道源码 | |
| 6 | + */ | |
| 7 | +package cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.listener; | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmUserGroupService.java
| ... | ... | @@ -55,6 +55,14 @@ public interface BpmUserGroupService { |
| 55 | 55 | List<BpmUserGroupDO> getUserGroupList(Collection<Long> ids); |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | + * 获得指定状态的用户组列表 | |
| 59 | + * | |
| 60 | + * @param status 状态 | |
| 61 | + * @return 用户组列表 | |
| 62 | + */ | |
| 63 | + List<BpmUserGroupDO> getUserGroupListByStatus(Integer status); | |
| 64 | + | |
| 65 | + /** | |
| 58 | 66 | * 获得用户组分页 |
| 59 | 67 | * |
| 60 | 68 | * @param pageReqVO 分页查询 |
| ... | ... | @@ -62,4 +70,13 @@ public interface BpmUserGroupService { |
| 62 | 70 | */ |
| 63 | 71 | PageResult<BpmUserGroupDO> getUserGroupPage(BpmUserGroupPageReqVO pageReqVO); |
| 64 | 72 | |
| 73 | + /** | |
| 74 | + * 校验用户组们是否有效。如下情况,视为无效: | |
| 75 | + * 1. 用户组编号不存在 | |
| 76 | + * 2. 用户组被禁用 | |
| 77 | + * | |
| 78 | + * @param ids 用户组编号数组 | |
| 79 | + */ | |
| 80 | + void validUserGroups(Set<Long> ids); | |
| 81 | + | |
| 65 | 82 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmTaskAssignRuleServiceImpl.java
| ... | ... | @@ -12,9 +12,15 @@ import cn.iocoder.yudao.adminserver.modules.bpm.enums.definition.BpmTaskAssignRu |
| 12 | 12 | import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmModelService; |
| 13 | 13 | import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmProcessDefinitionService; |
| 14 | 14 | import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService; |
| 15 | +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmUserGroupService; | |
| 16 | +import cn.iocoder.yudao.adminserver.modules.system.enums.SysDictTypeConstants; | |
| 15 | 17 | import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService; |
| 18 | +import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysPostService; | |
| 19 | +import cn.iocoder.yudao.adminserver.modules.system.service.dict.SysDictDataService; | |
| 16 | 20 | import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysRoleService; |
| 21 | +import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService; | |
| 17 | 22 | import cn.iocoder.yudao.framework.activiti.core.util.ActivitiUtils; |
| 23 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 18 | 24 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 19 | 25 | import lombok.extern.slf4j.Slf4j; |
| 20 | 26 | import org.activiti.bpmn.model.BpmnModel; |
| ... | ... | @@ -30,6 +36,7 @@ import java.util.Objects; |
| 30 | 36 | import java.util.Set; |
| 31 | 37 | |
| 32 | 38 | import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.*; |
| 39 | +import static cn.iocoder.yudao.adminserver.modules.system.enums.SysDictTypeConstants.BPM_TASK_ASSIGN_RULE_TYPE; | |
| 33 | 40 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 34 | 41 | |
| 35 | 42 | /** |
| ... | ... | @@ -53,6 +60,14 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService { |
| 53 | 60 | private SysRoleService roleService; |
| 54 | 61 | @Resource |
| 55 | 62 | private SysDeptService deptService; |
| 63 | + @Resource | |
| 64 | + private SysPostService postService; | |
| 65 | + @Resource | |
| 66 | + private SysUserService userService; | |
| 67 | + @Resource | |
| 68 | + private BpmUserGroupService userGroupService; | |
| 69 | + @Resource | |
| 70 | + private SysDictDataService dictDataService; | |
| 56 | 71 | |
| 57 | 72 | @Override |
| 58 | 73 | public List<BpmTaskAssignRuleDO> getTaskAssignRuleListByProcessDefinitionId(String processDefinitionId, |
| ... | ... | @@ -146,8 +161,18 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService { |
| 146 | 161 | } else if (ObjectUtils.equalsAny(BpmTaskAssignRuleTypeEnum.DEPT_MEMBER.getType(), |
| 147 | 162 | BpmTaskAssignRuleTypeEnum.DEPT_LEADER.getType())) { |
| 148 | 163 | deptService.validDepts(options); |
| 164 | + } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.POST.getType())) { | |
| 165 | + postService.validPosts(options); | |
| 166 | + } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER.getType())) { | |
| 167 | + userService.validUsers(options); | |
| 168 | + } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER_GROUP.getType())) { | |
| 169 | + userGroupService.validUserGroups(options); | |
| 170 | + } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.SCRIPT.getType())) { | |
| 171 | + dictDataService.validDictDatas(SysDictTypeConstants.BPM_TASK_ASSIGN_SCRIPT, | |
| 172 | + CollectionUtils.convertSet(options, String::valueOf)); | |
| 173 | + } else { | |
| 174 | + throw new IllegalArgumentException(StrUtil.format("未知的规则类型({})", type)); | |
| 149 | 175 | } |
| 150 | - // TODO 其它的 | |
| 151 | 176 | } |
| 152 | 177 | |
| 153 | 178 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmUserGroupServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.adminserver.modules.bpm.service.definition.impl; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.group.BpmUserGroupCreateReqVO; |
| 4 | 5 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.group.BpmUserGroupPageReqVO; |
| 5 | 6 | import cn.iocoder.yudao.adminserver.modules.bpm.controller.definition.vo.group.BpmUserGroupUpdateReqVO; |
| ... | ... | @@ -7,15 +8,23 @@ import cn.iocoder.yudao.adminserver.modules.bpm.convert.definition.BpmUserGroupC |
| 7 | 8 | import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmUserGroupDO; |
| 8 | 9 | import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.definition.BpmUserGroupMapper; |
| 9 | 10 | import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmUserGroupService; |
| 11 | +import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; | |
| 12 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 10 | 13 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 14 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 11 | 15 | import org.springframework.stereotype.Service; |
| 12 | 16 | import org.springframework.validation.annotation.Validated; |
| 13 | 17 | |
| 14 | 18 | import javax.annotation.Resource; |
| 15 | 19 | import java.util.Collection; |
| 16 | 20 | import java.util.List; |
| 21 | +import java.util.Map; | |
| 22 | +import java.util.Set; | |
| 17 | 23 | |
| 24 | +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.USER_GROUP_IS_DISABLE; | |
| 18 | 25 | import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.USER_GROUP_NOT_EXISTS; |
| 26 | +import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.USER_IS_DISABLE; | |
| 27 | +import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.USER_NOT_EXISTS; | |
| 19 | 28 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 20 | 29 | |
| 21 | 30 | /** |
| ... | ... | @@ -73,8 +82,33 @@ public class BpmUserGroupServiceImpl implements BpmUserGroupService { |
| 73 | 82 | } |
| 74 | 83 | |
| 75 | 84 | @Override |
| 85 | + public List<BpmUserGroupDO> getUserGroupListByStatus(Integer status) { | |
| 86 | + return userGroupMapper.selectListByStatus(status); | |
| 87 | + } | |
| 88 | + | |
| 89 | + @Override | |
| 76 | 90 | public PageResult<BpmUserGroupDO> getUserGroupPage(BpmUserGroupPageReqVO pageReqVO) { |
| 77 | 91 | return userGroupMapper.selectPage(pageReqVO); |
| 78 | 92 | } |
| 79 | 93 | |
| 94 | + @Override | |
| 95 | + public void validUserGroups(Set<Long> ids) { | |
| 96 | + if (CollUtil.isEmpty(ids)) { | |
| 97 | + return; | |
| 98 | + } | |
| 99 | + // 获得用户组信息 | |
| 100 | + List<BpmUserGroupDO> userGroups = userGroupMapper.selectBatchIds(ids); | |
| 101 | + Map<Long, BpmUserGroupDO> userGroupMap = CollectionUtils.convertMap(userGroups, BpmUserGroupDO::getId); | |
| 102 | + // 校验 | |
| 103 | + ids.forEach(id -> { | |
| 104 | + BpmUserGroupDO userGroup = userGroupMap.get(id); | |
| 105 | + if (userGroup == null) { | |
| 106 | + throw exception(USER_GROUP_NOT_EXISTS); | |
| 107 | + } | |
| 108 | + if (!CommonStatusEnum.ENABLE.getStatus().equals(userGroup.getStatus())) { | |
| 109 | + throw exception(USER_GROUP_IS_DISABLE, userGroup.getName()); | |
| 110 | + } | |
| 111 | + }); | |
| 112 | + } | |
| 113 | + | |
| 80 | 114 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/dal/mysql/dict/SysDictDataMapper.java
| ... | ... | @@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 9 | 9 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 10 | 10 | import org.apache.ibatis.annotations.Mapper; |
| 11 | 11 | |
| 12 | +import java.util.Collection; | |
| 12 | 13 | import java.util.Date; |
| 13 | 14 | import java.util.List; |
| 14 | 15 | |
| ... | ... | @@ -20,6 +21,11 @@ public interface SysDictDataMapper extends BaseMapperX<SysDictDataDO> { |
| 20 | 21 | .eq("value", value)); |
| 21 | 22 | } |
| 22 | 23 | |
| 24 | + default List<SysDictDataDO> selectByDictTypeAndValues(String dictType, Collection<String> values) { | |
| 25 | + return selectList(new QueryWrapper<SysDictDataDO>().eq("dict_type", dictType) | |
| 26 | + .in("value", values)); | |
| 27 | + } | |
| 28 | + | |
| 23 | 29 | default int selectCountByDictType(String dictType) { |
| 24 | 30 | return selectCount("dict_type", dictType); |
| 25 | 31 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/enums/SysDictTypeConstants.java
| ... | ... | @@ -22,4 +22,7 @@ public interface SysDictTypeConstants { |
| 22 | 22 | String SMS_SEND_STATUS = "sys_sms_send_status"; // 短信发送状态 |
| 23 | 23 | String SMS_RECEIVE_STATUS = "sys_sms_receive_status"; // 短信接收状态 |
| 24 | 24 | |
| 25 | + String BPM_TASK_ASSIGN_RULE_TYPE = "bpm_task_assign_rule_type"; // 任务分配规则类型 | |
| 26 | + String BPM_TASK_ASSIGN_SCRIPT = "bpm_task_assign_script"; // 任务分配自定义脚本 | |
| 27 | + | |
| 25 | 28 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/enums/SysErrorCodeConstants.java
| ... | ... | @@ -40,6 +40,7 @@ public interface SysErrorCodeConstants { |
| 40 | 40 | ErrorCode USER_NOT_EXISTS = new ErrorCode(1002004003, "用户不存在"); |
| 41 | 41 | ErrorCode USER_IMPORT_LIST_IS_EMPTY = new ErrorCode(1002004004, "导入用户数据不能为空!"); |
| 42 | 42 | ErrorCode USER_PASSWORD_FAILED = new ErrorCode(1002004005, "用户密码校验失败"); |
| 43 | + ErrorCode USER_IS_DISABLE = new ErrorCode(1002003004, "名字为【{}】的用户已被禁用"); | |
| 43 | 44 | |
| 44 | 45 | // ========== 部门模块 1002005000 ========== |
| 45 | 46 | ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1002004001, "已经存在该名字的部门"); |
| ... | ... | @@ -66,7 +67,7 @@ public interface SysErrorCodeConstants { |
| 66 | 67 | |
| 67 | 68 | // ========== 字典数据 1002007000 ========== |
| 68 | 69 | ErrorCode DICT_DATA_NOT_EXISTS = new ErrorCode(1002007001, "当前字典数据不存在"); |
| 69 | - ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1002007002, "字典数据不处于开启状态,不允许选择"); | |
| 70 | + ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1002007002, "字典数据({})不处于开启状态,不允许选择"); | |
| 70 | 71 | ErrorCode DICT_DATA_VALUE_DUPLICATE = new ErrorCode(1002007003, "已经存在该值的字典数据"); |
| 71 | 72 | |
| 72 | 73 | // ========== 通知公告 1002008000 ========== | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dept/SysPostService.java
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dept/impl/SysPostServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.adminserver.modules.system.service.dept.impl; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysDeptDO; | |
| 5 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 3 | 6 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 4 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 8 | import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostCreateReqVO; |
| ... | ... | @@ -10,14 +13,17 @@ import cn.iocoder.yudao.adminserver.modules.system.convert.dept.SysPostConvert; |
| 10 | 13 | import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.dept.SysPostMapper; |
| 11 | 14 | import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysPostDO; |
| 12 | 15 | import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysPostService; |
| 16 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 13 | 17 | import org.springframework.stereotype.Service; |
| 14 | 18 | import org.springframework.validation.annotation.Validated; |
| 15 | 19 | |
| 16 | 20 | import javax.annotation.Resource; |
| 17 | 21 | import java.util.Collection; |
| 18 | 22 | import java.util.List; |
| 23 | +import java.util.Map; | |
| 19 | 24 | |
| 20 | 25 | import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.*; |
| 26 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 21 | 27 | |
| 22 | 28 | /** |
| 23 | 29 | * 岗位 Service 实现类 |
| ... | ... | @@ -78,6 +84,26 @@ public class SysPostServiceImpl implements SysPostService { |
| 78 | 84 | return postMapper.selectById(id); |
| 79 | 85 | } |
| 80 | 86 | |
| 87 | + @Override | |
| 88 | + public void validPosts(Collection<Long> ids) { | |
| 89 | + if (CollUtil.isEmpty(ids)) { | |
| 90 | + return; | |
| 91 | + } | |
| 92 | + // 获得岗位信息 | |
| 93 | + List<SysPostDO> posts = postMapper.selectBatchIds(ids); | |
| 94 | + Map<Long, SysPostDO> postMap = CollectionUtils.convertMap(posts, SysPostDO::getId); | |
| 95 | + // 校验 | |
| 96 | + ids.forEach(id -> { | |
| 97 | + SysPostDO post = postMap.get(id); | |
| 98 | + if (post == null) { | |
| 99 | + throw exception(POST_NOT_FOUND); | |
| 100 | + } | |
| 101 | + if (!CommonStatusEnum.ENABLE.getStatus().equals(post.getStatus())) { | |
| 102 | + throw exception(POST_NOT_ENABLE, post.getName()); | |
| 103 | + } | |
| 104 | + }); | |
| 105 | + } | |
| 106 | + | |
| 81 | 107 | private void checkCreateOrUpdate(Long id, String name, String code) { |
| 82 | 108 | // 校验自己存在 |
| 83 | 109 | checkPostExists(id); | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dict/SysDictDataService.java
| ... | ... | @@ -8,6 +8,7 @@ import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDi |
| 8 | 8 | import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataPageReqVO; |
| 9 | 9 | import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataUpdateReqVO; |
| 10 | 10 | |
| 11 | +import java.util.Collection; | |
| 11 | 12 | import java.util.List; |
| 12 | 13 | |
| 13 | 14 | /** |
| ... | ... | @@ -78,4 +79,14 @@ public interface SysDictDataService { |
| 78 | 79 | */ |
| 79 | 80 | int countByDictType(String dictType); |
| 80 | 81 | |
| 82 | + /** | |
| 83 | + * 校验字典数据们是否有效。如下情况,视为无效: | |
| 84 | + * 1. 字典数据不存在 | |
| 85 | + * 2. 字典数据被禁用 | |
| 86 | + * | |
| 87 | + * @param dictType 字典类型 | |
| 88 | + * @param values 字典数据值的数组 | |
| 89 | + */ | |
| 90 | + void validDictDatas(String dictType, Collection<String> values); | |
| 91 | + | |
| 81 | 92 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dict/impl/SysDictDataServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.adminserver.modules.system.service.dict.impl; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataCreateReqVO; |
| 4 | 5 | import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataExportReqVO; |
| 5 | 6 | import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataPageReqVO; |
| ... | ... | @@ -11,16 +12,16 @@ import cn.iocoder.yudao.adminserver.modules.system.mq.producer.dict.SysDictDataP |
| 11 | 12 | import cn.iocoder.yudao.adminserver.modules.system.service.dict.SysDictDataService; |
| 12 | 13 | import cn.iocoder.yudao.adminserver.modules.system.service.dict.SysDictTypeService; |
| 13 | 14 | import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; |
| 15 | +import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; | |
| 14 | 16 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 15 | 17 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 18 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 16 | 19 | import com.google.common.annotations.VisibleForTesting; |
| 17 | 20 | import lombok.extern.slf4j.Slf4j; |
| 18 | 21 | import org.springframework.stereotype.Service; |
| 19 | 22 | |
| 20 | 23 | import javax.annotation.Resource; |
| 21 | -import java.util.Comparator; | |
| 22 | -import java.util.Date; | |
| 23 | -import java.util.List; | |
| 24 | +import java.util.*; | |
| 24 | 25 | |
| 25 | 26 | import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.*; |
| 26 | 27 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| ... | ... | @@ -133,6 +134,26 @@ public class SysDictDataServiceImpl implements SysDictDataService { |
| 133 | 134 | return dictDataMapper.selectCountByDictType(dictType); |
| 134 | 135 | } |
| 135 | 136 | |
| 137 | + @Override | |
| 138 | + public void validDictDatas(String dictType, Collection<String> values) { | |
| 139 | + if (CollUtil.isEmpty(values)) { | |
| 140 | + return; | |
| 141 | + } | |
| 142 | + // 获得字典数据信息 | |
| 143 | + List<SysDictDataDO> dictDatas = dictDataMapper.selectByDictTypeAndValues(dictType, values); | |
| 144 | + Map<String, SysDictDataDO> dictDataMap = CollectionUtils.convertMap(dictDatas, SysDictDataDO::getValue); | |
| 145 | + // 校验 | |
| 146 | + values.forEach(value -> { | |
| 147 | + SysDictDataDO dictData = dictDataMap.get(value); | |
| 148 | + if (dictData == null) { | |
| 149 | + throw exception(DICT_DATA_NOT_EXISTS); | |
| 150 | + } | |
| 151 | + if (!CommonStatusEnum.ENABLE.getStatus().equals(dictData.getStatus())) { | |
| 152 | + throw exception(DICT_DATA_NOT_ENABLE, dictData.getLabel()); | |
| 153 | + } | |
| 154 | + }); | |
| 155 | + } | |
| 156 | + | |
| 136 | 157 | private void checkCreateOrUpdate(Long id, String value, String dictType) { |
| 137 | 158 | // 校验自己存在 |
| 138 | 159 | checkDictDataExists(id); | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/user/SysUserService.java
| ... | ... | @@ -9,10 +9,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 10 | 10 | |
| 11 | 11 | import java.io.InputStream; |
| 12 | -import java.util.Collection; | |
| 13 | -import java.util.HashMap; | |
| 14 | -import java.util.List; | |
| 15 | -import java.util.Map; | |
| 12 | +import java.util.*; | |
| 16 | 13 | |
| 17 | 14 | /** |
| 18 | 15 | * 后台用户 Service 接口 |
| ... | ... | @@ -177,4 +174,13 @@ public interface SysUserService { |
| 177 | 174 | */ |
| 178 | 175 | List<SysUserDO> getUsersByStatus(Integer status); |
| 179 | 176 | |
| 177 | + /** | |
| 178 | + * 校验用户们是否有效。如下情况,视为无效: | |
| 179 | + * 1. 用户编号不存在 | |
| 180 | + * 2. 用户被禁用 | |
| 181 | + * | |
| 182 | + * @param ids 用户编号数组 | |
| 183 | + */ | |
| 184 | + void validUsers(Set<Long> ids); | |
| 185 | + | |
| 180 | 186 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/user/impl/SysUserServiceImpl.java
| ... | ... | @@ -183,6 +183,11 @@ public class SysUserServiceImpl implements SysUserService { |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | @Override |
| 186 | + public Map<Long, SysUserDO> getUserMap(Collection<Long> ids) { | |
| 187 | + return SysUserService.super.getUserMap(ids); | |
| 188 | + } | |
| 189 | + | |
| 190 | + @Override | |
| 186 | 191 | public List<SysUserDO> getUsersByNickname(String nickname) { |
| 187 | 192 | return userMapper.selectListByNickname(nickname); |
| 188 | 193 | } |
| ... | ... | @@ -384,4 +389,24 @@ public class SysUserServiceImpl implements SysUserService { |
| 384 | 389 | return userMapper.selectListByStatus(status); |
| 385 | 390 | } |
| 386 | 391 | |
| 392 | + @Override | |
| 393 | + public void validUsers(Set<Long> ids) { | |
| 394 | + if (CollUtil.isEmpty(ids)) { | |
| 395 | + return; | |
| 396 | + } | |
| 397 | + // 获得岗位信息 | |
| 398 | + List<SysUserDO> users = userMapper.selectBatchIds(ids); | |
| 399 | + Map<Long, SysUserDO> userMap = CollectionUtils.convertMap(users, SysUserDO::getId); | |
| 400 | + // 校验 | |
| 401 | + ids.forEach(id -> { | |
| 402 | + SysUserDO user = userMap.get(id); | |
| 403 | + if (user == null) { | |
| 404 | + throw exception(USER_NOT_EXISTS); | |
| 405 | + } | |
| 406 | + if (!CommonStatusEnum.ENABLE.getStatus().equals(user.getStatus())) { | |
| 407 | + throw exception(USER_IS_DISABLE, user.getNickname()); | |
| 408 | + } | |
| 409 | + }); | |
| 410 | + } | |
| 411 | + | |
| 387 | 412 | } | ... | ... |
yudao-admin-ui/src/api/bpm/userGroup.js
yudao-admin-ui/src/utils/dict.js
| ... | ... | @@ -40,6 +40,7 @@ export const DICT_TYPE = { |
| 40 | 40 | BPM_TASK_ASSIGN_RULE_TYPE: 'bpm_task_assign_rule_type', |
| 41 | 41 | BPM_PROCESS_INSTANCE_STATUS: 'bpm_process_instance_status', |
| 42 | 42 | BPM_PROCESS_INSTANCE_RESULT: 'bpm_process_instance_result', |
| 43 | + BPM_TASK_ASSIGN_SCRIPT: 'bpm_task_assign_script', | |
| 43 | 44 | OA_LEAVE_STATUS: 'flow_status', // todo 芋艿:可以删除 |
| 44 | 45 | OA_LEAVE_TYPE: 'oa_leave_type' |
| 45 | 46 | } |
| ... | ... | @@ -51,6 +52,10 @@ export const DICT_TYPE = { |
| 51 | 52 | * @returns {*|Array} 数据字典数组 |
| 52 | 53 | */ |
| 53 | 54 | export function getDictDatas(dictType) { |
| 55 | + // if (dictType === 'bpm_task_assign_script') { | |
| 56 | + // console.log(store.getters.dict_datas[dictType]); | |
| 57 | + // debugger | |
| 58 | + // } | |
| 54 | 59 | return store.getters.dict_datas[dictType] || [] |
| 55 | 60 | } |
| 56 | 61 | ... | ... |
yudao-admin-ui/src/views/bpm/taskAssignRule/taskAssignRuleDialog.vue
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | </el-form-item> |
| 38 | 38 | <el-form-item label="规则类型" prop="type"> |
| 39 | 39 | <el-select v-model="form.type" clearable style="width: 100%"> |
| 40 | - <el-option v-for="dict in taskAssignRuleDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/> | |
| 40 | + <el-option v-for="dict in taskAssignRuleTypeDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/> | |
| 41 | 41 | </el-select> |
| 42 | 42 | </el-form-item> |
| 43 | 43 | <el-form-item v-if="form.type === 10" label="指定角色" prop="roleIds"> |
| ... | ... | @@ -49,6 +49,27 @@ |
| 49 | 49 | <treeselect v-model="form.deptIds" :options="deptTreeOptions" multiple flat :defaultExpandLevel="3" |
| 50 | 50 | placeholder="请选择指定部门" :normalizer="normalizer"/> |
| 51 | 51 | </el-form-item> |
| 52 | + <el-form-item v-if="form.type === 22" label="指定岗位" prop="postIds"> | |
| 53 | + <el-select v-model="form.postIds" multiple clearable style="width: 100%"> | |
| 54 | + <el-option v-for="item in postOptions" :key="parseInt(item.id)" :label="item.name" :value="parseInt(item.id)" /> | |
| 55 | + </el-select> | |
| 56 | + </el-form-item> | |
| 57 | + <el-form-item v-if="form.type === 30" label="指定用户" prop="userIds"> | |
| 58 | + <el-select v-model="form.userIds" multiple clearable style="width: 100%"> | |
| 59 | + <el-option v-for="item in userOptions" :key="parseInt(item.id)" :label="item.nickname" :value="parseInt(item.id)" /> | |
| 60 | + </el-select> | |
| 61 | + </el-form-item> | |
| 62 | + <el-form-item v-if="form.type === 40" label="指定用户组" prop="userGroupIds"> | |
| 63 | + <el-select v-model="form.userGroupIds" multiple clearable style="width: 100%"> | |
| 64 | + <el-option v-for="item in userGroupOptions" :key="parseInt(item.id)" :label="item.name" :value="parseInt(item.id)" /> | |
| 65 | + </el-select> | |
| 66 | + </el-form-item> | |
| 67 | + <el-form-item v-if="form.type === 50" label="指定脚本" prop="scripts"> | |
| 68 | + <el-select v-model="form.scripts" multiple clearable style="width: 100%"> | |
| 69 | + <el-option v-for="dict in taskAssignScriptDictDatas" :key="parseInt(dict.value)" | |
| 70 | + :label="dict.label" :value="parseInt(dict.value)"/> | |
| 71 | + </el-select> | |
| 72 | + </el-form-item> | |
| 52 | 73 | </el-form> |
| 53 | 74 | <div slot="footer" class="dialog-footer"> |
| 54 | 75 | <el-button type="primary" @click="submitAssignRuleForm">确 定</el-button> |
| ... | ... | @@ -66,6 +87,9 @@ import {listSimpleDepts} from "@/api/system/dept"; |
| 66 | 87 | |
| 67 | 88 | import Treeselect from "@riophae/vue-treeselect"; |
| 68 | 89 | import "@riophae/vue-treeselect/dist/vue-treeselect.css"; |
| 90 | +import {listSimplePosts} from "@/api/system/post"; | |
| 91 | +import {listSimpleUsers} from "@/api/system/user"; | |
| 92 | +import {listSimpleUserGroups} from "@/api/bpm/userGroup"; | |
| 69 | 93 | |
| 70 | 94 | export default { |
| 71 | 95 | name: "taskAssignRuleDialog", |
| ... | ... | @@ -89,16 +113,24 @@ export default { |
| 89 | 113 | type: [{ required: true, message: "规则类型不能为空", trigger: "change" }], |
| 90 | 114 | roleIds: [{required: true, message: "指定角色不能为空", trigger: "change" }], |
| 91 | 115 | deptIds: [{required: true, message: "指定部门不能为空", trigger: "change" }], |
| 116 | + postIds: [{required: true, message: "指定岗位不能为空", trigger: "change"}], | |
| 117 | + userIds: [{required: true, message: "指定用户不能为空", trigger: "change"}], | |
| 118 | + userGroupIds: [{required: true, message: "指定用户组不能为空", trigger: "change"}], | |
| 119 | + scripts: [{required: true, message: "指定脚本不能为空", trigger: "change"}], | |
| 92 | 120 | }, |
| 93 | 121 | |
| 94 | 122 | // 各种下拉框 |
| 95 | 123 | roleOptions: [], |
| 96 | 124 | deptOptions: [], |
| 97 | 125 | deptTreeOptions: [], |
| 126 | + postOptions: [], | |
| 127 | + userOptions: [], | |
| 128 | + userGroupOptions: [], | |
| 98 | 129 | |
| 99 | 130 | // 数据字典 |
| 100 | 131 | modelFormTypeDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_FORM_TYPE), |
| 101 | - taskAssignRuleDictDatas: getDictDatas(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE), | |
| 132 | + taskAssignRuleTypeDictDatas: getDictDatas(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE), | |
| 133 | + taskAssignScriptDictDatas: getDictDatas(DICT_TYPE.BPM_TASK_ASSIGN_SCRIPT), | |
| 102 | 134 | }; |
| 103 | 135 | }, |
| 104 | 136 | methods: { |
| ... | ... | @@ -132,10 +164,24 @@ export default { |
| 132 | 164 | this.deptOptions = []; |
| 133 | 165 | this.deptTreeOptions = []; |
| 134 | 166 | listSimpleDepts().then(response => { |
| 135 | - // 处理 roleOptions 参数 | |
| 136 | 167 | this.deptOptions.push(...response.data); |
| 137 | 168 | this.deptTreeOptions.push(...this.handleTree(response.data, "id")); |
| 138 | 169 | }); |
| 170 | + // 获得岗位列表 | |
| 171 | + this.postOptions = []; | |
| 172 | + listSimplePosts().then(response => { | |
| 173 | + this.postOptions.push(...response.data); | |
| 174 | + }); | |
| 175 | + // 获得用户列表 | |
| 176 | + this.userOptions = []; | |
| 177 | + listSimpleUsers().then(response => { | |
| 178 | + this.userOptions.push(...response.data); | |
| 179 | + }); | |
| 180 | + // 获得用户组列表 | |
| 181 | + this.userGroupOptions = []; | |
| 182 | + listSimpleUserGroups().then(response => { | |
| 183 | + this.userGroupOptions.push(...response.data); | |
| 184 | + }); | |
| 139 | 185 | }, |
| 140 | 186 | /** 获得任务分配规则列表 */ |
| 141 | 187 | getList() { |
| ... | ... | @@ -157,12 +203,24 @@ export default { |
| 157 | 203 | options: [], |
| 158 | 204 | roleIds: [], |
| 159 | 205 | deptIds: [], |
| 206 | + postIds: [], | |
| 207 | + userIds: [], | |
| 208 | + userGroupIds: [], | |
| 209 | + scripts: [], | |
| 160 | 210 | }; |
| 161 | 211 | // 将 options 赋值到对应的 roleIds 等选项 |
| 162 | 212 | if (row.type === 10) { |
| 163 | 213 | this.form.roleIds.push(...row.options); |
| 164 | 214 | } else if (row.type === 20 || row.type === 21) { |
| 165 | 215 | this.form.deptIds.push(...row.options); |
| 216 | + } else if (row.type === 22) { | |
| 217 | + this.form.postIds.push(...row.options); | |
| 218 | + } else if (row.type === 30) { | |
| 219 | + this.form.userIds.push(...row.options); | |
| 220 | + } else if (row.type === 40) { | |
| 221 | + this.form.userGroupIds.push(...row.options); | |
| 222 | + } else if (row.type === 50) { | |
| 223 | + this.form.scripts.push(...row.options); | |
| 166 | 224 | } |
| 167 | 225 | this.open = true; |
| 168 | 226 | }, |
| ... | ... | @@ -180,9 +238,21 @@ export default { |
| 180 | 238 | form.options = form.roleIds; |
| 181 | 239 | } else if (form.type === 20 || form.type === 21) { |
| 182 | 240 | form.options = form.deptIds; |
| 241 | + } else if (form.type === 22) { | |
| 242 | + form.options = form.postIds; | |
| 243 | + } else if (form.type === 30) { | |
| 244 | + form.options = form.userIds; | |
| 245 | + } else if (form.type === 40) { | |
| 246 | + form.options = form.userGroupIds; | |
| 247 | + } else if (form.type === 50) { | |
| 248 | + form.options = form.scripts; | |
| 183 | 249 | } |
| 184 | 250 | form.roleIds = undefined; |
| 185 | 251 | form.deptIds = undefined; |
| 252 | + form.postIds = undefined; | |
| 253 | + form.userIds = undefined; | |
| 254 | + form.userGroupIds = undefined; | |
| 255 | + form.scripts = undefined; | |
| 186 | 256 | // 新增 |
| 187 | 257 | if (!form.id) { |
| 188 | 258 | form.modelId = this.modelId; // 模型编号 |
| ... | ... | @@ -226,6 +296,31 @@ export default { |
| 226 | 296 | return deptOption.name; |
| 227 | 297 | } |
| 228 | 298 | } |
| 299 | + } else if (type === 22) { | |
| 300 | + for (const postOption of this.postOptions) { | |
| 301 | + if (postOption.id === option) { | |
| 302 | + return postOption.name; | |
| 303 | + } | |
| 304 | + } | |
| 305 | + } else if (type === 30) { | |
| 306 | + for (const userOption of this.userOptions) { | |
| 307 | + if (userOption.id === option) { | |
| 308 | + return userOption.nickname; | |
| 309 | + } | |
| 310 | + } | |
| 311 | + } else if (type === 40) { | |
| 312 | + for (const userGroupOption of this.userGroupOptions) { | |
| 313 | + if (userGroupOption.id === option) { | |
| 314 | + return userGroupOption.name; | |
| 315 | + } | |
| 316 | + } | |
| 317 | + } else if (type === 50) { | |
| 318 | + option = option + ''; // 转换成 string | |
| 319 | + for (const dictData of this.taskAssignScriptDictDatas) { | |
| 320 | + if (dictData.value === option) { | |
| 321 | + return dictData.label; | |
| 322 | + } | |
| 323 | + } | |
| 229 | 324 | } |
| 230 | 325 | return '未知(' + option + ')'; |
| 231 | 326 | }, | ... | ... |