动态根据业务数据的字段值显示审批同意按钮的文案
动态根据业务数据的字段值显示审批同意按钮的文案
-
mport { ActionType, ActionWidget, DialogViewActionWidget, SPI, ViewActionTarget, Widget } from ‘@kunlun/dependencies’;
@SPI.ClassFactory(ActionWidget.Token({ actionType: ActionType.View, target: ViewActionTarget.Dialog, model: ‘workflow.WorkflowUserTask’, name: ‘workflow_agree’ }))
class WorkflowAgreeDialogViewActionWidget extends DialogViewActionWidget {
@Widget.Reactive()
protected get label(): string {
const nodeContext = this.activeRecords?.[0].nodeContext;
if (nodeContext) {
try {
const nodeInfo = JSON.parse(nodeContext) as any;
if (nodeInfo.status == ‘ACTIVE’) {
return ‘激活状态审批’;
} else if (nodeInfo.status == ‘INACTIVE’) {
return ‘无效状态审批’;
}
} catch (e) {
console.log(e);
}
}
return super.label;
}
}这个是根据业务状态动态展示按钮文字(label),
如果有业务场景是根据业务控制隐藏状态(invisible),道理都是一样的
5个月前