|
@@ -109,6 +109,97 @@ namespace MySystem
|
|
|
result = result.TrimEnd(',');
|
|
result = result.TrimEnd(',');
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public string GetRightJsonNew()
|
|
|
|
|
+ {
|
|
|
|
|
+ string result = "[";
|
|
|
|
|
+ List<BsModels.RightDicNew> list = bsdb.RightDicNew.ToList();
|
|
|
|
|
+ List<BsModels.RightDicNew> Level1 = list.Where(m => m.RightLevel == 1).ToList();
|
|
|
|
|
+ foreach (BsModels.RightDicNew sub1 in Level1)
|
|
|
|
|
+ {
|
|
|
|
|
+ result += "{title: '" + sub1.Name + "', id: '" + sub1.Id + "', spread: false, children: [";
|
|
|
|
|
+ List<BsModels.RightDicNew> Level2 = list.Where(m => m.RightLevel == 2 && m.Id.StartsWith(sub1.Id)).ToList();
|
|
|
|
|
+ if (Level2.Count > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ foreach (BsModels.RightDicNew sub2 in Level2)
|
|
|
|
|
+ {
|
|
|
|
|
+ result += "{title: '" + sub2.Name + "', id: '" + sub2.Id + "', spread: false, children: [";
|
|
|
|
|
+ List<BsModels.RightDicNew> Level3 = list.Where(m => m.RightLevel == 3 && m.Id.StartsWith(sub2.Id)).ToList();
|
|
|
|
|
+ if (Level3.Count > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ foreach (BsModels.RightDicNew sub3 in Level3)
|
|
|
|
|
+ {
|
|
|
|
|
+ result += "{title: '" + sub3.Name + "', id: '" + sub3.Id + "', spread: false, children: [";
|
|
|
|
|
+ string rightString = ForOperateRight(sub3.Id);
|
|
|
|
|
+ if (!string.IsNullOrEmpty(rightString))
|
|
|
|
|
+ {
|
|
|
|
|
+ result += rightString;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ result += "{title: '基本权限', id: '" + sub3.Id + "_base'}";
|
|
|
|
|
+ }
|
|
|
|
|
+ result += "]},";
|
|
|
|
|
+ }
|
|
|
|
|
+ result = result.TrimEnd(',');
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ string rightString = ForOperateRightNew(sub2.Id);
|
|
|
|
|
+ if (!string.IsNullOrEmpty(rightString))
|
|
|
|
|
+ {
|
|
|
|
|
+ result += rightString;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ result += "{title: '基本权限', id: '" + sub2.Id + "_base'}";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ result += "]},";
|
|
|
|
|
+ }
|
|
|
|
|
+ result = result.TrimEnd(',');
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ result += ForOperateRightNew(sub1.Id);
|
|
|
|
|
+ string rightString = ForOperateRightNew(sub1.Id);
|
|
|
|
|
+ if (!string.IsNullOrEmpty(rightString))
|
|
|
|
|
+ {
|
|
|
|
|
+ result += rightString;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ result += "{title: '基本权限', id: '" + sub1.Id + "_base'}";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ result += "]},";
|
|
|
|
|
+ }
|
|
|
|
|
+ result = result.TrimEnd(',');
|
|
|
|
|
+ result += "]";
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ //读取当前菜单有哪些权限
|
|
|
|
|
+ public string ForOperateRightNew(string Id)
|
|
|
|
|
+ {
|
|
|
|
|
+ string result = "";
|
|
|
|
|
+ List<BsModels.MenuRightNew> rights = bsdb.MenuRightNew.Where(m => m.MenuId.StartsWith(Id)).OrderBy(m => m.MenuId).ToList();
|
|
|
|
|
+ foreach (BsModels.MenuRightNew right in rights)
|
|
|
|
|
+ {
|
|
|
|
|
+ result += "{title: '" + right.Name + "', id: '" + right.MenuId + "'},";
|
|
|
|
|
+ }
|
|
|
|
|
+ BsModels.RightDicNew rightDic = bsdb.RightDicNew.FirstOrDefault(m => m.Id == Id) ?? new BsModels.RightDicNew();
|
|
|
|
|
+ if (!string.IsNullOrEmpty(rightDic.OtherRight))
|
|
|
|
|
+ {
|
|
|
|
|
+ string[] OtherRightList = rightDic.OtherRight.Split('\n');
|
|
|
|
|
+ foreach (string SubOtherRight in OtherRightList)
|
|
|
|
|
+ {
|
|
|
|
|
+ string[] SubOtherRightData = SubOtherRight.Split('_');
|
|
|
|
|
+ result += "{title: '" + SubOtherRightData[1] + "', id: '" + Id + "_" + SubOtherRightData[0] + "'},";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ result = result.TrimEnd(',');
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
public string TranslateRightString(string RightString)
|
|
public string TranslateRightString(string RightString)
|
|
|
{
|
|
{
|
|
|
string result = "";
|
|
string result = "";
|