跳到主要内容

定时通知审批人

1. 使用背景

当用户提交审批流程,并希望系统能在固定的时间提醒审批人进行审批时,我们就可以通过本文档的方式实现该需求。

2. 操作步骤

2.1 步骤一:创建所需表单

2.1.1 创建流程表单

创建流程表单,用于承载审批流程,需要在页面添加成员组件,用作设置变量审批人从而给其发送消息通知。

操作步骤:

a. 新建流程表单,命名为「流程表单」。

b. 在流程表单编辑页面内添加名为 "通知日期" 的 日期组件、名为 "A节点审批人"和" B节点审批人 "的两个成员组件。

c. 点击保存按钮。

操作步骤:

a. 新建流程页面,命名为「流程表单」。

b. 在编辑页面分别添加 "通知日期","A节点审批人"、"B节点审批人" 和其余流程审批所需组件。

c. 点击保存。

d. 设计流程表单的流程设计,点击设置 >> 流程设计

e. 增加两个审批人节点,分别起名为 "A节点审批人" 和 "B节点审批人" 。配置审批人为表单内的成员字段,选择对应的成员字段(如图2.1.1-2 所示)。

图2.1.1-2 流程设计

2.1.2 创建表单页面

创建两个表单页面,命名为「A节点通知表单」和「B节点通知表单」,分别存储流程表单内的A、B审批人、通知日期和实例 ID,用作消息通知和点击消息通知自动跳转至审批页面(如图2.1.2-1、2.1.2-2 所示)。

图2.1.2-1 A节点通知表单

图2.1.2-2 B节点通知表单

设置A、B节点通知表单的消息通知

操作步骤:

选择 设置 >> 页面设置 >> 消息通知 >> 新建通知 >> 勾选根据表单内日期字段设置 >> 设置规则(如图2.1.2-4 所示) >> 选择按页面内组件通知 >> A页面选择A节点审批人 >> 配置消息模版并选择该模板(如图2.1.2-3 所示)

图2.1.2-3 设置消息通知

设置规则为日期组件时间当前的 18 : 14 开始,每天提醒一次,直到2022年10月01日。

若将这条数据删除,那么会终止消息通知。

图2.1.2-4 设置规则

2.2 步骤二:配置流程页面节点提交规则

在「流程表单」的流程设计中,设置节点提交规则(如图2.2-1 所示),分别是:

图2.2-1 配置节点提交规则

2.2.1 插入A节点消息通知:(如图2.2.1-1 所示)

图2.2.1-1 插入A节点消息通知

以下为关联操作的示例,注意:复制后请将所有字段,替换成当前页面的对应字段。

{"text":"UPSERT(​A节点通知表单​,EQ(​A节点通知表单.A节点审批人​,​A节点审批人​),\"\",​A节点通知表单.通知日期​,​通知日期​,​A节点通知表单.A节点审批人​,​A节点审批人​,​A节点通知表单.实例ID​,​实例id (var)​)","marks":[{"from":{"line":0,"ch":7,"sticky":null},"to":{"line":0,"ch":16,"sticky":null},"value":"FORM-YE866VA1GSOU8MQL59667ASD0I873NKWK36VK7/","invalid":false},{"from":{"line":0,"ch":20,"sticky":null},"to":{"line":0,"ch":36,"sticky":null},"value":"FORM-YE866VA1GSOU8MQL59667ASD0I873NKWK36VK7/employeeField_kv63l2zp","invalid":false},{"from":{"line":0,"ch":37,"sticky":null},"to":{"line":0,"ch":45,"sticky":null},"value":"employeeField_kv61pgje","invalid":false},{"from":{"line":0,"ch":50,"sticky":null},"to":{"line":0,"ch":64,"sticky":null},"value":"FORM-YE866VA1GSOU8MQL59667ASD0I873NKWK36VK7/dateField_kv63l2zo","invalid":false},{"from":{"line":0,"ch":65,"sticky":null},"to":{"line":0,"ch":71,"sticky":null},"value":"dateField_kv7eqtdx","invalid":false},{"from":{"line":0,"ch":72,"sticky":null},"to":{"line":0,"ch":88,"sticky":null},"value":"FORM-YE866VA1GSOU8MQL59667ASD0I873NKWK36VK7/employeeField_kv63l2zp","invalid":false},{"from":{"line":0,"ch":89,"sticky":null},"to":{"line":0,"ch":97,"sticky":null},"value":"employeeField_kv61pgje","invalid":false},{"from":{"line":0,"ch":98,"sticky":null},"to":{"line":0,"ch":112,"sticky":null},"value":"FORM-YE866VA1GSOU8MQL59667ASD0I873NKWK36VK7/textField_kv6bay59","invalid":false},{"from":{"line":0,"ch":113,"sticky":null},"to":{"line":0,"ch":125,"sticky":null},"value":"yida_formInstId","invalid":false}],"isCmData":true}

2.2.2 删除A节点消息通知:(如图2.2.2-1 所示)

图2.2.2-1 删除A节点消息通知

以下为关联操作的示例,注意:复制后请将所有字段,替换成当前页面的对应字段。

{"text":"DELETE(​A节点通知表单​,EQ(​A节点通知表单.A节点审批人​,​A节点审批人​),\"\")","marks":[{"from":{"line":0,"ch":7,"sticky":null},"to":{"line":0,"ch":16,"sticky":null},"value":"FORM-YE866VA1GSOU8MQL59667ASD0I873NKWK36VK7/","invalid":false},{"from":{"line":0,"ch":20,"sticky":null},"to":{"line":0,"ch":36,"sticky":null},"value":"FORM-YE866VA1GSOU8MQL59667ASD0I873NKWK36VK7/employeeField_kv63l2zp","invalid":false},{"from":{"line":0,"ch":37,"sticky":null},"to":{"line":0,"ch":45,"sticky":null},"value":"employeeField_kv61pgje","invalid":false}],"isCmData":true}

2.2.3 插入B节点消息通知:(如图2.2.3-1 所示)

图2.2.3-1 插入B节点消息通知

以下为关联操作的示例,注意:复制后请将所有字段,替换成当前页面的对应字段。

{"text":"UPSERT(​B节点通知表单​,EQ(​B节点通知表单.B节点审批人​,​B节点审批人​),\"\",​B节点通知表单.通知日期​,​通知日期​,​B节点通知表单.B节点审批人​,​B节点审批人​,​B节点通知表单.实例ID​,​实例id (var)​)","marks":[{"from":{"line":0,"ch":7,"sticky":null},"to":{"line":0,"ch":16,"sticky":null},"value":"FORM-YE866VA1VNRUR0LR0I4A3DDJXRLS37RA746VK0/","invalid":false},{"from":{"line":0,"ch":20,"sticky":null},"to":{"line":0,"ch":36,"sticky":null},"value":"FORM-YE866VA1VNRUR0LR0I4A3DDJXRLS37RA746VK0/employeeField_kv63l2zp","invalid":false},{"from":{"line":0,"ch":37,"sticky":null},"to":{"line":0,"ch":45,"sticky":null},"value":"employeeField_kv61pgjf","invalid":false},{"from":{"line":0,"ch":50,"sticky":null},"to":{"line":0,"ch":64,"sticky":null},"value":"FORM-YE866VA1VNRUR0LR0I4A3DDJXRLS37RA746VK0/dateField_kv63l2zo","invalid":false},{"from":{"line":0,"ch":65,"sticky":null},"to":{"line":0,"ch":71,"sticky":null},"value":"dateField_kv7eqtdx","invalid":false},{"from":{"line":0,"ch":72,"sticky":null},"to":{"line":0,"ch":88,"sticky":null},"value":"FORM-YE866VA1VNRUR0LR0I4A3DDJXRLS37RA746VK0/employeeField_kv63l2zp","invalid":false},{"from":{"line":0,"ch":89,"sticky":null},"to":{"line":0,"ch":97,"sticky":null},"value":"employeeField_kv61pgjf","invalid":false},{"from":{"line":0,"ch":98,"sticky":null},"to":{"line":0,"ch":112,"sticky":null},"value":"FORM-YE866VA1VNRUR0LR0I4A3DDJXRLS37RA746VK0/textField_kv6bay59","invalid":false},{"from":{"line":0,"ch":113,"sticky":null},"to":{"line":0,"ch":125,"sticky":null},"value":"yida_formInstId","invalid":false}],"isCmData":true}

2.2.4 删除B节点消息通知:(如图2.2.4-1 所示)

图2.2.4-1 删除B节点消息通知

以下为关联操作的示例,注意:复制后请将所有字段,替换成当前页面的对应字段。

{"text":"DELETE(​B节点通知表单​,EQ(​B节点通知表单.B节点审批人​,​B节点审批人​),\"\")","marks":[{"from":{"line":0,"ch":7,"sticky":null},"to":{"line":0,"ch":16,"sticky":null},"value":"FORM-YE866VA1VNRUR0LR0I4A3DDJXRLS37RA746VK0/","invalid":false},{"from":{"line":0,"ch":20,"sticky":null},"to":{"line":0,"ch":36,"sticky":null},"value":"FORM-YE866VA1VNRUR0LR0I4A3DDJXRLS37RA746VK0/employeeField_kv63l2zp","invalid":false},{"from":{"line":0,"ch":37,"sticky":null},"to":{"line":0,"ch":45,"sticky":null},"value":"employeeField_kv61pgjf","invalid":false}],"isCmData":true}

2.3 步骤三:配置表单页面的跳转链接

作用:在点击消息通知进入到表单详情页面时,自动跳转到待审批的流程页面。

注意:如果点击消息通知,页面显示无权限访问页面,需要配置表单页面权限为可查看数据。

分别在「A节点通知表单」和「B节点通知表单」的页面设置中绑页面加载完成时的 didmount 动作,并写入代码判断是否为提交页面,如果不是提交页面跳转至审批页面(如图2.3-1 所示)。

图2.3-1绑定didmount

以下代码可以直接复制到 JS 面板内,注意:替换APPType和唯一标识,唯一标识为当前页面实例 ID 的标识。

export function didMount() {
if (!this.utils.isSubmissionPage()) {//判断是否是提交页
this.utils.router.push(`https://www.aliwork.com/APP_EFGOUXOHRUAZ3IWPNGCZ/processDetail?formInstId=${this.$("textField_kv6bay59").getValue()}`, "", true, true)
}
}

3. 效果演示

宜搭为了更好的优化宜搭使用手册内容和质量,占用您3-5分钟时间,辛苦填写一下文档反馈问卷。文档反馈问卷是匿名提交,同时问卷信息仅用于宜搭文档体验反馈收集,感谢您对宜搭的支持!

点此填写调研问卷


--------------------获取宜搭最新信息,欢迎关注我们--------------------

Copyright © 2024钉钉(中国)信息技术有限公司和/或其关联公司浙ICP备18037475号-4