因为这个项目license问题无法开源,更多技术支持与服务请加入我的知识星球。
1、因为仿钉钉设计器里抄送人是一个服务任务,所以要根据这个服务任务进行处理
2、前端就是一个抄送,选择人
3、这里用了jeecg的选择人组件
<el-form-item prop="users" label="指定人员" v-if="activeData.assigneeType === 'user'">
<div style="width:100%">
<j-select-user-by-dept
:zIndex="3000"
v-model:value="activeData.users"
:multi="true"
:placeholder="`请选择${type}人`"
@getSelectResult="handleSelectUsers">
</j-select-user-by-dept>
</div>
</el-form-item>
4、后端对这个处理如下:
public class CcNode extends AssigneeNode {
// 表单属性
private List<FormProperty> formProperties = new ArrayList<>();
// 操作权限
private Map<String, Boolean> operations = new LinkedHashMap<>();
@Override
public List<FlowElement> convert() {
ArrayList<FlowElement> elements = new ArrayList<>();
// 服务节点
ServiceTask serviceTask = new ServiceTask();
serviceTask.setId(this.getId());
serviceTask.setName(this.getName());
// serviceTask.setAsynchronous(true);
serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
serviceTask.setImplementation("org.jeecg.modules.flowable.ServiceTask.ccDelegate");
//增加扩展属性 add by nbacheng
Map<String, List<ExtensionElement>> extensionElements = new HashMap<String, List<ExtensionElement>>();
ExtensionElement extensionElementTotal = new ExtensionElement();
extensionElementTotal.setName("flowable:properties");
ExtensionElement extensionElement = new ExtensionElement();
extensionElement.setName("flowable:property");
ExtensionAttribute extensionAttributeName = new ExtensionAttribute();
extensionAttributeName.setName("name");
extensionAttributeName.setValue("ccUserList");
extensionElement.addAttribute(extensionAttributeName);
ExtensionAttribute extensionAttributeValue = new ExtensionAttribute();
extensionAttributeValue.setName("value");
extensionAttributeValue.setValue(StringUtils.join(this.getUsers(), ","));
extensionElement.addAttribute(extensionAttributeValue);
extensionElementTotal.addChildElement(extensionElement);
extensionElements.put("ccUserList", CollUtil.newArrayList(extensionElementTotal));
serviceTask.setExtensionElements(extensionElements);
elements.add(serviceTask);
// 下一个节点的连线
Node child = this.getChild();
SequenceFlow sequenceFlow = this.buildSequence(child);
elements.add(sequenceFlow);
// 下一个节点
if (Objects.nonNull(child)) {
child.setBranchId(this.getBranchId());
List<FlowElement> flowElements = child.convert();
elements.addAll(flowElements);
}
return elements;
}
}
4、实际的效果图与xml