SVN-Revision: r843
This commit is contained in:
wyf
2025-07-04 09:13:33 +00:00
parent 8c289de99a
commit f3c8614b42
2 changed files with 24 additions and 43 deletions
@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Data;
namespace Lskj.Control.Model
{
@@ -35,6 +36,10 @@ namespace Lskj.Control.Model
/// <value><c>true</c> if this instance is search control; otherwise, <c>false</c>.</value>
public bool IsSearchControl { get; set; }
/// <summary>
/// 是否必填(记录不可修改,修改会导致判断异常)
/// </summary>
public bool MustIn { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is empty.
/// </summary>
/// <value><c>true</c> if this instance is empty; otherwise, <c>false</c>.</value>
+19 -43
View File
@@ -497,8 +497,9 @@ namespace Lskj.Control.Model
baseControl.ModifyDefaultColors(ColorTranslator.FromHtml(model.ControlTitleColor));
}
baseControl.ReadOnly = model.ReadOnly;
baseControl.Required = model.IsEmpty;
model.IsEmpty = !model.ReadOnly;
baseControl.ReadOnly = model.ReadOnly;
baseControl.Tag = model;
baseControl.TabIndex = model.TabOrder;
@@ -3912,6 +3913,7 @@ namespace Lskj.Control.Model
model.id = item["id"] + "";
model.CanClear = (item["edited"] + "" != "1");
model.CanCopy = item.Table.Columns.Contains("canCopy") ? "1".Equals(item["canCopy"] + "") : true;
model.MustIn = !string.IsNullOrEmpty(item["nullable"] + "") ? Convert.ToBoolean(item["nullable"]) : false;
model.IsEmpty = !string.IsNullOrEmpty(item["nullable"] + "") ? Convert.ToBoolean(item["nullable"]) : false;
model.ReadOnly = ("1".Equals(item["edited"] + ""));
model.IsSave = true;
@@ -5125,6 +5127,21 @@ namespace Lskj.Control.Model
if (controls == null || controls.Length == 0) return;
string fieldValue = GetControlValue(model);
foreach (ControlModel item in requiredcontrols)
{
try
{
string requiredCond = this.ReplaceControlValue(item.RequiredCond.Replace("{" + model.FieldName + "}", fieldValue));
BaseUserControl control = FindControl(item);
control.Required = item.IsEmpty = item.MustIn ? ("true".Equals(ValidateCond(requiredCond, null) + "", StringComparison.OrdinalIgnoreCase)) : item.MustIn;
}
catch (Exception ex)
{
//MessageUtil.Show(ex);
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
foreach (ControlModel item in controls)
{
try
@@ -5153,21 +5170,6 @@ 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>
@@ -6017,30 +6019,4 @@ 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 (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;
}
}
}
else if