SVN-Revision: r840
This commit is contained in:
wyf
2025-07-04 08:09:01 +00:00
parent d6cde8c4c5
commit cd3e79d3bf
2 changed files with 49 additions and 1 deletions
@@ -194,6 +194,11 @@ namespace Lskj.Control.Model
/// <value>The enable cond.</value>
public string DisableCond { get; set; }
/// <summary>
/// 必填条件
/// </summary>
/// <value>The enable cond.</value>
public string RequiredCond { get; set; }
/// <summary>
/// 可以方式
/// </summary>
/// <value>The type of the enable.</value>
+44 -1
View File
@@ -3954,6 +3954,7 @@ namespace Lskj.Control.Model
model.FontSize = item.Table.Columns.Contains("FontSize") && !string.IsNullOrEmpty(item["FontSize"] + "") ? Convert.ToInt32(item["FontSize"] + "") : 0;
model.DisableCond = item.Table.Columns.Contains("DisableCond") ? item["DisableCond"] + "" : "";
model.RequiredCond = item.Table.Columns.Contains("RequiredCond") ? item["RequiredCond"] + "" : "";
model.DisableType = item.Table.Columns.Contains("DisableType") ? item["DisableType"] + "" : "";
model.FormKey = item.Table.Columns.Contains("formKey") ? item["formKey"] + "" : string.Empty;
model.IsAddControl = item.Table.Columns.Contains("IsAddControl") ? "1".Equals(item["IsAddControl"] + "") : false;
@@ -5120,6 +5121,7 @@ namespace Lskj.Control.Model
private void SetDisableControl(ControlModel model)
{
ControlModel[] controls = this._models.Where(x => x.DisableCond.Contains("{" + model.FieldName + "}")).ToArray();
ControlModel[] requiredcontrols = this._models.Where(x => x.RequiredCond.Contains("{" + model.FieldName + "}")).ToArray();
if (controls == null || controls.Length == 0) return;
string fieldValue = GetControlValue(model);
@@ -5151,6 +5153,21 @@ namespace Lskj.Control.Model
MessageUtil.Show(Message, ex.Message);
}
}
foreach (ControlModel item in requiredcontrols)
{
try
{
string requiredCond = this.ReplaceControlValue(item.RequiredCond.Replace("{" + model.FieldName + "}", fieldValue));
BaseUserControl control = FindControl(item);
control.Required = model.IsEmpty ? ("true".Equals(ValidateCond(requiredCond, null) + "", StringComparison.OrdinalIgnoreCase)) : model.IsEmpty;
}
catch (Exception ex)
{
//MessageUtil.Show(ex);
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
}
/// <summary>
/// <para>说明:检查可用条件</para>
@@ -6000,4 +6017,30 @@ namespace Lskj.Control.Model
LabelDateEdit dateEdit = controlObj as LabelDateEdit;
value = dateEdit.TextEdit.EditValue == null ? dateEdit.EditText : dateEdit.TextEdit.DateTime.ToString("yyyy-MM-dd");
}
else if
else if (controlObj is LabelCheckEdit)
{
LabelCheckEdit checkEdit = controlObj as LabelCheckEdit;
value = checkEdit.EditText;
}
else if (controlObj is LabelComboxEdit)
{
LabelComboxEdit autoEdit = controlObj as LabelComboxEdit;
value = autoEdit.EditValue;
}
else if (controlObj is LabelTextEdit)
{
LabelTextEdit textIntEdit = controlObj as LabelTextEdit;
if (textIntEdit != null) value = string.IsNullOrEmpty(textIntEdit.EditText) ? "0" : textIntEdit.EditText;
}
defaultValue = defaultValue.Replace(item, value);
}
}
}
return defaultValue;
}
}
}