[code]
using Kingdee.BOS.Util;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.CommonFilter;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Orm.DataEntity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel;
namespace YEA.K3.MIS.Business.PlugIn.Price
{
[Description("列表插件:基本价格表列表插件")]
public class YealinkPriceListPlugIn : AbstractListPlugIn
{
//初始列的状态
private bool _getState = true;
private bool _refresh = false;
//初始列的状态
List
//遍历需要隐藏的列
List
///
/// 准备过滤参数方法
///
///
public override void PrepareFilterParameter(Kingdee.BOS.Core.List.PlugIn.Args.FilterArgs e)
{
base.PrepareFilterParameter(e); // 获取隐藏列
if (_getState)
{
foreach (ColumnField column in e.ColumnFields)
{ //记录初始状态
fieldMap.Add(column);
}
}
foreach (ColumnField field in fieldMap)
{
if (!e.ColumnFields.Contains(field))
{
e.ColumnFields.Add(field);
}
}
for (int i = e.ColumnFields.Count - 1; i >= 0; i--)
{
var col = e.ColumnFields[i];
if (lstHideColumnFields.Count > 0)
{
foreach (var val in lstHideColumnFields)
{
if (col.RealKey.EqualsIgnoreCase(val))
{
e.ColumnFields.RemoveAt(i);
}
}
}
}
if (!_getState && _refresh)
{
_refresh = false;
this.View.Refresh();
}
}
public override void TreeNodeClick(TreeNodeArgs e)
{
base.TreeNodeClick(e);
string nodeID = e.NodeId;
_getState = false;
lstHideColumnFields.Clear();
// YEA_TreeShowField; //YEA_PriceGroup
string sql = @"/*dialect*/SELECT* FROM YEA_TreeShowField WHERE FtreeType='YEA_PriceGroup' and FtreeNoid='" + nodeID + "'";
DynamicObjectCollection doc = DBUtils.ExecuteDynamicObject(this.Context, sql);
string showfield = "";
if (doc.Count > 0)
{
foreach (DynamicObject dynamicObject in doc)
{
showfield += dynamicObject["Fshowfield"] == null ? "" : dynamicObject["Fshowfield"].ToString() + ",";
}
}
string[] sArray = showfield.Split(',');
sArray = array_unique(sArray);
foreach (var item in sArray)
{
if (!String.IsNullOrWhiteSpace(item.Trim()))
{
lstHideColumnFields.Add(item.Trim());
}
}
_refresh = true;
}
///
/// 移除数组中重复数据
///
/// 需要除重的数组
///
private static T[] array_unique
{
List
for (int i = 0; i < values.Length; i++)//遍历数组成员
{
if (list.IndexOf(values[i]) == -1)//对每个成员做一次新数组查询如果没有相等的则加到新数组
list.Add(values[i]);
}
return list.ToArray();
}
}
}[/code]
点击不同的分组树节点,列表显示不同的关注字段。---需要维护中间过滤表
[password]123456[/password]