This commit is contained in:
gongxh
2022-05-06 10:36:42 +08:00
parent 3acbcc78c7
commit c57ca69dfd
23 changed files with 534 additions and 375 deletions

View File

@@ -62,12 +62,58 @@ namespace CleanMachineHMI
/// <summary>
/// 参数列表
/// </summary>
public static DataTable ParameterList { get; set; }
// public static DataTable ParameterList { get; set; }
public static List<CleanMachine.Model.SYS.Parameter> ParameterList { get; set; }
/// <summary>
/// 设备编号
/// </summary>
public static string MacCode
{
get
{
return ParameterList.First(m => m.ParameterCode == "CleanMachineName").ParameterValue;
}
}
/// <summary>
/// 角色菜单权限数据
/// </summary>
public static DataTable RoleMenuPermission { get; set; }
// public static DataTable RoleMenuPermission { get; set; }
public static List<CleanMachine.Model.SYS.RoleMenuPermission> RoleMenuPermission { get; set; }
public static bool CheckRole(string FormName, string ControlName)
{
//DataRow[] drs = GlobalHelper.RoleMenuPermission.Select($" MENU_URL = '{this.Name}' AND MENU_PID = '-1'");
//DataRow[] drs1 = GlobalHelper.RoleMenuPermission.Select($" MENU_URL = '{item.Name}' AND MENU_PID = '{drs[0]["MENU_ID"]}'");
var drs = RoleMenuPermission.FirstOrDefault(m => m.MenuUrl == FormName && m.MenuPid == -1);
if (drs == null)
{
return false;
}
var drs1 = RoleMenuPermission.FirstOrDefault(m => m.MenuUrl == ControlName && m.MenuPid == drs.MenuId);
return drs1 != null;
}
public static bool CheckRole(string FormName )
{
//DataRow[] drs = GlobalHelper.RoleMenuPermission.Select($" MENU_URL = '{this.Name}' AND MENU_PID = '-1'");
//DataRow[] drs1 = GlobalHelper.RoleMenuPermission.Select($" MENU_URL = '{item.Name}' AND MENU_PID = '{drs[0]["MENU_ID"]}'");
var drs = RoleMenuPermission.FirstOrDefault(m => m.MenuUrl == FormName && m.MenuPid == -1);
return drs != null;
}
/// <summary>
///
/// </summary>
@@ -185,7 +231,7 @@ namespace CleanMachineHMI
}
/// <summary>
/// 加载主题
@@ -194,8 +240,8 @@ namespace CleanMachineHMI
{
if (ThemeLanguage == null || ThemeLanguage.Count == 0)
{
// var appPath = System.Windows.Forms.Application.StartupPath.Split(new string[] { @"bin\Debug" }, StringSplitOptions.RemoveEmptyEntries)[0];
var filePath = $"Lang\\{GlobalHelper.LanguageCode}.json";
// var appPath = System.Windows.Forms.Application.StartupPath.Split(new string[] { @"bin\Debug" }, StringSplitOptions.RemoveEmptyEntries)[0];
var filePath = $"Lang\\{GlobalHelper.LanguageCode}.json";
var str = File.ReadAllText(filePath);
var lstLanguage = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ThemeLanguage>>(str);
var tmpThemeLanguage = new Dictionary<string, string>();