标签:下级 string H3 response 栗子 var Organization empList 页面
前端代码 // 加载事件 onl oad: function() { if( !$.SmartForm.ResponseContext.IsCreateMode ) { return; } var that = this; var par = { a: 1 }; var success = function( res ) { if( res.Successful == true ) { var rd = res.ReturnData; if( rd == null || rd.length == 0 ) { $.IShowWarn( "没找到数据!" ); return; } var mx = that.D101303Fe4bca544e60546798cedc16678f7c8f5;//获取子表控件 mx.ClearRows(); //清空子表所有数据 var empList = rd.empList; if( empList == null || empList.length == 0 ) { $.IShowWarn( "没找到数据!" ); return; } for( var i = 0;i < empList.length;i++ ) { var subObjectId = $.IGuid(); var subObject = empList[ i ].ValueTable; mx.AddRow( subObjectId, { "D101303Fe4bca544e60546798cedc16678f7c8f5.F0000003": subObject[ "F0000003" ] });// 添加子表行 } } } var error = function( err ) { $.IShowError( "错误", JSON.stringify( err ) ); } $.SmartForm.PostForm( "GetChildEmp", par, success, error, false ); },View Code
后端代码
protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response) { if(actionName == "GetChildEmp") { if(this.Request.BizObject.Status == H3.DataModel.BizObjectStatus.Draft) { response.ReturnData = new Dictionary<string, object>(); string userid = this.Request.UserContext.UserId; H3.Organization.User user = (H3.Organization.User) this.Engine.Organization.GetUnit(userid); string[] pIds = user.ParentIds; string[] userIds = this.Request.Engine.Organization.GetChildren(pIds[0], H3.Organization.UnitType.User, true, H3.Organization.State.Active); if(userIds == null || userIds.Length == 0) { response.Errors.Add("未找到当前子级人员"); return; } List < H3.Data.Serialization.VirtualObject > virtualList = new List<H3.Data.Serialization.VirtualObject>(); foreach(string id in userIds) { H3.Data.Serialization.VirtualObject vobject = new H3.Data.Serialization.VirtualObject(); //string name = (string) this.Engine.Organization.GetName(id, H3.Organization.NameType.Name); vobject.ValueTable["F0000003"] = id; virtualList.Add(vobject); } response.ReturnData.Add("empList", virtualList); } } else { } base.OnSubmit(actionName, postValue, response); }View Code
标签:下级,string,H3,response,栗子,var,Organization,empList,页面 来源: https://www.cnblogs.com/miaololi/p/15242119.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。