动态根据业务数据的字段值显示审批同意按钮的文案

shao 使用操作 317

动态根据业务数据的字段值显示审批同意按钮的文案

回复

共1条回复 我来回复
  • shao的头像
    shao
    数式Oinone (oinone.top),专注解决复杂场景的开源低代码平台
    评论

    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个月前 0条评论