【二开插件】插件隐藏过滤方案原创
4人赞赏了该文章
380次浏览
编辑于2024年01月18日 17:17:58
单据有三个过滤方案,希望强制删除过滤方案“aa”,可二开插件实现,实现步骤如下:
1、二开插件代码
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.List.PlugIn; using Kingdee.BOS.Core.List.PlugIn.Args; using Kingdee.BOS.Core.ListFilter; using Kingdee.BOS.Util; using System; using System.Linq; namespace TestPlugin { /// <summary> /// 此插件注册到 “列表过滤(带组织)”(BOS_OrgIsolationFilter) /// </summary> [HotUpdate] public class MyListFilterPlugIn : AbstractListFilterPlugIn { public override void FireBeforeBindFilterMetadata(EventArgs e) { var listFilterModel = this.Model as Kingdee.BOS.Model.ListFilter.ListFilterModel; var schemeList = listFilterModel.GetAllSchemeList(); var removeSchemes = schemeList.Where(r => r.SchemeName == "aa").ToList(); removeSchemes.ForEach(r => schemeList.Remove(r)); } public override void ButtonClick(ButtonClickEventArgs e) { base.ButtonClick(e); } } /// <summary> /// 此插件注册到 “业务单据模板”(BOS_BusinessBillModel) /// </summary> [HotUpdate] public class MyListPlugIn : AbstractListPlugIn { public override void PrepareFilterParameter(FilterArgs e) { var field = this.ListModel.GetType().GetProperty("ListFilterModel", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); var listFilterModel = field.GetValue(this.ListModel) as Kingdee.BOS.Model.ListFilter.ListFilterModel; var schemeList = listFilterModel.GetAllSchemeList(); var removeSchemes = schemeList.Where(r => r.SchemeName == "aa").ToList(); removeSchemes.ForEach(r => schemeList.Remove(r)); } } }
2、扩展单据 【列表过滤(带组织)】(BOS_OrgIsolationFilter),注册二开插件
3、扩展单据“业务单据模板”(BOS_BusinessBillModel),注册二开插件
4、运行效果如下图:
赞 4
4人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!