refactor: 迁移初始化参数缓存并优化等待界面

This commit is contained in:
cyf
2026-08-27 11:46:06 +08:00
parent 8472004711
commit b33c847b27
16 changed files with 209 additions and 61 deletions
@@ -520,10 +520,9 @@ namespace Lskj.Control.Model
{
// 只执行一次,则后续不再执行.
if (execOnlyOne && i > 0) continue;
LogUtil.WriteDebug(model.MenuTabName, "执行右键", model.MenuName, "右键id" + model.Id);
DataRow rowData = rows[i];
if (!string.IsNullOrWhiteSpace(model.BeforeMsg) && tipOnlyOne)
{
tipOnlyOne = false;
@@ -561,6 +560,33 @@ namespace Lskj.Control.Model
}
paramList = this.HandleRightMenuParams(paramListEx, rowData, model.Mergeexec ? rows : null, model.ActionType);
string parameterText = string.Empty;//"{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}_{9}_{10}_{11}_{12}_{13}";
if (model.ActionType == 0 || model.ActionType == 1)
{
string newSql = string.Empty;
if (model.ActionType == 0)
{
newSql = !string.IsNullOrEmpty(actionSql) ? actionSql : model.Action;
newSql=ReplaceHelper.ReplaceRowParam(rowData, newSql);
}
if (model.ActionType == 1)
{
List<string> procParams = ReplaceHelper.GetParamFields(model.Action);
newSql = model.Action.Replace(procParams[0], "").Trim();
}
parameterText += newSql;
foreach (string item in paramList)
{
parameterText += "_" + item;
}
}
string LogText = string.Format("【{0}】执行模块【{1}】的右键【{2}】参数:{3}", ERPInfo.Instance.UserName, model.MenuTabName, model.MenuName, parameterText);
LogUtil.WriteDebug(model.MenuTabName, "执行右键", "右键id" + model.Id, LogText);
string maintabFocusedRowJson = "";
if (rowData != null)
{
+64 -10
View File
@@ -20,6 +20,9 @@ namespace Lskj.Control.Model
public static class SplashForm
{
private static SplashScreenManager _loadForm;
private static readonly object _syncRoot = new object();
// FrmSplashScreen 继承 SplashScreen,创建 SplashScreenManager 时会自动显示。
private static bool _isShown;
/// <summary>
/// 等待窗口对象
@@ -28,12 +31,15 @@ namespace Lskj.Control.Model
{
get
{
if (_loadForm == null)
lock (_syncRoot)
{
SplashFormProperties properties = new SplashFormProperties();
_loadForm = new SplashScreenManager(typeof(FrmSplashScreen), properties);
if (_loadForm == null)
{
SplashFormProperties properties = new SplashFormProperties();
_loadForm = new SplashScreenManager(typeof(FrmSplashScreen), properties);
}
return _loadForm;
}
return _loadForm;
}
}
/// <summary>
@@ -47,10 +53,24 @@ namespace Lskj.Control.Model
/// </summary>
public static void ShowForm()
{
bool flag = !LoadForm.IsSplashFormVisible;
if (flag)
try
{
_loadForm.ShowWaitForm();
lock (_syncRoot)
{
if (!_isShown || _loadForm == null)
{
SplashScreenManager manager = LoadForm;
_isShown = manager != null;
}
}
}
catch (Exception)
{
lock (_syncRoot)
{
_isShown = false;
}
throw;
}
}
/// <summary>
@@ -64,10 +84,44 @@ namespace Lskj.Control.Model
/// </summary>
public static void HideForm()
{
bool isSplashFormVisible = LoadForm.IsSplashFormVisible;
if (isSplashFormVisible)
try
{
_loadForm.CloseWaitForm();
lock (_syncRoot)
{
if (_loadForm == null || !_isShown)
{
return;
}
_loadForm.CloseWaitForm();
_loadForm.WaitForSplashFormClose();
_isShown = false;
}
}
catch (Exception ex)
{
lock (_syncRoot)
{
_isShown = false;
}
}
finally
{
lock (_syncRoot)
{
SplashScreenManager manager = _loadForm;
_loadForm = null;
if (manager != null)
{
try
{
manager.Dispose();
}
catch (Exception)
{
}
}
}
}
}
}