SVN r1016

SVN-Revision: r1016
This commit is contained in:
cyf
2025-10-20 07:37:10 +00:00
parent 9a15684171
commit 1ecf46d04b
@@ -544,10 +544,10 @@ namespace Lskj.Control
{
string sql = "select top 500 * from ({0}) temp where {1} like '%{3}%' or {2} like '%{3}%' or dbo.P_getpy({2}) like '%{3}%' ";
sqlValue = string.Format(sql + remarkCond + AddConditions, replace ? SourceSQL.Replace("#", "") : SourceSQL, ValueField, TextMember, (searchText + "").Replace("[", "[[]"));
if (OnlyQueryName)
if (OnlyQueryName)
{
sql = "select top 500 * from ({0}) temp where {1} like '%{2}%' or dbo.P_getpy({1}) like '%{2}%' ";
sql = "select top 500 * from ({0}) temp where {1} like '%{2}%' or dbo.P_getpy({1}) like '%{2}%' ";
sqlValue = string.Format(sql + remarkCond + AddConditions, replace ? SourceSQL.Replace("#", "") : SourceSQL, TextMember, (searchText + "").Replace("[", "[[]"));
}
}
@@ -964,6 +964,7 @@ namespace Lskj.Control
{
AddConditions = string.Empty;
this._popup.GridViewObj.Columns.Clear();
if (table != null && this._popup.GridViewObj.Columns.Count == 0)
{
int popWidth = 200;
@@ -971,21 +972,24 @@ namespace Lskj.Control
valueColumn.Name = valueColumn.FieldName = ValueField;
valueColumn.Caption = "编码";
valueColumn.Visible = true;
valueColumn.Width = 60;
//字段第一个字符为下划线代表不显示
if (string.IsNullOrEmpty(ValueField) || ValueField.Substring(0, 1) == "_")
valueColumn.Visible = false;
valueColumn.Width = 60;
GridColumn textColumn = new GridColumn();
textColumn.Name = textColumn.FieldName = TextMember;
textColumn.Caption = "名称";
textColumn.Visible = true;
textColumn.Width = 120;
//字段第一个字符为下划线代表不显示
if (string.IsNullOrEmpty(TextMember) || TextMember.Substring(0, 1) == "_")
textColumn.Visible = false;
textColumn.Width = 120;
this._popup.GridViewObj.Columns.AddRange(new GridColumn[] { valueColumn, textColumn });
if (table.Columns.IndexOf("remark") != -1)
@@ -997,10 +1001,12 @@ namespace Lskj.Control
remarkColumn.Name = remarkColumn.FieldName = RemarkField;
remarkColumn.Caption = "备注";
remarkColumn.Visible = true;
remarkColumn.Width = 120;
//字段第一个字符为下划线代表不显示
if (RemarkField.Substring(0, 1) == "_")
remarkColumn.Visible = false;
remarkColumn.Width = 120;
this._popup.GridViewObj.Columns.Add(remarkColumn);
_hasRemark = true;
}
@@ -1019,7 +1025,52 @@ namespace Lskj.Control
}
}
this.SetCustomColumns();
string[] columnsWidth = Model != null && Model.LookUpFieldsWidth != null ? Model.LookUpFieldsWidth.Trim().TrimEnd(',').Split(',') : null;
if (Model != null && !string.IsNullOrWhiteSpace(Model.LookUpFieldsWidth) && columnsWidth.Length > 0)
{
int iIndexWidth = _popup.GridViewObj.IndicatorWidth;
int iOtherWidth = 0;
int columnWidthIndex = 0;
foreach (GridColumn col in this.Popup.GridViewObj.Columns)
{
if (col.FieldName.Substring(0, 1) != "_")
{
int width = 0;
if (columnWidthIndex < columnsWidth.Length)
{
string widthStr = columnsWidth[columnWidthIndex];
width = int.TryParse(widthStr, out width) ? width : col.GetBestWidth();
columnWidthIndex += 1;
}
else
{
width = col.GetBestWidth();
}
col.Width = width;
iOtherWidth += width;
}
}
popWidth = iIndexWidth + iOtherWidth + 40;
if (Model.LookUpWidth > 0)
{
popWidth = iIndexWidth + Model.LookUpWidth + 25;
}
if (popWidth != _popup.Width)
{
if (popWidth > _maxPopupWidth)
{
popWidth = _maxPopupWidth;
}
else if (popWidth < _minPopupWidth)
{
popWidth = _minPopupWidth;
}
}
}
this._popup.Width = popWidth;
}
}
/// <summary>
@@ -1484,7 +1535,7 @@ namespace Lskj.Control
if (OnlyQueryName)
{
sql = "select top 500 * from ({0}) temp where {1} like '%{2}%' or dbo.P_getpy({1}) like '%{2}%' ";
sqlValue = string.Format(sql + remarkCond + AddConditions,SourceSQL, TextMember, (searchText + "").Replace("[", "[[]"));
sqlValue = string.Format(sql + remarkCond + AddConditions, SourceSQL, TextMember, (searchText + "").Replace("[", "[[]"));
}
}