您可以在浏览器控制台输入SteedosUI, 然后按回车键查看所有能调用的方法。
弹出表单、表格等。
语法
SteedosUI.showModal(component,componentParams,modalParams, provideProps)
参数
示例1:在合同对象记录详细页右上角添加“新建任务”按钮所需函数代码。
SteedosUI.showModal(stores.ComponentRegistry.components.ObjectForm, {
name: `standard_new_form`, // 表单名称
objectApiName: 'tasks', // 所属对象
title: '新建任务', // 弹窗标题
initialValues: { name: "TEST" } // 初始数据
}, null, {
iconPath: '/assets/icons'
});
示例2:弹出新建客户的表单。
SteedosUI.showModal(stores.ComponentRegistry.components.ObjectForm,{
objectApiName: "accounts",
layout: 'horizontal',
title: `新建客户`,
initialValues: {name:"张三"},
onFinish: async (values)=>{
return true;
}
})
示例3:弹出选择任务的表格。
SteedosUI.showModal(stores.ComponentRegistry.components.ObjectTable,{
title: “选择 任务”,
objectApiName: "tasks",
sort:[{field_name: "state",order: "desc"}],
multiple: true,
onFinish: async (values)=>{
return true;
},
listSchema: {
columns: ["name", "state"]
},
filters: ['name','contains','w']
})
刷新记录页面。
语法
SteedosUI.reloadRecord(objectApiName,recordId)
参数
此函数不直接发送请求,只给object上添加过期标记,每次getObject时 ,如果已标记为过期,则重新获取,获取后清理过期标记。用于解决db中的对象发生变化时的请求过多问题,也可解决编辑对象record时,如果对象变化编辑窗口重新渲染导致数据丢失问题。
语法
SteedosUI.reloadObject(objectApiName)
参数
获取列表中选中项记录。
语法
SteedosUI.getTableSelectedRows(id)
参数
示例1:获取“任务”对象在“所有任务”列表视图下的选中项。
SteedosUI.getTableSelectedRows('listview_tasks_all')
示例2:获取“任务”对象附件子表下的选中项。
SteedosUI.getTableSelectedRows('related_listview_tasks_cms_files_parent')
清除列表中选中项。
语法
SteedosUI.clearTableSelectedRows(id)
参数
加载一个React组件到指定 HTMLElement 内。
语法
SteedosUI.render(component: React.FunctionComponent, componentProps: object, container: HTMLElement)
参数
示例1:以自定义页面组件替换对象列表主界面。
SteedosUI.render(stores.ComponentRegistry.components.Page, { pageId: "test_page" }, $(".slds-template__container")[0]);
示例2:在记录详细界面添加一个子表
let newRelatedList = $(".related-object-tabular").last().after($("<div class='related-object-tabular'></div>"));
SteedosUI.render(stores.ComponentRegistry.components.RecordDetailRelatedList, { objectApiName: "accounts", recordId:'gyvcDFmut4Xcr5ZBt',relatedObjectApiName:"contacts" }, newRelatedList[0]);
刷新列表。
语法
refreshGrid(name)
参数
注:如果代码书写位置作用于当前列表下,参数name可以忽略不写。
示例1:刷新“任务”对象在“所有任务”列表视图下的列表。
refreshGrid('listview_tasks_all')
示例2:刷新“任务”对象附件子表列表。
refreshGrid('related_listview_tasks_cms_files_parent')
您可以在浏览器控制台输入Steedos, 然后按回车键查看所有能调用的方法。
返回绝对IP地址,一般用于发送请求时的URL。
语法
Steedos.absoluteUrl(url)
参数
示例
Steedos.absoluteUrl("/api/v4/" + _object_name)
授权请求,返回请求结果。
语法
Steedos.authRequest(url, options)
参数
示例
修改任务对象中记录ID为 “5HzsGM8jPNDbNai4p” 这条记录的“描述”字段为 “该任务由张三和李四共同完成” 。
Steedos.authRequest(`/api/v4/tasks/5HzsGM8jPNDbNai4p`, { type: 'put', async: false, data: JSON.stringify({description:'该任务由张三和李四共同完成'}) })
是否还在加载中。
语法
Steedos.isLoading()
返回值: true / false 。
是否是安卓应用。
语法
Steedos.isAndroidApp()
返回值: true / false 。
当前操作系统是否是安卓或IOS操作系统。
语法
Steedos.isAndroidOrIOS()
用于判断是否是手机APP。
语法
Steedos.isCordova()
返回值: true / false 。
根据屏幕宽度判断是否是手机模式,包括手机浏览器。
语法
Steedos.isMobile()
返回值: true / false 。
根据屏幕宽度判断是否是PAD模式,包括PAD浏览器。
语法
Steedos.isPad()
返回值:true / false 。
当前浏览器是否是IE浏览器。
语法
Steedos.isIE()
返回值:true / false 。
当前系统是否是Mac系统。
语法
Steedos.isMac()
返回值:true / false 。
当前用户是否是组织管理员。
语法
Steedos.isOrgAdmin()
返回值:true / false 。
当前用户是否是工作区管理员。
语法
Steedos.isSpaceAdmin()
返回值:true / false 。
当前用户是否是工作区拥有者。
语法
Steedos.isSpaceOwner()
返回值:true / false 。
获取当前工作区ID。
语法
Steedos.getSpaceId()
获取当前用户ID。
语法
Steedos.userId() / Steedos.getUserId()
获取当前用户名称。
语法
Steedos.userName()
获取当前用户语言。
语法
Steedos.getLocale()
退出系统,退回到登录界面。
语法
Steedos.logout()
新窗口打开指定URL。
语法
Steedos.openWindow(url)
您可以在浏览器控制台输入Creator, 然后按回车键查看所有能调用的方法。
获取对象的Schema定义。
语法
Creator.getObject(objectApiName)
参数
获取指定应用程序属性。
语法
Creator.getApp(app_id)
参数
获取当前应用程序名称。
语法
Creator.getAppLabel()
获取当前应用程序下所有菜单。
语法
Creator.getAppMenus()
获取对象记录信息。
语法
Creator.getObjectRecord(objectApiName, record_id, select_fields, expand)
参数
获取当前用户某个对象权限计算结果。
语法
Creator.getObjectSchema(object_name)
参数
获取对象记录相对URL。
语法
Creator.getObjectUrl(objectApiName, recordId, "-")
参数
获取对象记录绝对URL。
语法
Creator.getObjectAbsoluteUrl(objectApiName, recordId, "-")
参数
获取当前用户有权限看到某个对象下哪些视图。
语法
Creator.getListView(objectApiName, list_view_id, exac)
参数
获取当前用户有权限看到某个对象下的相关对象集合,返回结果为键值队对象元素的数组。
语法
Creator.getRelatedObjects(objectApiName)
参数
获取当前用户有权限看到某个对象下的相关对象名称集合,返回结果为字符串数组。
语法
Creator.getRelatedObjectNames(objectApiName)
参数
获取某个对象的相关对象信息集合,与用户权限无关,返回结果为键值队对象元素的数组。
语法
Creator.getObjectRelateds(objectApiName)
参数
获取当前用户在当前工作区中要权限访问的应用集合。
语法
Creator.getVisibleApps()
表单组件。
属性
objectApiName?: string, // 对象API名称
fields?: [string], // 字段
objectSchema?: any, // 对象schema属性,包括字段等。
initialValues?: any, // 初始数据
recordId?: string // 记录ID
submitter?: any,
isModalForm?: boolean,
isDrawerForm?: boolean,
trigger?: any // 触发器
afterUpdate?: Function, // 记录更新后执行的函数
afterInsert?: Function, // 记录新建后执行的函数
visible?: boolean, // 是否显示
layout?: string, // 表单布局
form?: any, // 经 Form.useForm() 创建的 form 控制实例,不提供时会自动创建
onFinish: Function, // 提交表单且数据验证成功后回调事件
表格组件。
属性
title: string, // 弹窗标题
objectApiName: string, // 对象API名称
listName: string, // 列表视图名称
sort: array, // 排序
columnFields: array, // 显示的列字段
filters: string / array,// 过滤条件
listSchema: object, // 显示的列字段
multiple: boolean, // 多选
onFinish: Function, // 提交表单且数据验证成功后回调事件