二开案例.单据插件.控件可用性(启用/禁用)设置

【应用场景】设置字段,菜单,按钮的状态为启用/禁用。
【案例演示】采购订单主菜单新增【启用】,【禁用】菜单,分别控制单据编号、禁用菜单和按钮的可用性,如下图所示。
启用状态:

禁用状态:

【实现步骤】
<1>扩展采购订单,主菜单新增【启用】(tbEnable),【禁用】(tbDisable),新增按钮【好的】(FBTNOK)。
<2>新增表单插件,代码如下。
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Util;
using System.ComponentModel;
namespace Jac.XkDemo.BOS.Business.PlugIn
{
/// <summary>
/// 【单据插件】控件启用禁用演示
/// </summary>
[Description("【单据插件】控件启用禁用演示"), HotUpdate]
public class EnableDisableBillPlugIn : AbstractBillPlugIn
{
/// <summary>
/// 主菜单点击事件
/// </summary>
/// <param name="e"></param>
public override void BarItemClick(BarItemClickEventArgs e)
{
base.BarItemClick(e);
if (e.BarItemKey == "tbEnable")
{
// 设置菜单可用性
this.View.GetMainBarItem("tbDisable").Enabled = true;
// 设置字段可用性
this.View.GetControl("FBillNo").Enabled = true;
//this.View.StyleManager.SetEnabled("FBillNo", "", true);
// 设置单据体列可用性
this.View.GetControl("FMaterialId").Enabled = true;
// 设置按钮可用性
this.View.GetControl("FBTNOK").Enabled = true;
this.View.ShowMessage("已启用!");
}
if (e.BarItemKey == "tbDisable")
{
this.View.GetMainBarItem("tbDisable").Enabled = false;
this.View.GetControl("FBillNo").Enabled = false;
//this.View.StyleManager.SetEnabled("FBillNo", "", false);
this.View.GetControl("FMaterialId").Enabled = false;
this.View.GetControl("FBTNOK").Enabled = false;
this.View.ShowMessage("已禁用!");
}
}
}
}
Python插件代码如下:
def BarItemClick(e):
if (e.Bar
二开案例.单据插件.控件可用性(启用/禁用)设置
声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。



