二开案例.单据插件.单据体行删除后,保留过滤条件原创
76人赞赏了该文章
304次浏览
编辑于2024年04月08日 19:47:11
单据体快速过滤后删除行会清空,可以在单据上注册表单插件,实现删除行后保留过滤条件。
using Kingdee.BOS.Core.DynamicForm.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel; using Kingdee.BOS.JSON; using Kingdee.BOS.Util; using System.Collections.Generic; namespace Test24.PlugIns.BL { [Kingdee.BOS.Util.HotUpdate] public class KeepEntityFilterPlugIn : AbstractDynamicFormPlugIn { Dictionary<string, string> filterStrings = new Dictionary<string, string> { }; public override void CustomEvents(CustomEventsArgs e) { if (e.EventName == "FilterChanged") { var dict = JsonUtil.DeserializeObject<Dictionary<string, object>>(e.EventArgs); var filterString = dict["FilterString"].ToString(); filterStrings[e.Key.ToUpper()] = filterString; } else if (e.EventName == "RecoverFilterString") { EntryGrid grid = this.View.GetControl(e.Key.ToUpper()) as EntryGrid; var dict = JsonUtil.DeserializeObject<Dictionary<string, object>>(e.EventArgs); var filterString = dict["FilterString"].ToString(); grid.SetFilterString(filterString); } } public override void AfterDeleteRow(AfterDeleteRowEventArgs e) { if (!filterStrings.ContainsKey(e.EntityKey.ToUpper())) return; var para = new JSONObject(); para["key"] = e.EntityKey.ToUpper(); // 自定义事件标识 para["eventName"] = "RecoverFilterString"; // 要触发的事件名称 para["delay"] = "50"; // 延迟触发间隔(单位毫秒) var data = new JSONObject(); data["FilterString"] = filterStrings[e.EntityKey.ToUpper()]; para["data"] = data; // 自定义事件携带的数据包 this.View.AddAction("fireCustomRequest", para); } } }
推荐阅读