项启用逻辑,项显示逻辑,项空输入逻辑
在绘制部件成员时,可配置逻辑来控制部件成员是否禁用、隐藏、必填。脚本逻辑都是单行脚本模式,即返回一行脚本内容,返回值为boolean值。目前支持这些逻辑的有面板项、表单成员。
参数
名称 | 类型 | 描述 |
---|---|---|
context | IApiContext | 当前视图上下文 |
viewParam | IApiParams | 当前视图参数 |
data | IApiData | 当前业务数据 |
env | IEnvironment | 当前环境对象 |
view | IApiViewController | 当前视图 |
document | Document | 当前文档对象 |
selector | (className: string) => HTMLCollectionOf<Element> | 元素选择器 |
appSession | IApiData | 当前应用会话对象 |
topViewSession | IApiData | 当前顶级视图会话对象 |
viewSession | IApiData | 当前视图会话对象 |
viewParam | IApiParams | |
app | IApiAppHubController | 当前应用 |
topView | IApiViewController | 当前顶级视图 |
parentView | IApiViewController | undefined | 当前父视图 |
parent | IApiViewController | undefined | 当前父视图 |
util | { message: IApiMessageUtil, notification: IApiNotificationUtil,modal: IApiModalUtil,confirm: IApiConfirmUtil,openView: IApiOpenViewUtil} | 工具集 |
ctrl | IApiControlController | undefined | 当前部件 |
调用示例
基于上下文数据判断当前表单成员是否显示
typescript
!context.is_delete;
基于当前数据判断当前表单成员是否必填
typescript
(data.result_state !== 1 && data.result_state !== 2) || (!!data.curstage_id && data.curstage_id == data.stage_id)
基于当前环境数据判断当前表单成员是否禁用
typescript
context.cur_reviewer_id == context.srfuserid &&
context.curstage_state == 20 &&
context.curstage_id == data.stage_id;