处理逻辑
可配置实体处理逻辑为脚本代码模式,脚本中返回一个对象数据。脚本代码表为异步脚本,可用来返回模拟数据,或者在脚本中请求自定义接口数据。
参数
名称 | 类型 | 描述 |
---|---|---|
document | Document | 当前文档对象 |
selector | (className: string) => HTMLCollectionOf<Element> | 元素选择器 |
env | IEnvironment | 当前环境对象 |
appSession | IApiData | 当前应用会话对象 |
context | IApiContext | 当前视图上下文 |
viewParam | IApiParams | 当前视图参数 |
data | IApiData | 当前数据 |
app | IApiAppHubController | 当前应用 |
util | { message: IApiMessageUtil, notification: IApiNotificationUtil,modal: IApiModalUtil,confirm: IApiConfirmUtil,openView: IApiOpenViewUtil} | 工具集 |
调用示例
返回模拟数据
ts
const result = {
age: 18,
name: '张三',
sex: '男',
};
return result;
请求实体自定义接口数据
ts
const res = await app.deService.exec(
'plmweb.work_item_wizard',
'getwizard',
context,
{
size: 1000,
n_dynamodelflag_noteq: 0,
},
);
if (res.ok) {
return res.data;
}
return {};