表单选择的多参与者共同当某个活动的审批人

#1. 场景介绍

以订单审批流程为例,讲解如何在填写订单环节,添加直属领导和部门领导等多个参与者,共同作为下一环节的审批人。

img-multipleParticipants-06.png

#2. 效果展示

效果展示如下:

img-multipleParticipants-00.gif

#3. 实现思路

结合逻辑流进行参与者查询并组装返回,解析参与者逻辑可使用脚本、EOS服务或rest服务,本示例使用脚本。

#4. 操作步骤

以订单表(orderWarehousingentry)为例,添加字段直属领导(direct_leader)和部门领导(department_leader);

img-multipleParticipants-01.png

#4.1 添加两个人员选择组件

表单界面,添加字段“直属领导”和“部门领导”,组件均选择“人员选择”组件,“部门领导”允许多选;

img-multipleParticipants-02.png

#4.2 新建流程事件

新建流程事件,添加“脚本”,属性设置及脚本中代码如下(表单入参中表单数据在 relativeData 相关数据中,Map 对象接收。出参为 com.eos.workflow.omservice.WFParticipant 参与者对象);

img-multipleParticipants-04.png

 

img-multipleParticipants-05.png

import com.eos.workflow.omservice.WFParticipant

List<WFParticipant> participants = new ArrayList<>()

def directLeader = context.relativeData.__bfp_entity.directLeader
def departmentLeader = context.relativeData.__bfp_entity.departmentLeader

/**
 * WFParticipant(id, name, type) 
 * type: emp-员工,org-机构,role-角色
 * 
 * 相关数据返回示例: 
 * <directLeader __type="java:java.lang.String">54</directLeader>               //返回的是参与者id 
 * <departmentLeader __type="java:java.lang.String">56,57</departmentLeader>    //返回的是参与者id
 */
participants.add(new WFParticipant(directLeader,"","emp"))

def departmentLeaderArray = departmentLeader.split(",")
for(int i=0; i<departmentLeaderArray.length; i++){
    WFParticipant participant= new WFParticipant(departmentLeaderArray[i], null, "emp")
    participants.add(participant)
}

context.out = participants.toArray(new WFParticipant[participants.size()])

#4.3 参与者绑定

人工活动“直属领导或部门领导审批”的参与者设置为 4.2 中的新建流程事件。

img-multipleParticipants-03.png

更多请参见EOS Low-Code Platform 8  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值