SVN-Revision: r520
This commit is contained in:
cyf
2025-04-30 07:35:51 +00:00
parent bb42a3f72e
commit b8a87d33ad
8 changed files with 190 additions and 55 deletions
@@ -24,6 +24,7 @@ using Lskj.Control.Model;
using System.Threading;
using Lskj.Util;
using System.Text.RegularExpressions;
using Lskj.Business;
namespace Lskj.Control
{
@@ -116,6 +117,12 @@ namespace Lskj.Control
/// 是否执行刷新
/// </summary>
public bool isRefresh = false;
/// <summary>
/// 完整数据源(输入框为空时查询出来的数据源)
/// </summary>
public DataTable CompleteData;
/// <summary>
/// 隐藏值
/// </summary>
@@ -457,10 +464,47 @@ namespace Lskj.Control
}
else
{
bool result = !string.IsNullOrEmpty(searchText);
if (result == isRefresh&& string.IsNullOrEmpty(searchText)) return;//连续2次都是空值,就不执行
isRefresh = !string.IsNullOrEmpty(searchText);
// 数据库搜索
string sqlValue = string.Format("select * from ({0}\r\n) temp where {1} like '%{3}%' or {2} like '%{3}%' or dbo.P_getpy({2}) like '%{3}%'", string.IsNullOrEmpty(sourceParamSql) ? SourceSQL : sourceParamSql, ValueField, TextMember, searchText);
this.DataSource = MainImpl.GetDataTableResult(sqlValue);
if (!string.IsNullOrWhiteSpace(searchText)&& SystemInfo.Instance.TreeNodeBoxSpecialDisplay)
{
sqlValue= string.Format(@"select * from ({0} ) t1 where ({1} like '%{3}%' or {2} like '%{3}%' or dbo.P_getpy({2}) like '%{3}%')
and NOT EXISTS(
SELECT 1 FROM ({0} ) t2 where t2.{1} LIKE t1.{1} + '%' AND t2.{1} <> t1.{1})", string.IsNullOrEmpty(sourceParamSql) ? SourceSQL : sourceParamSql, ValueField, TextMember, searchText);
this.DataSource = MainImpl.GetDataTableResult(sqlValue);
//DataTable dataTable = MainImpl.GetDataTableResult(sqlValue);
//if (string.IsNullOrWhiteSpace(searchText))
//{
// this.CompleteData = dataTable;
//}
//if (this.CompleteData == null)
//{
// this.CompleteData = MainImpl.GetDataTableResult(string.IsNullOrEmpty(sourceParamSql) ? SourceSQL : sourceParamSql);
//}
//DataTable dataTableNew = dataTable.Clone();
//foreach (DataRow item in dataTable.Rows)
//{
// string node = item[ValueField] + "";
// if (this.CompleteData.Select(ValueField + " like '" + node + "%'").Length == 1)
// {
// dataTableNew.ImportRow(item);
// }
//}
//this.DataSource = dataTableNew;
}
else
{
//if (SystemInfo.Instance.TreeNodeBoxSpecialDisplay) this.DataSource = dataTable;
this.DataSource = MainImpl.GetDataTableResult(sqlValue);
}
}
}
/// <summary>
@@ -576,8 +620,9 @@ namespace Lskj.Control
}
}
//_popup.TreeViewObj.Focus();//给了焦点后就不能在文本框中做搜索或者删除操作了
}
_popup.TreeViewObj.Focus();
}
/// <summary>
/// <para>说明:</para>