自建轻应用开发最佳实践(V7.6及以上版本):
https://vip.kingdee.com/article/93738290431751424
【简介】
本教程介绍如何开发移动列表过滤表单。
阅读本教程前,您需要了解的知识:
移动的基础知识
BOS表单设计
BOS插件开发
【过滤界面设计】
1、新增并设计列表过滤表单
如何新增设置表单请参考 —》【移动BOS开发 -- 移动表单】
【过滤界面插件】
using Kingdee.BOS.Mobile.PlugIn;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kingdee.BOS.Util;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Orm.DataEntity;
namespace LKD.MobileDemoPlugins
{
public class POFilterEdit : AbstractMobilePlugin
{
//用于向移动单据列表传达过滤条件
private FilterData _filterData = new FilterData();
public override void ButtonClick(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.ButtonClickEventArgs e)
{
if (e.Key == "FOK")
{
if (this.Model.GetValue("FBillNo") != null)
{
_filterData.BillNo = this.Model.GetValue("FBillNo").ToString();
}
if (this.Model.GetValue("FDocumentStatus") != null)
{
_filterData.DocumentStatus = this.Model.GetValue("FDocumentStatus").ToString();
}
if (this.Model.GetValue("FPurchaseOrgId") != null)
{
_filterData.PurchaseOrgId = Convert.ToInt32(((DynamicObject)this.Model.GetValue("FPurchaseOrgId"))["Id"]);
}
if (this.Model.GetValue("FSupplierId") != null)
{
_filterData.SupplierId = Convert.ToInt32(((DynamicObject)this.Model.GetValue("FSupplierId"))["Id"]);
}
//把过滤条件返回移动单据列表界面,并关闭当前过滤界面
FormResult formResult = new FormResult(_filterData);
this.View.ReturnToParentWindow(formResult);
this.View.Close();
}
else if (e.Key == "FClose")
{
this.View.Close();
}
}
}
}
【单据列表界面设计】
【单据列表插件】
using Kingdee.BOS.Mobile.PlugIn;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kingdee.BOS.Util;
using Kingdee.BOS.Mobile;
namespace LKD.MobileDemoPlugins
{
public class POBillTestList : AbstractMobileListPlugin
{
//用于接收从过滤界面返回的过滤条件
private FilterData _filterData = null;
public override void PrepareFilterParameter(Kingdee.BOS.Core.List.PlugIn.Args.FilterArgs e)
{
//设置过滤条件
if (_filterData != null)
{
if (!string.IsNullOrWhiteSpace(_filterData.BillNo))
{
e.AppendQueryFilter(string.Format("FBillNo like '%{0}%'", _filterData.BillNo));
}
if (!string.IsNullOrWhiteSpace(_filterData.DocumentStatus))
{
e.AppendQueryFilter(string.Format("FDocumentStatus = '{0}'", _filterData.DocumentStatus));
}
if (_filterData.PurchaseOrgId > 0)
{
e.AppendQueryFilter(string.Format("FPurchaseOrgId = {0}", _filterData.PurchaseOrgId));
}
if (_filterData.SupplierId > 0)
{
e.AppendQueryFilter(string.Format("FSupplierId = {0}", _filterData.SupplierId));
}
}
//设置列表排序字段
e.AppendQueryOrderby("FFBillNo ASC,FOrgId ASC,FDate DESC");
}
public override void ButtonClick(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.ButtonClickEventArgs e)
{
if (e.key.EqualsIgnoreCase("FFilter"))
{
MobileShowParameter param = new MobileShowParameter();
param.FormId = "LKD_MOB_POFilter";
param.OpenStyle.ShowType = Kingdee.BOS.Core.DynamicForm.ShowType.Floating; //浮动弹出窗
param.SyncCallBackAction = false;
this.View.ShowForm(param, new Action<Kingdee.BOS.Core.DynamicForm.FormResult>((res) =>
{
if (res.ReturnData == null)
{
return;
}
_filterData = res.ReturnData as FilterData; //接收从过滤界面返回的过滤条件
this.View.Refresh(); //刷新列表,重新加载数据过滤条件才生效
}));
}
}
}
【过滤条件类】
/// <summary>
/// 自定义一个过滤条件类,用于单据列表和过滤界面之间传递过滤条件的值
/// </summary>
public class FilterData
{
public string BillNo { get; set; }
public string DocumentStatus { get; set; }
public int PurchaseOrgId { get; set; }
public int SupplierId { get; set; }
}
【其它参考】
推荐阅读