SQL账表.二开案例.打开SQL账表时修改关键字默认值

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

SQL账表.二开案例.打开SQL账表时修改关键字默认值

【场景】打开SQL账表时修改关键字默认值,如日期为这个月的第一天 【案例】 (0)增加SQL账表,复制 平台的过滤表单 ![image.webp](/download/0100eb7fc2c0fdca478bb6dcf4f8cbd69740.webp) (1)过滤表单二开表单插件 ![image.webp](/download/01007a75d5abb23048219e554f91d3c3c6e0.webp) ```csharp using Kingdee.BOS.Core.Bill.PlugIn; using Kingdee.BOS.Core.CommonFilter; using Kingdee.BOS.Core.CommonFilter.PlugIn; using Kingdee.BOS.Core.DynamicForm; using Kingdee.BOS.Core.DynamicForm.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel; using Kingdee.BOS.Core.ReportFilter; using Kingdee.BOS.JSON; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Util; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DynamicFormPlugIn.Report { [Kingdee.BOS.Util.HotUpdate] public class ReportFilterPlugIn_DefaultKeyWord : AbstractCommonFilterPlugIn { JSONArray SQLKeyWord = null; public override void OnInitialize(InitializeEventArgs e) { /* * 初始化关键字逻辑 */ JSONArray keyWordMap = new JSONArray(); JSONObject materialNumberPara = new JSONObject(); materialNumberPara.Add("KeyWord", "#mydate#"); materialNumberPara.Add("Caption", "我的日期"); materialNumberPara.Add("Value", DateTime.Now.AddDays(1 - DateTime.Now.Day).ToString("yyyy-MM-dd")); materialNumberPara.Add("IsTitle", false); keyWordMap.Add(materialNumberPara); SQLKeyWord = keyWordMap; } /* * 将关键字加载到第一次点击的方案中(也就是默认方案),切换保存的方案不受影响 */ //public override void AfterBindData(EventArgs e) //{ // base.AfterBindData(e); // if (SQLKeyWord == null) // return; // ISQLReportFilterModelService modelService = View.Model as ISQLReportFilterModelService; // if (modelService == null) // return; // ((SQLFilterSchemeEntity)modelService.SchemeEntity).SQLFilterSetting = SQLKeyWord.ToString(); // modelService.SQLFilterObject.Setting = ((SQLFilterSchemeEntity)modelService.SchemeEntity).SQLFilterSetting; // ICommonFilterView filterView = View as ICommonFilterView; // //是否自动提交过滤方案 // //filterView.SubmitQuery(null); // //this.View.UpdateView("FSQLFilterPanel"); //} private string firstNodeId = null; /// <summary> /// 将值赋值到第一个加载的方案中 /// </summary> /// <param name="e"></param> public override void TreeNodeClick(TreeNodeArgs e) { base.TreeNodeClick(e); if(firstNodeId == null) { firstNodeId = e.NodeId; } else { if (firstNodeId != e.NodeId) return; } ISQLReportFilterModelService modelService = View.Model as ISQLReportFilterModelService; if (modelService == null) return; var filterGrid = this.View.GetControl<FilterGrid>("FSQLFILTERPANEL"); filterGrid.SetFilterRows(SQLKeyWord); } } } ``` (2)将过滤表单和SQL账表关联 ![image.webp](/download/01007efb153a8316469f854a0ee0ce5818c3.webp) 【效果】 调整默认值从今天改为这个月第一天 ![20231017 1849.webp](/download/0100fadabef0a5a94fa1a51b4fde59ab1ca4.webp)

SQL账表.二开案例.打开SQL账表时修改关键字默认值

【场景】打开SQL账表时修改关键字默认值,如日期为这个月的第一天【案例】(0)增加SQL账表,复制 平台的过滤表单![image.webp](/download/0...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息