简体中文
flow.approval.detail.related.render.before
约 374 字大约 1 分钟
2026-06-04
flow.approval.detail.related.render.before
说明:该钩子用于审批详情关联对象渲染前改写渲染样式。
功能描述
- 审批详情关联对象渲染前改写渲染样式,支持通过 fieldsStyles 或 methods.getFieldsStyles() 自定义列样式。
参数
| 参数 | 说明 | 类型 |
|---|---|---|
| controlArg | 对象数据 apiName、id 等 | Object |
| detailObjects | 从对象数据 | Array |
返回结果
| 参数 | 说明 | 类型 |
|---|---|---|
| methods | 方法集合,包含 getFieldsStyles() | Object |
| fieldsStyles | 字段样式配置,与 methods.getFieldsStyles() 功能一致 | Object |
fieldsStyles 配置说明
| 属性 | 说明 | 类型 |
|---|---|---|
| column_width | 列宽 | Number |
| text_style | 文本样式 | String |
| max_lines | 最大行数,0 表示不限制 | Number |
| header_text_style | 仅追加到 header 的文本样式 | String |
| value_text_style | 仅追加到 body/value 的文本样式 | String |
可通过 '*' 通配符设置全局样式,也可通过字段 api_name 设置指定字段样式。
参数代码示例
let controlArg = options && options.controlArg;
let detailObjects = options && options.detailObjects;代码示例
module.exports = function (context, pluginService, pluginParam) {
return {
apply() {
return [
{
event: "flow.approval.detail.related.render.before",
functional: async function (context, options) {
let controlArg = options && options.controlArg;
let detailObjects = options && options.detailObjects;
return Promise.resolve({
methods: {
getFieldsStyles() {
// 此方法与下方直接返回的 fieldsStyles 为同一功能不同用法,返回数据与 fieldsStyles 一致
return {
'*': {
column_width: 70,
text_style: 'font-size:10px;line-height:14px;white-space:normal;word-break:break-word;',
max_lines: 0,
// 只追加到 header
header_text_style: 'font-weight:700;',
// 只追加到 body/value
value_text_style: 'color:#545861;'
},
// 字段 api_name
last_modified_time: {
column_width: 100
}
};
}
},
fieldsStyles: {
'*': {
column_width: 70,
text_style: 'font-size:10px;line-height:14px;white-space:normal;word-break:break-word;',
max_lines: 0,
// 只追加到 header
header_text_style: 'font-weight:700;',
// 只追加到 body/value
value_text_style: 'color:#545861;'
},
// 字段 api_name
last_modified_time: {
column_width: 100
}
}
});
}
}
];
}
};
};