From 8c8dfa1c0f3d1740fd42e7978455ebae35c737ee Mon Sep 17 00:00:00 2001 From: tony <846249920@qq.com> Date: Thu, 15 Dec 2022 08:13:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=81=E7=A8=8B=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/ProcessConstants.java | 8 +- .../service/impl/FlowTaskServiceImpl.java | 40 +---- .../Process/components/nodePanel/task.vue | 80 ++++------ .../src/components/flow/Expression/index.vue | 22 ++- ruoyi-ui/src/components/flow/Role/index.vue | 2 +- ruoyi-ui/src/components/flow/User/index.vue | 20 ++- ruoyi-ui/src/components/parser/Parser.vue | 18 ++- .../flowable/task/myProcess/send/index.vue | 9 -- .../views/flowable/task/todo/detail/index.vue | 139 +++++------------- 9 files changed, 119 insertions(+), 219 deletions(-) diff --git a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/constant/ProcessConstants.java b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/constant/ProcessConstants.java index dc55dfad..dcbaa15e 100644 --- a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/constant/ProcessConstants.java +++ b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/constant/ProcessConstants.java @@ -11,7 +11,7 @@ public class ProcessConstants { /** * 动态数据 */ - public static final String DATA_TYPE = "dynamic"; + public static final String DYNAMIC = "dynamic"; /** * 固定任务接收 @@ -21,19 +21,19 @@ public class ProcessConstants { /** * 单个审批人 */ - public static final String USER_TYPE_ASSIGNEE = "assignee"; + public static final String ASSIGNEE = "assignee"; /** * 候选人 */ - public static final String USER_TYPE_USERS = "candidateUsers"; + public static final String CANDIDATE_USERS = "candidateUsers"; /** * 审批组 */ - public static final String USER_TYPE_ROUPS = "candidateGroups"; + public static final String CANDIDATE_GROUPS = "candidateGroups"; /** * 单个审批人 diff --git a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java index 904bab46..9f53bb98 100644 --- a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java +++ b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java @@ -15,7 +15,6 @@ import com.ruoyi.flowable.domain.dto.FlowNextDto; import com.ruoyi.flowable.domain.dto.FlowTaskDto; import com.ruoyi.flowable.domain.dto.FlowViewerDto; import com.ruoyi.flowable.domain.vo.FlowTaskVo; -import com.ruoyi.flowable.domain.vo.ReturnTaskNodeVo; import com.ruoyi.flowable.factory.FlowServiceFactory; import com.ruoyi.flowable.flow.CustomProcessDiagramGenerator; import com.ruoyi.flowable.flow.FindNextNodeUtil; @@ -32,15 +31,12 @@ import org.flowable.bpmn.model.Process; import org.flowable.bpmn.model.*; import org.flowable.common.engine.api.FlowableException; import org.flowable.common.engine.api.FlowableObjectNotFoundException; -import org.flowable.common.engine.api.query.QueryProperty; import org.flowable.common.engine.impl.identity.Authentication; import org.flowable.engine.ProcessEngineConfiguration; import org.flowable.engine.history.HistoricActivityInstance; import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.history.HistoricProcessInstanceQuery; -import org.flowable.engine.impl.ActivityInstanceQueryProperty; import org.flowable.engine.repository.ProcessDefinition; -import org.flowable.engine.runtime.ActivityInstance; import org.flowable.engine.runtime.Execution; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.task.Comment; @@ -60,7 +56,6 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import java.util.function.Predicate; -import java.util.stream.Collectors; /** * @author XuanXuan @@ -952,44 +947,19 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask // 会签节点 if (Objects.nonNull(multiInstance)) { List list = sysUserService.selectUserList(new SysUser()); - flowNextDto.setVars(ProcessConstants.PROCESS_MULTI_INSTANCE_USER); flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE); flowNextDto.setUserList(list); } else { - // 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组 String dataType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_DATA_TYPE); String userType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_USER_TYPE); - + flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL); + flowNextDto.setType(userType); // 处理加载动态指定下一节点接收人员信息 - if (ProcessConstants.DATA_TYPE.equals(dataType)) { - // 指定单个人员 - if (ProcessConstants.USER_TYPE_ASSIGNEE.equals(userType)) { - List list = sysUserService.selectUserList(new SysUser()); - - flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL); - flowNextDto.setType(ProcessConstants.USER_TYPE_ASSIGNEE); - flowNextDto.setUserList(list); - } - // 候选人员(多个) - if (ProcessConstants.USER_TYPE_USERS.equals(userType)) { - List list = sysUserService.selectUserList(new SysUser()); - - flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL); - flowNextDto.setType(ProcessConstants.USER_TYPE_USERS); - flowNextDto.setUserList(list); - } - // 候选组 - if (ProcessConstants.USER_TYPE_ROUPS.equals(userType)) { - List sysRoles = sysRoleService.selectRoleAll(); - - flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL); - flowNextDto.setType(ProcessConstants.USER_TYPE_ROUPS); - flowNextDto.setRoleList(sysRoles); - } - } else { - flowNextDto.setType(ProcessConstants.FIXED); + if (ProcessConstants.DYNAMIC.equals(dataType)) { + flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL); + flowNextDto.setType(userType); } } } diff --git a/ruoyi-ui/src/components/Process/components/nodePanel/task.vue b/ruoyi-ui/src/components/Process/components/nodePanel/task.vue index 2230626c..dbcd190e 100644 --- a/ruoyi-ui/src/components/Process/components/nodePanel/task.vue +++ b/ruoyi-ui/src/components/Process/components/nodePanel/task.vue @@ -71,7 +71,7 @@ :close-on-press-escape="false" :show-close="false" > - + 取 消 确 定 @@ -85,7 +85,7 @@ :close-on-press-escape="false" :show-close="false" > - + 取 消 确 定 @@ -169,6 +169,7 @@ export default { checkType: 'single', // 选中的值 checkValues: null, + selectValues: null, // 用户列表 userList: this.users, groupList: this.groups, @@ -375,14 +376,14 @@ export default { }, watch: { 'formData.userType': function(val, oldVal) { + const types = ['assignee', 'candidateUsers', 'candidateGroups'] if (oldVal) { - const types = ['assignee', 'candidateUsers', 'candidateGroups'] types.forEach(type => { delete this.element.businessObject.$attrs[`flowable:${type}`] delete this.formData[type] - this.updateProperties({'flowable:userType': type}) }) } + this.updateProperties({'flowable:userType': val}) }, // // 动态选择流程执行人 // 'formData.dataType': function(val) { @@ -510,19 +511,21 @@ export default { const attrs = that.element.businessObject.$attrs; const businessObject = that.element.businessObject; // 指定用户 - if (attrs.hasOwnProperty("flowable:assignee")){ + if (attrs.hasOwnProperty("flowable:assignee")) { const val = attrs["flowable:assignee"]; // 查找是否动态指定人员(选中流程表达式) - if (attrs["flowable:dataType"] === "dynamic"){ - this.checkValues = that.expList.find(item => item.id == val).name; - }else { + if (attrs["flowable:dataType"] === "dynamic") { + this.checkValues = that.expList.find(item => item.expression == val).name; + this.selectValues = that.expList.find(item => item.expression == val).id; + } else { this.checkValues = that.userList.find(item => item.userId == val).nickName; + this.selectValues = that.userList.find(item => item.userId == val).userId; } // 候选用户 } else if (attrs.hasOwnProperty("flowable:candidateUsers")) { const val = attrs["flowable:candidateUsers"]; if (attrs["flowable:dataType"] === "dynamic") { - this.checkValues = that.expList.find(item => item.id == val).name; + this.checkValues = that.expList.find(item => item.expression == val).name; } else { const array = []; const vals = val.split(','); @@ -533,25 +536,13 @@ export default { } }) this.checkValues = array.join(','); - } - // if (val.indexOf(",") !== -1) { - // const vals = val.split(','); - // vals.forEach(key => { - // const user = that.userList.find(item => item.userId == key) - // if (user) { - // array.push(user.nickName); - // } - // }) - // this.checkValues = array.join(','); - // }else { - // const user = that.userList.find(item => item.userId == val); - // this.checkValues = user.nickName; - // } - } else if (businessObject.hasOwnProperty("candidateGroups")){ + this.selectValues = array.join(','); + } + } else if (businessObject.hasOwnProperty("candidateGroups")) { // 候选角色信息 const val = businessObject["candidateGroups"]; if (attrs["flowable:dataType"] === "dynamic") { - this.checkValues = that.expList.find(item => item.id == val).name; + this.checkValues = that.expList.find(item => item.expression == val).name; } else { const array = []; const vals = val.split(','); @@ -563,19 +554,6 @@ export default { }) this.checkValues = array.join(','); } - // if (val.indexOf(",") !== -1) { - // const vals = val.split(','); - // vals.forEach(key => { - // const role = that.groupList.find(item => item.roleId == key) - // if (role) { - // array.push(role.roleName); - // } - // }) - // this.checkValues = array.join(','); - // }else { - // const role = that.groupList.find(item => item.roleId == val); - // this.checkValues = role.roleName; - // } } }, finishExecutionListener() { @@ -622,44 +600,42 @@ export default { this.expType = expType; }, // 选中表达式 - handleSingleExpSelect(selection){ + handleSingleExpSelect(selection) { this.deleteFlowAttar(); - console.log(this.element.businessObject,"element.businessObject") this.updateProperties({'flowable:dataType': 'dynamic'}) - if ("assignee" === this.expType){ - this.updateProperties({'flowable:assignee': selection.id.toString()}); - }else if ("candidateUsers" === this.expType) { - this.updateProperties({'flowable:candidateUsers': selection.id.toString()}); - }else if ("candidateGroups" === this.expType) { - this.updateProperties({'flowable:candidateGroups': selection.id.toString()}); + if ("assignee" === this.expType) { + this.updateProperties({'flowable:assignee': selection.expression}); + } else if ("candidateUsers" === this.expType) { + this.updateProperties({'flowable:candidateUsers': selection.expression}); + } else if ("candidateGroups" === this.expType) { + this.updateProperties({'flowable:candidateGroups': selection.expression}); } this.checkValues = selection.name; this.expType = null; }, // 用户选中数据 handleUserSelect(selection) { - console.log(selection,"handleUserSelect") const that = this; if (selection) { that.deleteFlowAttar(); - this.updateProperties({'flowable:dataType': 'fixed'}) - if (selection instanceof Array){ + that.updateProperties({'flowable:dataType': 'fixed'}) + if (selection instanceof Array) { const userIds = selection.map(item => item.userId); const nickName = selection.map(item => item.nickName); that.updateProperties({'flowable:candidateUsers': userIds.join(',')}) that.checkValues = nickName.join(','); - }else { + } else { that.updateProperties({'flowable:assignee': selection.userId}) that.checkValues = selection.nickName; } } }, // 角色选中数据 - handleRoleSelect(selection,name) { + handleRoleSelect(selection, name) { const that = this; if (selection && name) { that.deleteFlowAttar(); - this.updateProperties({'flowable:dataType': 'fixed'}) + that.updateProperties({'flowable:dataType': 'fixed'}) that.updateProperties({'flowable:candidateGroups': selection}); that.checkValues = name; } diff --git a/ruoyi-ui/src/components/flow/Expression/index.vue b/ruoyi-ui/src/components/flow/Expression/index.vue index 43930bd3..8586596e 100755 --- a/ruoyi-ui/src/components/flow/Expression/index.vue +++ b/ruoyi-ui/src/components/flow/Expression/index.vue @@ -50,11 +50,19 @@