氚云前端代码对控件赋值
一、
先说表单子表,进行自动排序
var parent = this;
//先将对象也就是子表,进行绑定改变事件 this.D000685F044da22ee9b54a669386935b72c2b7a0.BindChange( "Set", function( data ) { debugger; //var i = 1; debugger;
//第一次获取第一行数据,一般新增的时候默认有第一行
//之后的数据每次新增都会进行这个事件,然后获取data来取新增行的id var responseData = data[ 0 ]; // 当前行
//获取行数GetRowsCount() var rowsCount = parent.D000685F044da22ee9b54a669386935b72c2b7a0.GetRowsCount();//获取子表总行数
//获取行id对行进行赋值依据行id进行修改 var currentRowId = responseData.ObjectId; //获取行ID parent.D000685F044da22ee9b54a669386935b72c2b7a0.UpdateRow( currentRowId, { "D000685F044da22ee9b54a669386935b72c2b7a0.seqence": rowsCount }); });
二、
场景,一个表单需要多个部门进行同时操作,单互相不能看到操作数据内容。解决方法,进行子流程,表单与主表单相同,对表单内容进行人员判断,来划分表单权限。
进行身份信息传值(前后端)
后端
if(actionName == "GetCurrentLoginUser") { // string ActivityCode=this.Request.ActivityCode ;fpv1z6maokr2askcyqgl3d940.i_d153103sbw6oiwqre65h03dtqtgksx317 string objectidi = this.Request.BizObject["ObjectId"] + string.Empty;
// 查询表单数据 string fqr = "SELECT * FROM i_D153103Swog8nponsxz1mzbrzfzoctrk1 where ObjectId='" + objectidi + "'"; System.Data.DataTable fqrlc = this.Engine.Query.QueryTable(fqr, null); string dept = ""; if(fqrlc.Rows.Count > 0) {
//获取创建人 dept = fqrlc.Rows[0]["CreatedBy"].ToString(); }
//业务部门验证 string yewu = this.Request.BizObject["F0000171"] + string.Empty; string yewin = ""; if(yewu != "") { yewin = "true"; } // if(yewin=="true") { // this.Request.v // } //bbdfbb8c-69a9-4572-a068-1f00b254cfd4 工程部 //3ac7c1fc-bba1-4051-8b04-684b28cedabf 招投标 //8d03182c-0177-4fdf-be67-207bddc53747 计采部 //6a37c7fd-ae2c-424b-bc8d-fc03914ce2ba 技术部
//进行数据传值到前端
response.ReturnData = new Dictionary<string, object>();//默认response.ReturnData值为null,所以此处需要初始化 response.ReturnData.Add("User", dept);//将当前登录用户的用户Id响应回前端 response.ReturnData.Add("YWin", yewin);// // response.ReturnData.Add("ActivityCode",ActivityCode );//将当前审批节点响应回前端 }
前端,进行判断,来隐藏表单控件内容
debugger; var parent = this; var enviroment = $.SmartForm.ResponseContext; if( !enviroment.IsCreateMode ) { //PostForm请求后端,actionName为"GetCurrentLoginUser" var result = ""; var UserId = ""; var UserName = ""; var UnitId = ""; var ZBI = ""; var ActivityCode = $.SmartForm.ResponseContext.ActivityCode;
//前端PostForm请求后端,后端返回前端的数据组 $.SmartForm.PostForm( "GetCurrentLoginUser", {}, function( data ) { if( data.Errors && data.Errors.length ) { $.IShowError( "错误", JSON.stringify( data.Errors ) );//将后端添加到Errors集合里的异常信息弹出 } else { result = data.ReturnData; ZBI = result[ "User" ]; UnitId = result[ "YWin" ]; } }, function( error ) { $.IShowError( "错误", JSON.stringify( error ) );//将后端未知异常弹出 }, false ); if( UnitId == "true" ) { //计采 this.D153103Fo1rhupuxnhwha22swcf2em293.SetVisible( false ); this.F0000176.SetVisible( false ); this.F0000009.SetVisible( false ); this.F0000087.SetVisible( false ); this.F0000010.SetVisible( false ); this.F0000088.SetVisible( false ); //招投标 this.D153103Fcj35dyg66ppz9et0yhwsumot1.SetVisible( false ); this.F0000175.SetVisible( false ); this.F0000020.SetVisible( false ); this.F0000090.SetVisible( false ); //技术部 this.D153103Fx1mip81ntz2xyxmmpzcqg5m85.SetVisible( false ); this.F0000174.SetVisible( false ); this.F0000046.SetVisible( false ); this.F0000098.SetVisible( false ); //工程 this.D153103Fxeqy6ar7ycgi1ogv8tl0qt557.SetVisible( false ); this.F0000177.SetVisible( false ); this.F0000057.SetVisible( false ); this.F0000100.SetVisible( false ); } //bbdfbb8c-69a9-4572-a068-1f00b254cfd4 工程部a9f1ade6-1c31-41f4-b6e2-cdf283babef4 //3ac7c1fc-bba1-4051-8b04-684b28cedabf 招投标 //8d03182c-0177-4fdf-be67-207bddc53747 计采部e897a0b6-863f-418f-8732-e74568421e3e //6a37c7fd-ae2c-424b-bc8d-fc03914ce2ba 技术部 //工程 if( ZBI == "a9f1ade6-1c31-41f4-b6e2-cdf283babef4" ) { //计采 this.D153103Fo1rhupuxnhwha22swcf2em293.SetVisible( false ); this.F0000176.SetVisible( false ); this.F0000009.SetVisible( false ); this.F0000087.SetVisible( false ); this.F0000010.SetVisible( false ); this.F0000088.SetVisible( false ); //招投标 this.D153103Fcj35dyg66ppz9et0yhwsumot1.SetVisible( false ); this.F0000175.SetVisible( false ); this.F0000020.SetVisible( false ); this.F0000090.SetVisible( false ); //技术部 this.D153103Fx1mip81ntz2xyxmmpzcqg5m85.SetVisible( false ); this.F0000174.SetVisible( false ); this.F0000046.SetVisible( false ); this.F0000098.SetVisible( false ); //业务 this.D153103Frwdov8xcowd1m45qsf1b5e344.SetVisible( false ); this.F0000030.SetVisible( false ); this.F0000173.SetVisible( false ); this.F0000094.SetVisible( false ); this.F0000031.SetVisible( false ); this.F0000092.SetVisible( false ); this.F0000127.SetVisible( false ); this.F0000128.SetVisible( false ); this.F0000153.SetVisible( false ); this.F0000154.SetVisible( false ); this.F0000129.SetVisible( false ); this.F0000148.SetVisible( false ); this.F0000130.SetVisible( false ); this.F0000131.SetVisible( false ); this.F0000156.SetVisible( false ); this.F0000157.SetVisible( false ); this.F0000132.SetVisible( false ); this.F0000133.SetVisible( false ); this.F0000158.SetVisible( false ); this.F0000159.SetVisible( false ); } //招投 if( ZBI == "3ac7c1fc-bba1-4051-8b04-684b28cedabf" ) { //计采 this.D153103Fo1rhupuxnhwha22swcf2em293.SetVisible( false ); this.F0000176.SetVisible( false ); this.F0000009.SetVisible( false ); this.F0000087.SetVisible( false ); this.F0000010.SetVisible( false ); this.F0000088.SetVisible( false ); //技术部 this.D153103Fx1mip81ntz2xyxmmpzcqg5m85.SetVisible( false ); this.F0000174.SetVisible( false ); this.F0000046.SetVisible( false ); this.F0000098.SetVisible( false ); //工程 this.D153103Fxeqy6ar7ycgi1ogv8tl0qt557.SetVisible( false ); this.F0000177.SetVisible( false ); this.F0000057.SetVisible( false ); this.F0000100.SetVisible( false ); //业务 this.D153103Frwdov8xcowd1m45qsf1b5e344.SetVisible( false ); this.F0000173.SetVisible( false ); this.F0000030.SetVisible( false ); this.F0000094.SetVisible( false ); this.F0000031.SetVisible( false ); this.F0000092.SetVisible( false ); this.F0000127.SetVisible( false ); this.F0000128.SetVisible( false ); this.F0000153.SetVisible( false ); this.F0000154.SetVisible( false ); this.F0000129.SetVisible( false ); this.F0000148.SetVisible( false ); this.F0000130.SetVisible( false ); this.F0000131.SetVisible( false ); this.F0000156.SetVisible( false ); this.F0000157.SetVisible( false ); this.F0000132.SetVisible( false ); this.F0000133.SetVisible( false ); this.F0000158.SetVisible( false ); this.F0000159.SetVisible( false ); } //计采 if( ZBI == "8d03182c-0177-4fdf-be67-207bddc53747" || ZBI == "c9c00bd6-e81e-40b7-894b-8b5b004878ec" || ZBI=="e897a0b6-863f-418f-8732-e74568421e3e") { //招投标 this.D153103Fcj35dyg66ppz9et0yhwsumot1.SetVisible( false ); this.F0000175.SetVisible( false ); this.F0000020.SetVisible( false ); this.F0000090.SetVisible( false ); //技术部 this.D153103Fx1mip81ntz2xyxmmpzcqg5m85.SetVisible( false ); this.F0000174.SetVisible( false ); this.F0000046.SetVisible( false ); this.F0000098.SetVisible( false ); //工程 this.D153103Fxeqy6ar7ycgi1ogv8tl0qt557.SetVisible( false ); this.F0000177.SetVisible( false ); this.F0000057.SetVisible( false ); this.F0000100.SetVisible( false ); //业务 this.D153103Frwdov8xcowd1m45qsf1b5e344.SetVisible( false ); this.F0000173.SetVisible( false ); this.F0000030.SetVisible( false ); this.F0000094.SetVisible( false ); this.F0000031.SetVisible( false ); this.F0000092.SetVisible( false ); this.F0000127.SetVisible( false ); this.F0000128.SetVisible( false ); this.F0000153.SetVisible( false ); this.F0000154.SetVisible( false ); this.F0000129.SetVisible( false ); this.F0000148.SetVisible( false ); this.F0000130.SetVisible( false ); this.F0000131.SetVisible( false ); this.F0000156.SetVisible( false ); this.F0000157.SetVisible( false ); this.F0000132.SetVisible( false ); this.F0000133.SetVisible( false ); this.F0000158.SetVisible( false ); this.F0000159.SetVisible( false ); } //技术 if( ZBI == "6a37c7fd-ae2c-424b-bc8d-fc03914ce2ba" ) { //计采 this.D153103Fo1rhupuxnhwha22swcf2em293.SetVisible( false ); this.F0000176.SetVisible( false ); this.F0000009.SetVisible( false ); this.F0000087.SetVisible( false ); this.F0000010.SetVisible( false ); this.F0000088.SetVisible( false ); //招投标 this.D153103Fcj35dyg66ppz9et0yhwsumot1.SetVisible( false ); this.F0000175.SetVisible( false ); this.F0000020.SetVisible( false ); this.F0000090.SetVisible( false ); //工程 this.D153103Fxeqy6ar7ycgi1ogv8tl0qt557.SetVisible( false ); this.F0000177.SetVisible( false ); this.F0000057.SetVisible( false ); this.F0000100.SetVisible( false ); //业务 this.D153103Frwdov8xcowd1m45qsf1b5e344.SetVisible( false ); this.F0000173.SetVisible( false ); this.F0000030.SetVisible( false ); this.F0000094.SetVisible( false ); this.F0000031.SetVisible( false ); this.F0000092.SetVisible( false ); this.F0000127.SetVisible( false ); this.F0000128.SetVisible( false ); this.F0000153.SetVisible( false ); this.F0000154.SetVisible( false ); this.F0000129.SetVisible( false ); this.F0000148.SetVisible( false ); this.F0000130.SetVisible( false ); this.F0000131.SetVisible( false ); this.F0000156.SetVisible( false ); this.F0000157.SetVisible( false ); this.F0000132.SetVisible( false ); this.F0000133.SetVisible( false ); this.F0000158.SetVisible( false ); this.F0000159.SetVisible( false ); } }