EOS Low-Code Platform 8 EOS Low-Code Platform 8
产品简介
学习指南
更新说明
安装与集成
初见EOS
低代码开发手册
专业代码开发手册
专题场景实战
公共服务框架
应用运行治理
升级手册
常见问题
  • 表单选择的多参与者共同当某个活动的审批人
  • 1. 场景介绍
  • 2. 效果展示
  • 3. 实现思路
  • 4. 操作步骤
  • 4.1 添加两个人员选择组件
  • 4.2 新建流程事件
  • 4.3 参与者绑定

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

# 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

← 多人审批时一个人修改后限制其余人不能修改 投票竞选 →