表单
更新时间: 2024-10-21 浏览次数: {{ hits }}

表单按钮

修改/增加表单按钮,初始化加载按钮。

示例:

protected override void   OnLoad(H3.SmartForm.LoadSmartFormResponse response)

{

base.OnLoad(response);

response.Actions.Remove("Save");  //删除按钮

                response.Actions.Remove("Submit");

                  response.Actions.Remove("Remove");

                Dictionary   < string, H3.SmartForm.ViewAction > dicActions = new   Dictionary<string, H3.SmartForm.ViewAction>();

                //重新添加按钮,并修改显示名称

                dicActions.Add("Submit", new   H3.SmartForm.ViewAction("Submit", "一键初始化",   ""));

                  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;

}

 

当前表单的对象数据、表单模式等环境变量。

示例:

H3.IEngine engine= this.Request.Engine; //获取当前企业Engine对象;

bool isMobile =this.Request.IsMobile; //判断当前是否移动端;

bool isCreateMode=this.Request.IsCreateMode; //判断当前是否创建模式;

H3.DataModel.BizObject currentObject = this.Request.BizObject;//获取当前表单对象;

H3.Workflow.Template.WorkflowTemplate wfTemplate = this.Request.WorkflowTemplate; //获取当前流程模板;

H3.Organization.User currenUser= this.Request.UserContext.User;   //获取当前用户

H3.DataModel.BizObjectStatus dd =  this.Request.BizObject.Status;//获取当前表单状态(生效、草稿、进行中、作废)

string ActivityCode =  this.Request.ActivityCode; //获取当前活动节点编码

 

设置字段权限

示例:

protected override void   OnLoad(H3.SmartForm.LoadSmartFormResponse response)

{

base.OnLoad(response);

response.ReturnData["F0000001"].Visible   = false; //设置字段不可见

 response.ReturnData["F0000002"].Editable =   false;//设置字段不可写

}

 

表单打开时获取、设置控件名称

示例:

protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response)

{

base.OnLoad(response);

string title = response.ReturnData["F0000004"].DisplayName + string.Empty;//获取F0000004控件的显示名称

response.ReturnData["F0000001"].DisplayName = "haha";//设置F0000004控件的显示名称

}

 


表单操作的返回结果response

示例:

response.ClosePage = false;//阻止页面关闭

response.Refresh = false;//阻止页面刷新

response.ReturnData //返回的数据

response.Errors.Add("错误信息"); //弹出报错窗口

response.Message = "消息内容"; //弹出成功消息