二开案例.列表插件.列表条件格式化之按用户进行格式化

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

二开案例.列表插件.列表条件格式化之按用户进行格式化

【应用场景】按用户进行列表条件格式化。

【案例演示】采购订单列表,不同用户查看时,显示不同的前景色。

【实现步骤】

<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


二开案例.列表插件.列表条件格式化之按用户进行格式化

【应用场景】按用户进行列表条件格式化。【案例演示】采购订单列表,不同用户查看时,显示不同的前景色。【实现步骤】<1>编写列表插件,如...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息