如何判断点击表单菜单中的按钮后所执行的操作
1,373次浏览
编辑于2015年09月19日 18:10:03
在BOS Cloud的单据中,单据的菜单工具条的下拉式按中下面可以有几个按钮。在实际操作中,按下工具条中的下拉按钮,它会自动判断应该执行它下面的哪个按钮所要执行的点击事件。而在表单的插件开发中,用户会通过重写 AfterBarItemClick事件实现扩展功能,但如果是按下工具条下的下接按钮,我不知道如何判断它所执行的是它下面的哪个按钮的事件。
下面附部门源代码:
public override void AfterBarItemClick(AfterBarItemClickEventArgs e)
{
base.AfterBarItemClick(e);
string buttonkey = e.BarItemKey.ToString();
if (buttonkey == "tbSave" || buttonkey == "tbSaveTemp" || buttonkey == "tbSubmit" || buttonkey == "tbCancelAssign" || buttonkey == "tbApprove" || buttonkey == "tbReject" || buttonkey == "tbCancel" || buttonkey == "tbDelete" || buttonkey == "tbPush")
{
string djlx = this.View.BusinessInfo.GetForm().ToString();
string billno = "";
try
{
billno =this.View.Model.GetValue("FBillNo").ToString();
}
catch { }
string date = this.View.Model.GetValue("FDate").ToString();
DynamicObject objdept = (DynamicObject)this.View.Model.GetValue("F_AJL_DEPT");
string deptname = objdept["Name"].ToString();
objdept = (DynamicObject)this.View.Model.GetValue("F_AJL_Storeid");
string custname = objdept["Name"].ToString();
string createdate = this.View.Model.GetValue("FCreateDate").ToString();
objdept = (DynamicObject)this.View.Model.GetValue("F_AJL_EMPID");
string jsr = objdept["Name"].ToString();
string materialid = "0", qty = "0", pgdh = "", unitid = "0", billstatus = "", sql = "";
string operationtype = this.View.OpenParameter.Status.ToString().ToUpper();
StringBuilder stringBuilder = new StringBuilder();
Entity entity = this.View.BusinessInfo.GetEntryEntity("FEntity");
DynamicObjectCollection entitydata = this.View.Model.GetEntityDataObject(entity);
switch (e.BarItemKey.ToString())
{
case "tbSave":
//todo //
break;
case "tbSubmit":
//todo
break;
default:
break;
}
}
下面附部门源代码:
public override void AfterBarItemClick(AfterBarItemClickEventArgs e)
{
base.AfterBarItemClick(e);
string buttonkey = e.BarItemKey.ToString();
if (buttonkey == "tbSave" || buttonkey == "tbSaveTemp" || buttonkey == "tbSubmit" || buttonkey == "tbCancelAssign" || buttonkey == "tbApprove" || buttonkey == "tbReject" || buttonkey == "tbCancel" || buttonkey == "tbDelete" || buttonkey == "tbPush")
{
string djlx = this.View.BusinessInfo.GetForm().ToString();
string billno = "";
try
{
billno =this.View.Model.GetValue("FBillNo").ToString();
}
catch { }
string date = this.View.Model.GetValue("FDate").ToString();
DynamicObject objdept = (DynamicObject)this.View.Model.GetValue("F_AJL_DEPT");
string deptname = objdept["Name"].ToString();
objdept = (DynamicObject)this.View.Model.GetValue("F_AJL_Storeid");
string custname = objdept["Name"].ToString();
string createdate = this.View.Model.GetValue("FCreateDate").ToString();
objdept = (DynamicObject)this.View.Model.GetValue("F_AJL_EMPID");
string jsr = objdept["Name"].ToString();
string materialid = "0", qty = "0", pgdh = "", unitid = "0", billstatus = "", sql = "";
string operationtype = this.View.OpenParameter.Status.ToString().ToUpper();
StringBuilder stringBuilder = new StringBuilder();
Entity entity = this.View.BusinessInfo.GetEntryEntity("FEntity");
DynamicObjectCollection entitydata = this.View.Model.GetEntityDataObject(entity);
switch (e.BarItemKey.ToString())
{
case "tbSave":
//todo //
break;
case "tbSubmit":
//todo
break;
default:
break;
}
}
推荐阅读