fix: 修复流程设计器中指定人员后发起流程还需要选择接受人员问题

rf
tony 2022-12-25 21:29:30 +08:00
parent 08a43e8f4a
commit ad891029fe
5 changed files with 133 additions and 110 deletions

View File

@ -16,10 +16,7 @@ import java.util.List;
public class FlowNextDto implements Serializable {
private String type;
private String dataType;
private String vars;
private List<SysUser> userList;
private List<SysRole> roleList;
}

View File

@ -623,11 +623,14 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
public AjaxResult todoList(Integer pageNum, Integer pageSize) {
Page<FlowTaskDto> 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<Task> 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);
}
}
}

View File

@ -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() {

View File

@ -141,6 +141,8 @@ export default {
getNextFlowNodeByStart({deploymentId: this.deployId,variables:formData.valData}).then(res => {
const data = res.data;
if (data) {
this.formData = formData;
if (data.dataType === 'dynamic') {
if (data.type === 'assignee') { //
this.checkSendUser = true;
this.checkType = "single";
@ -149,36 +151,30 @@ export default {
this.checkType = "multiple";
} else if (data.type === 'candidateGroups') { // ()
this.checkSendRole = true;
} else if (data.type === 'multiInstance') { // ?
} else { //
// elementVariable
this.multiInstanceVars = data.vars;
this.checkSendUser = true;
this.checkType = "multiple";
}
if (this.checkSendUser || this.checkSendRole){
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() {

View File

@ -338,6 +338,7 @@ export default {
getNextFlowNode(params).then(res => {
const data = res.data;
if (data) {
if (data.dataType === 'dynamic') {
if (data.type === 'assignee') { //
this.checkSendUser = true;
this.checkType = "single";
@ -346,12 +347,25 @@ export default {
this.checkType = "multiple";
} else if (data.type === 'candidateGroups') { // ()
this.checkSendRole = true;
} else if (data.type === 'multiInstance') { //
} 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,6 +490,8 @@ export default {
getNextFlowNode(params).then(res => {
const data = res.data;
if (data) {
this.taskForm.formData = formData;
if (data.dataType === 'dynamic') {
if (data.type === 'assignee') { //
this.checkSendUser = true;
this.checkType = "single";
@ -484,24 +500,28 @@ export default {
this.checkType = "multiple";
} else if (data.type === 'candidateGroups') { // ()
this.checkSendRole = true;
} else if (data.type === 'multiInstance') { // ?
} else { //
// elementVariable
this.multiInstanceVars = data.vars;
this.checkSendUser = true;
this.checkType = "multiple";
}
if (this.checkSendUser || this.checkSendRole) {
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 = "流程审批";
}