简体中文
bpm.remindCard.render.before
约 437 字大约 1 分钟
2026-04-17
说明:该事件在业务流待办卡片渲染前触发。
该事件用于在待办卡片渲染前执行扩展逻辑,包括但不限于以下能力:1. 获取卡片任务数据 2. 获取卡片按钮数据 3. 自定义卡片按钮
参数
| 参数 | 说明 | 类型 |
|---|---|---|
| getTaskData | 获取卡片任务数据(示例) | Function |
| getButtons | 获取卡片按钮数据(示例) | Function |
| customButtons | 自定义按钮(示例) | Function |
示例
一、getTaskData
功能描述
获取待办页面单张卡片的任务数据。
参数
无
返回结果
| 参数 | 说明 | 类型 |
|---|---|---|
| name | 任务名称 | String |
| taskId | 任务 ID | String |
| state | 任务状态 | String |
代码示例
export default class Plugin {
apply() {
return [
{
event: 'bpm.remindCard.render.before',
functional: this.remindCardRenderBefore.bind(this),
},
];
}
remindCardRenderBefore(api) {
const taskData = api.getTaskData();
console.log(taskData);
}
}二、getButtons
功能描述
获取待办卡片上的按钮数据。
参数
无
返回结果
| 参数 | 说明 | 类型 |
|---|---|---|
| buttons | 每个任务卡片对应的按钮集合 | Object |
代码示例
export default class Plugin {
apply() {
return [
{
event: 'bpm.remindCard.render.before',
functional: this.remindCardRenderBefore.bind(this),
},
];
}
remindCardRenderBefore(api) {
const buttons = api.getButtons();
console.log(buttons);
}
}三、customButtons
功能描述
按任务维度对待办卡片按钮进行改名、排序或隐藏。
参数
| 参数 | 说明 | 类型 |
|---|---|---|
| content | 自定义按钮数据 | Object |
返回结果
无
参数代码示例
const buttons = api.getButtons();
for (const key in buttons) {
if (key === '65d7266ec26b8d323e19d2e8') {
buttons[key].forEach((item) => {
if (item.action === 'suspend') item.label = '暂不处理自定义名称';
if (item.action === 'Complete') item.label = '完成自定义名称';
});
}
}代码示例
export default class Plugin {
apply() {
return [
{
event: 'bpm.remindCard.render.before',
functional: this.remindCardRenderBefore.bind(this),
},
];
}
remindCardRenderBefore(api) {
const buttons = api.getButtons();
for (const key in buttons) {
if (key === '65d7266ec26b8d323e19d2e8') {
buttons[key].forEach((item) => {
if (item.action === 'suspend') {
item.label = '暂不处理自定义名称';
} else if (item.action === 'Complete') {
item.label = '完成自定义名称';
}
});
}
if (key === '65ddb0f9297cc13e01456df1') {
buttons[key] = buttons[key].filter((item) => item.action !== 'suspend');
}
}
api.customButtons(buttons);
}
}