this.include是一个方法,当您在流程、门户、内容管理或服务管理中创建了脚本配置,可以使用this.include()用来引用脚本配置。
v8.0及以后版本中增加了服务管理的脚本配置。
Syntax
//您可以在表单、流程、视图和查询视图的各个嵌入脚本中,通过this.include()来引用本应用或其他应用的脚本配置,如下:
this.include( optionsOrName, callback )
Parameters
-
optionsOrName
String
|Object
可以是脚本标识字符串或者是对象。
//如果需要引用其他应用的脚本配置,将options设置为Object; this.include({ //type: 应用类型。可以为 portal process cms service。流程脚本默认为process,服务管理中默认为service type : "portal", application : "首页", // 门户、流程、CMS的名称、别名、id。 引用服务管理的脚本则忽略该参数。 name : "initScript" // 脚本配置的名称、别名或id }); //引用服务管理中的脚本 this.include({ "type": "service", "name": "scriptName" }); //引用流程管理中的脚本 this.include({ "type": "process", "application": "appName", "name": "scriptName" }); //引用内容管理中的脚本 this.include({ "type": "cms", "application": "appName", "name": "scriptName" }); //引用门户管理中的脚本 this.include({ "type": "portal", "application": "appName", "name": "scriptName" });
-
callback
function
<optional>
加载后执行的回调方法。
Examples
//定义一个方法
this.define('getFileSQL',function(){
const application = ['公司发文','部门发文','党委发文'];
const apps = application.map((app)=>{
return `o.applicationName = '${app}'`
});
return `(${apps.join(' OR ')})`;
});
this.include({
type : 'cms',
application : 'fileRes',
name : 'FileSql'
});
const sql = this.getFileSQL();
return `SELECT o FROM com.x.processplatform.core.entity.content.Task o WHERE ${sql}`;