feat: 优化主界面及控件功能
This commit is contained in:
@@ -6530,6 +6530,8 @@ namespace Lskj.Control
|
||||
this.gridView.RowCount > 0 &&
|
||||
this.gridView.OptionsBehavior.Editable)
|
||||
{
|
||||
GridColumnModel model = column.Tag as GridColumnModel;
|
||||
|
||||
// 允许操作
|
||||
int focusedRowHandle = this.gridView.FocusedRowHandle;
|
||||
int totalRowCount = this.gridView.RowCount;
|
||||
@@ -6544,7 +6546,58 @@ namespace Lskj.Control
|
||||
int valueNum = 0;
|
||||
object obj = this.gridView.GetFocusedRowCellValue(column);
|
||||
|
||||
if (!string.IsNullOrEmpty(obj + ""))
|
||||
|
||||
if (model != null && (ControlType.IsDate(model.FieldType) || model.FieldType == ControlType.LabShortDate))
|
||||
{
|
||||
DateTime dateValue;
|
||||
if (!DateTime.TryParse(obj + "", out dateValue))
|
||||
{
|
||||
MessageUtil.Show("当前单元格不是有效日期,无法按日期生成。");
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
string dateFormat = DateFormat.Format(model.FieldType);
|
||||
bool onlyYear = !string.IsNullOrEmpty(dateFormat)
|
||||
&& dateFormat.IndexOf("y", StringComparison.OrdinalIgnoreCase) >= 0
|
||||
&& dateFormat.IndexOf("M", StringComparison.Ordinal) < 0
|
||||
&& dateFormat.IndexOf("d", StringComparison.OrdinalIgnoreCase) < 0;
|
||||
bool onlyMonth = !string.IsNullOrEmpty(dateFormat)
|
||||
&& dateFormat.IndexOf("M", StringComparison.Ordinal) >= 0
|
||||
&& dateFormat.IndexOf("d", StringComparison.OrdinalIgnoreCase) < 0;
|
||||
|
||||
this.gridView.BeginUpdate();
|
||||
this.gridView.BeginDataUpdate();
|
||||
try
|
||||
{
|
||||
for (int i = focusedRowHandle; i < totalRowCount; i++)
|
||||
{
|
||||
gridView.SetRowCellValue(i, column, dateValue);
|
||||
if (onlyYear)
|
||||
{
|
||||
dateValue = dateValue.AddYears(1);
|
||||
}
|
||||
else if (onlyMonth)
|
||||
{
|
||||
dateValue = dateValue.AddMonths(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
dateValue = dateValue.AddDays(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.gridView.EndDataUpdate();
|
||||
this.gridView.EndUpdate();
|
||||
}
|
||||
|
||||
gridView.FocusedRowHandle = totalRowCount - 1;
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(obj + ""))
|
||||
{
|
||||
//isExec = Int64.TryParse(obj + "", out value);
|
||||
Regex regex = new Regex(@"\D", RegexOptions.RightToLeft);
|
||||
|
||||
Reference in New Issue
Block a user