diff --git a/插件库/Lskj.Control/Model/ControlModel.cs b/插件库/Lskj.Control/Model/ControlModel.cs
index 58a57db..16c0286 100644
--- a/插件库/Lskj.Control/Model/ControlModel.cs
+++ b/插件库/Lskj.Control/Model/ControlModel.cs
@@ -194,6 +194,11 @@ namespace Lskj.Control.Model
/// The enable cond.
public string DisableCond { get; set; }
///
+ /// 必填条件
+ ///
+ /// The enable cond.
+ public string RequiredCond { get; set; }
+ ///
/// 可以方式
///
/// The type of the enable.
diff --git a/插件库/Lskj.Control/Model/MyControl.cs b/插件库/Lskj.Control/Model/MyControl.cs
index 1858f62..c329c46 100644
--- a/插件库/Lskj.Control/Model/MyControl.cs
+++ b/插件库/Lskj.Control/Model/MyControl.cs
@@ -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);
+ }
+ }
}
///
/// 说明:检查可用条件
@@ -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
\ No newline at end of file
+ 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;
+ }
+
+
+ }
+}
\ No newline at end of file