氚云--进行控件赋值,页面跳转,弹出新增数据界面框
一、前端数据赋值
场景:进行判断风险等级,单选框自动选中对应等级颜色。解决:先创建一个单行文本进行判断等级颜色,之后前端赋值给单选框
debugger; var parent = this; var enviroment = $.SmartForm.ResponseContext; //获取当前对象环境变量 parent.F0000055.BindChange( "ssg", function() { debugger; parent.F0000025.SetValue( parent.F0000055.GetValue() );//风险评价 _风险等级 }) parent.F0000054.BindChange( "ssg2", function() { debugger; parent.F0000052.SetValue( parent.F0000054.GetValue() );//实施后评估 _风险等级 })
二、跳转页面
场景:用户不想重新打开另一个表单,想直接点击页面按钮进行到达另一个表单进行数据操作。A页面点击按钮跳转到B页面
解决:在数据页面详情中新增跳转按钮,进行页面跳转,以及相关数据传输。
A页面表单设计后端代码新增按钮
protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response) { base.OnLoad(response); string ob = this.Request.BizObject["ObjectId"] + string.Empty;//获取id string str = "SELECT * FROM i_表单编码 where ObjectId='" + ob + "'";//查询表单对应id数据 System.Data.DataTable chah = this.Engine.Query.QueryTable(str, null); for(int i = 0;i < chah.Rows.Count; i++) { string stat = chah.Rows[i]["Status"] + string.Empty;//数据状态 if(!this.Request.IsCreateMode && stat == "1")//是否创建成功 { Dictionary < string, H3.SmartForm.ViewAction > dicActions = new Dictionary<string, H3.SmartForm.ViewAction>(); //重新添加按钮,并修改显示名称 dicActions.Add("GJAY", new H3.SmartForm.ViewAction("CGRK", "采购入库", "icon-hr_transfer_position"));//新增按钮 foreach(KeyValuePair < string, H3.SmartForm.ViewAction > action in response.Actions) dicActions.Add(action.Key, action.Value); response.Actions = new Dictionary<string, H3.SmartForm.ViewAction>(); response.Actions = dicActions; } } }
A页面表单设计前端代码
// 提交后事件 AfterSubmit:function(action, responseValue){ if( action == "CGRK" ) { debugger; // var enviroment = $.SmartForm.ResponseContext; var ObjectId3 = $.SmartForm.ResponseContext.BizObjectId;//数据id // var ObjectId ="1"; //var gongxu=""; var params = { ObjectId3: ObjectId3, schemaCode: "跳转页面的页面编码", qdtype: "采购入库" };//传递参数D000685ysqiandao $.IShowForm( "跳转页面的页面编码", "", params, false ); // $.IShowForm( "D000685ysqiandao", "", params, false, false, { // showInModal: true, title: "批量调整日程", height:10000, width:10000, onHiddenCallback: function( data ) { // } // }); responseValue.ClosePage = false;//阻止页面关闭 responseValue.Refresh = false; //阻止页面刷新 } }
B页面表单设计前端代码
OnLoad:function(){
//赋值与判断:两个页面对同一个页面需要进行跳转操作 var parent = this; var enviroment = $.SmartForm.ResponseContext; //获取当前对象环境变量 var ObjectId002 = $.IGetParams( "ObjectId2" );//获取由$.IShowForm第三个参数传递的Key对应的值. debugger; if( ObjectId002 != "" ) { if( ObjectId002 != undefined ) { parent.F0000031.SetValue( "线下采购订单入库" ); parent.F0000002.SetValue( ObjectId002 );//日程计划F0000012 } } var ObjectId003 = $.IGetParams( "ObjectId3" ); if( ObjectId003 != "" ) { if( ObjectId003 != undefined ) { parent.F0000031.SetValue( "网购订单入库" ); parent.F0000034.SetValue( ObjectId003 );//日程计划F0000012 } } }
三、弹出新增数据界面
场景:用户需要在A页面需要多选数据,带入到另一个B页面子表中,且需要在A页面进行操作,省去到B页面进行数据筛选。
解决:在列表设计前端代码进行获取选中数据,带入到B页面子表
A页面列表设计前端代码
if( actionCode == "ZRBMAP" ) { var objects = $.ListView.GetSelected(); if( objects == null || objects == undefined || objects == "" ) { $.IShowWarn( "您还未勾选,请勾选!" ); return; } var str = ""; for( var i = 0;i < objects.length;i++ ) { str += objects[ i ].ObjectId + ","; } var objects2 = $.ListView.GetSelected;//获取选中数据 debugger; var params = { SeasonObjectiveID: str.substr( 0, str.length - 1 ), schemaCode: "跳转表编码", czType: "移交", objects2: str }; $.IShowForm( "跳转表编码", "", params, false, false, { showInModal: true, title: "责任部门安排", height: 700, width: 1200, onHiddenCallback: function( data ) { } }); }
B页面表单设计前端代码
OnLoad: function() { debugger; var enviroment = $.SmartForm.ResponseContext; //获取当前对象环境变量 if( enviroment.IsCreateMode ) { var parent = this; debugger; var objectId = $.IGetParams( "objects2" ); // this.StorageCheckID.SetValue( objectId ); objectIdArr = objectId.split( "," );// 在每个逗号(,)处进行分解 ["aaa", "bbb", "ccc"] // else { var controlManager = this.子表编码;//获取子表控件对象 controlManager.ClearRows(); //清除子表中的所有行 var n = objectIdArr.length; for( var i = 0;i < objectIdArr.length - 1;i++ ) { debugger; var subObjectId = $.IGuid(); //创建行ID var subObject = i; // var A=objectId[i].objectId; var A = objectIdArr[ i ]; controlManager.AddRow( subObjectId, { //给子表添加行 "子表.子表关联控件编码": ( objectIdArr[ i ] ),// //D000685CheckStorageDetail.StorageQty }); } }