From ad891029fec716791f271b4ed3f7782cba5e67df Mon Sep 17 00:00:00 2001 From: tony <846249920@qq.com> Date: Sun, 25 Dec 2022 21:29:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=AD=E6=8C=87=E5=AE=9A=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=90=8E=E5=8F=91=E8=B5=B7=E6=B5=81=E7=A8=8B=E8=BF=98?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E9=80=89=E6=8B=A9=E6=8E=A5=E5=8F=97=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flowable/domain/dto/FlowNextDto.java | 5 +- .../service/impl/FlowTaskServiceImpl.java | 21 ++--- .../Process/components/nodePanel/task.vue | 65 ++++++++------ .../flowable/task/myProcess/send/index.vue | 62 ++++++------- .../views/flowable/task/todo/detail/index.vue | 90 +++++++++++-------- 5 files changed, 133 insertions(+), 110 deletions(-) diff --git a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowNextDto.java b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowNextDto.java index cb00be44..93672b11 100644 --- a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowNextDto.java +++ b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowNextDto.java @@ -16,10 +16,7 @@ import java.util.List; public class FlowNextDto implements Serializable { private String type; - + private String dataType; private String vars; - private List userList; - - private List roleList; } 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 7b338d8b..022c1b4c 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 @@ -623,11 +623,14 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask public AjaxResult todoList(Integer pageNum, Integer pageSize) { Page page = new Page<>(); // 只查看自己的数据 - Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); + SysUser sysUser = SecurityUtils.getLoginUser().getUser(); + Long userId = sysUser.getUserId(); TaskQuery taskQuery = taskService.createTaskQuery() .active() .includeProcessVariables() -// .taskAssignee(userId.toString()) + .taskAssignee(userId.toString()) +// .taskCandidateUser(userId.toString()) +// .taskCandidateGroup(sysUser.getRoleId().toString()) .orderByTaskCreateTime().desc(); page.setTotal(taskQuery.count()); List taskList = taskQuery.listPage(pageSize * (pageNum - 1), pageSize); @@ -959,17 +962,14 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask if (Objects.nonNull(multiInstance)) { flowNextDto.setVars(multiInstance.getInputDataItem()); flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE); + flowNextDto.setDataType(ProcessConstants.PROCESS_MULTI_INSTANCE); } 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.DYNAMIC.equals(dataType)) { - flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL); - flowNextDto.setType(userType); - } + flowNextDto.setDataType(dataType); } } } else { @@ -999,17 +999,14 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask if (Objects.nonNull(multiInstance)) { flowNextDto.setVars(multiInstance.getInputDataItem()); flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE); + flowNextDto.setDataType(ProcessConstants.PROCESS_MULTI_INSTANCE); } 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.DYNAMIC.equals(dataType)) { - flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL); - flowNextDto.setType(userType); - } + flowNextDto.setDataType(dataType); } } } diff --git a/ruoyi-ui/src/components/Process/components/nodePanel/task.vue b/ruoyi-ui/src/components/Process/components/nodePanel/task.vue index 44307461..5d61809d 100644 --- a/ruoyi-ui/src/components/Process/components/nodePanel/task.vue +++ b/ruoyi-ui/src/components/Process/components/nodePanel/task.vue @@ -367,56 +367,69 @@ export default { this.updateProperties({'flowable:userType': val}) }, 'formData.async': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:async': val }) + if (val) { + this.updateProperties({'flowable:async': val}) + } }, 'formData.dueDate': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:dueDate': val }) + if (val) { + this.updateProperties({'flowable:dueDate': val}) + } }, 'formData.formKey': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:formKey': val }) + if (val) { + this.updateProperties({'flowable:formKey': val}) + } }, 'formData.priority': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:priority': val }) + if (val) { + this.updateProperties({'flowable:priority': val}) + } }, 'formData.skipExpression': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:skipExpression': val }) + if (val) { + this.updateProperties({'flowable:skipExpression': val}) + } }, 'formData.isForCompensation': function(val) { - if (val === '') val = null - this.updateProperties({ 'isForCompensation': val }) + if (val) { + this.updateProperties({'isForCompensation': val}) + } }, 'formData.triggerable': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:triggerable': val }) + if (val) { + this.updateProperties({'flowable:triggerable': val}) + } }, 'formData.class': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:class': val }) + if (val) { + this.updateProperties({'flowable:class': val}) + } }, 'formData.autoStoreVariables': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:autoStoreVariables': val }) + if (val) { + this.updateProperties({'flowable:autoStoreVariables': val}) + } }, 'formData.exclude': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:exclude': val }) + if (val) { + this.updateProperties({'flowable:exclude': val}) + } }, 'formData.ruleVariablesInput': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:ruleVariablesInput': val }) + if (val) { + this.updateProperties({'flowable:ruleVariablesInput': val}) + } }, 'formData.rules': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:rules': val }) + if (val) { + this.updateProperties({'flowable:rules': val}) + } }, 'formData.resultVariable': function(val) { - if (val === '') val = null - this.updateProperties({ 'flowable:resultVariable': val }) + if (val) { + this.updateProperties({'flowable:resultVariable': val}) + } } }, created() { diff --git a/ruoyi-ui/src/views/flowable/task/myProcess/send/index.vue b/ruoyi-ui/src/views/flowable/task/myProcess/send/index.vue index 8da86d04..2c147bdf 100644 --- a/ruoyi-ui/src/views/flowable/task/myProcess/send/index.vue +++ b/ruoyi-ui/src/views/flowable/task/myProcess/send/index.vue @@ -141,44 +141,40 @@ export default { getNextFlowNodeByStart({deploymentId: this.deployId,variables:formData.valData}).then(res => { const data = res.data; if (data) { - if (data.type === 'assignee') { // 指定人员 - this.checkSendUser = true; - this.checkType = "single"; - } else if (data.type === 'candidateUsers') { // 候选人员(多个) - this.checkSendUser = true; - this.checkType = "multiple"; - } else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务) - this.checkSendRole = true; - } else if (data.type === 'multiInstance') { // 会签? - // 流程设计指定的 elementVariable 作为会签人员列表 - this.multiInstanceVars = data.vars; - this.checkSendUser = true; - this.checkType = "multiple"; - } - if (this.checkSendUser || this.checkSendRole){ + this.formData = formData; + if (data.dataType === 'dynamic') { + if (data.type === 'assignee') { // 指定人员 + this.checkSendUser = true; + this.checkType = "single"; + } else if (data.type === 'candidateUsers') { // 候选人员(多个) + this.checkSendUser = true; + this.checkType = "multiple"; + } else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务) + this.checkSendRole = true; + } else { // 会签 + // 流程设计指定的 elementVariable 作为会签人员列表 + this.multiInstanceVars = data.vars; + this.checkSendUser = true; + this.checkType = "multiple"; + } this.taskOpen = true; this.taskTitle = "选择任务接收"; - this.formData = formData; + } else { + const variables = this.formData.valData; + const formData = this.formData.formData; + formData.disabled = true; + formData.formBtns = false; + if (this.procDefId) { + variables.variables = formData; + // 启动流程并将表单数据加入流程变量 + definitionStart(this.procDefId, JSON.stringify(variables)).then(res => { + this.$modal.msgSuccess(res.msg); + this.goBack(); + }) + } } } }) - - // else { - // if (data) { - // const variables = data.valData; - // const formData = data.formData; - // formData.disabled = true; - // formData.formBtns = false; - // if (this.taskForm.procDefId) { - // variables.variables = formData; - // // 启动流程并将表单数据加入流程变量 - // definitionStart(this.taskForm.procDefId, JSON.stringify(variables)).then(res => { - // this.$modal.msgSuccess(res.msg); - // this.goBack(); - // }) - // } - // } - // } }, /** 提交流程 */ submitTask() { diff --git a/ruoyi-ui/src/views/flowable/task/todo/detail/index.vue b/ruoyi-ui/src/views/flowable/task/todo/detail/index.vue index f7d15d08..acf971cc 100644 --- a/ruoyi-ui/src/views/flowable/task/todo/detail/index.vue +++ b/ruoyi-ui/src/views/flowable/task/todo/detail/index.vue @@ -338,19 +338,33 @@ export default { getNextFlowNode(params).then(res => { const data = res.data; if (data) { - if (data.type === 'assignee') { // 指定人员 - this.checkSendUser = true; - this.checkType = "single"; - } else if (data.type === 'candidateUsers') { // 候选人员(多个) - this.checkSendUser = true; - this.checkType = "multiple"; - } else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务) - this.checkSendRole = true; - } else if (data.type === 'multiInstance') { // 会签 - // 流程设计指定的 elementVariable 作为会签人员列表 - this.multiInstanceVars = data.vars; - this.checkSendUser = true; - this.checkType = "multiple"; + if (data.dataType === 'dynamic') { + if (data.type === 'assignee') { // 指定人员 + this.checkSendUser = true; + this.checkType = "single"; + } else if (data.type === 'candidateUsers') { // 候选人员(多个) + this.checkSendUser = true; + this.checkType = "multiple"; + } else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务) + this.checkSendRole = true; + } else { // 会签 + // 流程设计指定的 elementVariable 作为会签人员列表 + this.multiInstanceVars = data.vars; + this.checkSendUser = true; + this.checkType = "multiple"; + } + } else { + // 表单是否禁用 + this.taskForm.formData.formData.disabled = true; + // 是否显示按钮 + this.taskForm.formData.formData.formBtns = false; + this.taskForm.variables = Object.assign({}, this.taskForm.variables, this.taskForm.formData.valData); + this.taskForm.variables.variables = this.taskForm.formData.formData; + console.log(this.taskForm, "流程审批提交表单数据") + complete(this.taskForm).then(response => { + this.$modal.msgSuccess(response.msg); + this.goBack(); + }); } } }) @@ -476,32 +490,38 @@ export default { getNextFlowNode(params).then(res => { const data = res.data; if (data) { - if (data.type === 'assignee') { // 指定人员 - this.checkSendUser = true; - this.checkType = "single"; - } else if (data.type === 'candidateUsers') { // 候选人员(多个) - this.checkSendUser = true; - this.checkType = "multiple"; - } else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务) - this.checkSendRole = true; - } else if (data.type === 'multiInstance') { // 会签? - // 流程设计指定的 elementVariable 作为会签人员列表 - this.multiInstanceVars = data.vars; - this.checkSendUser = true; - this.checkType = "multiple"; - } - if (this.checkSendUser || this.checkSendRole) { + this.taskForm.formData = formData; + if (data.dataType === 'dynamic') { + if (data.type === 'assignee') { // 指定人员 + this.checkSendUser = true; + this.checkType = "single"; + } else if (data.type === 'candidateUsers') { // 候选人员(多个) + this.checkSendUser = true; + this.checkType = "multiple"; + } else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务) + this.checkSendRole = true; + } else { // 会签 + // 流程设计指定的 elementVariable 作为会签人员列表 + this.multiInstanceVars = data.vars; + this.checkSendUser = true; + this.checkType = "multiple"; + } this.completeOpen = true; this.completeTitle = "流程审批"; - this.taskForm.formData = formData; + } else { + // 表单是否禁用 + this.taskForm.formData.formData.disabled = true; + // 是否显示按钮 + this.taskForm.formData.formData.formBtns = false; + this.taskForm.variables = Object.assign({}, this.taskForm.variables, this.taskForm.formData.valData); + this.taskForm.variables.variables = this.taskForm.formData.formData; + console.log(this.taskForm, "流程审批提交表单数据") + complete(this.taskForm).then(response => { + this.$modal.msgSuccess(response.msg); + this.goBack(); + }); } } else { - // 最后一个任务节点 - // console.log(this.taskForm, "流程审批提交表单数据") - // complete(this.taskForm).then(response => { - // this.$modal.msgSuccess(response.msg); - // this.goBack(); - // }); this.completeOpen = true; this.completeTitle = "流程审批"; }