移动bos表格字段(报表)相关操作及插件干预原创
金蝶云社区-暗夜
暗夜
9人赞赏了该文章 2224次浏览 未经作者许可,禁止转载编辑于2019年10月29日 17:35:07

需求:点击微信公众号列表,查看该公众号对应的应用,并通过插件干预;
效果图:

image.pngimage.png

公众号列表sql数据源:select fid,fname from t_bas_wxofficialacc
应用列表sql数据源:select fid,fentryid,fagentname from t_bas_wxofficialagent where 1=1

公众号列表点击事件代码示例:

image.png

应用列表根据公众号id进行过滤的代码示例:

image.png

应用列表插件干预数据源结果示例:

image.png


完整代码:

public override void TableFieldRowClick(TableFieldRowClickEventArgs e)

        {

            base.TableFieldRowClick(e);

            if (e.Key.ToUpper().Equals("F_MOB_TABLEFIELD"))

            {

                MobileShowParameter param = new MobileShowParameter();

                param.FormId = "MOB_dbAgg";

                string json = this.Model.GetValue(e.Key).ToString();

                JObject obj = JObject.Parse(json);

                string fid = obj["rows"][e.Row - 1].Last["fid"].ToString();

                param.CustomParams.Add("fid", fid);

                this.View.ShowForm(param, new Action<FormResult>((res) =>

                {

                    this.View.Refresh();

                }));

            }

        }

public override void BeforeLoadReportData(BeforeLoadReportDataEventArgs e)

        {

            base.BeforeLoadReportData(e);

            if (e.Key.ToUpper().Equals("F_MOB_TABLEFIELD2"))

            {

                string fid = this.View.OpenParameter.GetCustomParameter("fid").ToString();

                e.SQL += string.Format(" and fid = {0}", fid);

            }

        }

public override void AfterBindData(EventArgs e)

        {

            base.AfterBindData(e);

            string formId = this.View.OpenParameter.FormId;

            if (formId.ToUpper().Equals("MOB_DBAGG"))

            {

                string json = this.Model.GetValue("F_MOB_TABLEFIELD2").ToString();

                JObject obj = JObject.Parse(json);

                obj["rows"][1].Last["fagentname"] += "666";

                this.Model.SetValue("F_MOB_TABLEFIELD2", obj.ToString());

                this.View.UpdateView("F_MOB_TABLEFIELD2");

            }

           

        }


赞 9