二开案例.列表插件.列表条件格式化之按用户进行格式化
【应用场景】按用户进行列表条件格式化。
【案例演示】采购订单列表,不同用户查看时,显示不同的前景色。
【实现步骤】
<1>编写列表插件,如下所示。
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Core.List.PlugIn.Args;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Util;
using System.ComponentModel;
namespace Jac.XkDemo.BOS.Business.PlugIn
{
/// <summary>
/// 【列表插件】列表条件格式化之按用户进行格式化
/// </summary>
[HotUpdate]
[Description("【列表插件】列表条件格式化之按用户进行格式化")]
public class FormatRowByUserListPlugIn : AbstractListPlugIn
{
/// <summary>
/// 列表行数据格式化
/// </summary>
/// <param name="args"></param>
public override void OnFormatRowConditions(ListFormatConditionArgs args)
{
base.OnFormatRowConditions(args);
if (this.Context.UserName == "demo")
{
var fc = new FormatCondition();
fc.ApplayRow = true;// 格式化整行
fc.ForeColor = "#FF0000";
args.FormatConditions.Add(fc);
}
else if (this.Context.UserName == "张三")
{
var fc = new FormatCondition();
fc.ApplayRow = true;
fc.ForeColor = "#00FF00";
args.FormatConditions.Add(fc);
}
else if (this.Context.UserName == "李四")
{
var fc = new FormatCondition();
fc.ApplayRow = true;
fc.ForeColor = "#0000FF";
args.FormatConditions.Add(fc);
}
}
}
}
/*
-- 查询用户信息
SELECT * FROM T_SEC_USER
*/
对应Python代码如下所示,坑爹编辑器不支持Python代码排版,请参考截图排版。
/*
#【Python】【列表插件】列表条件格式化之按用户进行格式化
def OnFormatRowConditions(args):
if this.Context.UserName == "demo":
fc = FormatCondition()
fc.ApplayRow = True # 格式化整行
fc.ForeColor = "#FF0000"
args.FormatConditions.Add(fc)
elif this.Context.UserName == "张三":
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#00FF00"
args.FormatConditions.Add(fc)
elif this.Context.UserName == "李四":
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#0000FF"
args.FormatConditions.Add(fc)
*/
<2>拷贝插件组件到应用站点的WebSite\Bin目录下,重启IIS。
<3>BOSIDE扩展采购订单,注册列表插件,保存元数据,开发完毕。
如果使用Python插件,参考如下截图。
现在可以登录业务站点,打开采购订单列表,检验一下插件效果啦。
用户demo显示为红色。
用户张三显示为绿色
【金蝶云星空BOS二次开发案例演示】https://vip.kingdee.com/article/94751030918525696
二开案例.列表插件.列表条件格式化之按用户进行格式化
本文2024-09-23 04:20:54发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-164722.html
- 鼎捷EAI整合規範文件V3.1.07 (集團).pdf
- 鼎捷OpenAPI應用場景說明_基礎資料.pdf
- 鼎捷OpenAPI應用場景說明_財務管理.pdf
- 鼎捷T100 API設計器使用手冊T100 APIDesigner(V1.0).docx
- 鼎新e-GoB2雲端ERP B2 線上課程E6-2應付票據整批郵寄 領取.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程A4使用者建立權限設定.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程C3會計開帳與會計傳票.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程E6-1應付票據.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程A5-1進銷存參數設定(初階篇).pdf
- 鼎新e-GoB2雲端ERP B2 線上課程D2帳款開帳與票據開帳.pdf