feat(control): add extended return search for tables and forms
This commit is contained in:
@@ -1059,6 +1059,28 @@ namespace Lskj.Business.Impl
|
||||
table.Columns["tagid"].ColumnName = "nullable";
|
||||
}
|
||||
|
||||
if (!table.Columns.Contains("resultfields") && HasExistsColumn("p_systemwordbooktab", "resultfields"))
|
||||
{
|
||||
table.Columns.Add("resultfields", typeof(string));
|
||||
DataTable resultFieldsTable = SqlHelper.ExecuteDataTable(
|
||||
"select id,isnull(resultfields,'') resultfields from p_systemwordbooktab where tab=@modid",
|
||||
new SqlParameter[] { new SqlParameter("@modid", menuCode) });
|
||||
|
||||
Dictionary<string, string> resultFieldsById = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (DataRow row in resultFieldsTable.Rows)
|
||||
{
|
||||
resultFieldsById[row["id"] + ""] = row["resultfields"] + "";
|
||||
}
|
||||
foreach (DataRow row in table.Rows)
|
||||
{
|
||||
string resultFields;
|
||||
if (table.Columns.Contains("id") && resultFieldsById.TryGetValue(row["id"] + "", out resultFields))
|
||||
{
|
||||
row["resultfields"] = resultFields;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -1272,7 +1294,73 @@ namespace Lskj.Business.Impl
|
||||
p[1].Value = menuCode;
|
||||
p[2].Value = ERPInfo.Instance.UserName;
|
||||
|
||||
return SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_getControlLocation", "temp", p).Tables[0];
|
||||
DataTable table = SqlHelper.ExecuteDataSet(
|
||||
CommandType.StoredProcedure,
|
||||
"p_getControlLocation",
|
||||
"temp",
|
||||
p).Tables[0];
|
||||
AppendExtendedReturnResultFields(table, menuCode);
|
||||
return table;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// p_getControlLocation 的旧版本不返回 resultfields。
|
||||
/// 仅当窗体包含 180/181 扩展返回控件时按模块补取,普通窗体不增加查询。
|
||||
/// </summary>
|
||||
private static void AppendExtendedReturnResultFields(DataTable table, string menuCode)
|
||||
{
|
||||
if (table == null || table.Rows.Count == 0 ||
|
||||
!table.Columns.Contains("id") || !table.Columns.Contains("fieldTypeId"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<DataRow> extendedRows = new List<DataRow>();
|
||||
bool allConfigured = table.Columns.Contains("resultfields");
|
||||
foreach (DataRow row in table.Rows)
|
||||
{
|
||||
int fieldType;
|
||||
if (!int.TryParse(row["fieldTypeId"] + "", out fieldType) ||
|
||||
(fieldType != 180 && fieldType != 181))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
extendedRows.Add(row);
|
||||
if (!table.Columns.Contains("resultfields") ||
|
||||
string.IsNullOrWhiteSpace(row["resultfields"] + ""))
|
||||
{
|
||||
allConfigured = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (extendedRows.Count == 0 || allConfigured) return;
|
||||
if (!HasExistsColumn("p_systemwordbooktab", "resultfields")) return;
|
||||
|
||||
if (!table.Columns.Contains("resultfields"))
|
||||
{
|
||||
table.Columns.Add("resultfields", typeof(string));
|
||||
}
|
||||
|
||||
DataTable resultFieldsTable = SqlHelper.ExecuteDataTable(
|
||||
"select id,isnull(resultfields,'') resultfields " +
|
||||
"from p_systemwordbooktab where tab=@modid",
|
||||
new SqlParameter[] { new SqlParameter("@modid", menuCode) });
|
||||
Dictionary<string, string> resultFieldsById =
|
||||
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (DataRow row in resultFieldsTable.Rows)
|
||||
{
|
||||
resultFieldsById[row["id"] + ""] = row["resultfields"] + "";
|
||||
}
|
||||
|
||||
foreach (DataRow row in extendedRows)
|
||||
{
|
||||
string resultFields;
|
||||
if (resultFieldsById.TryGetValue(row["id"] + "", out resultFields))
|
||||
{
|
||||
row["resultfields"] = resultFields;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取添加界面多标签</para>
|
||||
@@ -1436,4 +1524,4 @@ namespace Lskj.Business.Impl
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user