氚云平台通过事件自动给关联表单多选赋值
前端代码
// 加载事件
OnLoad: function() {
var that = this;
//选择指标库时自动带出绩效考核执行数据
this.F0000002.BindChange( "key", function() {
var F0000002 = that.F0000002.GetValue()[ 0 ];
var paramData = { F0000002: F0000002 };
$.SmartForm.PostForm( "getObjectid", paramData,
function( data ) {
var result = data.ReturnData.ListObjectid;
if( result != null ) {
console.log( result );
that.F0000001.SetValue( result ); //关联表单多选赋值
}
},
function( data ) { $.IShowWarn( "出错啦" ); },
false )
})
},
后端代码
if(actionName == "getObjectid")
{
List < string > listObjectid=new List();
H3.IEngine engine = this.Request.Engine;
H3.Data.Filter.Filter filter = new H3.Data.Filter.Filter(); //构建过滤器
H3.Data.Filter.And andMatcher = new H3.Data.Filter.And(); //构造And匹配器
andMatcher.Add(new H3.Data.Filter.ItemMatcher("priority", H3.Data.ComparisonOperatorType.Equal, "普通")); //添加查询条件
filter.Matcher = andMatcher;
H3.DataModel.BizObjectSchema schema = engine.BizObjectManager.GetPublishedSchema("D002052wordTask"); //获取模块Schema
H3.DataModel.BizObject[] boArray = H3.DataModel.BizObject.GetList(engine, H3.Organization.User.SystemUserId,
schema, H3.DataModel.GetListScopeType.GlobalAll, filter); //查询返回的结果对象
if(boArray != null && boArray.Length > 0)
{
for(int i = 0;i < boArray.Length; i++)
{
listObjectid.Add(boArray[i]["ObjectId"] + string.Empty);
}
}
//定义返回的对象
response.ReturnData = new Dictionary();
response.ReturnData.Add("ListObjectid", listObjectid);
}