diff --git a/DB.sql b/DB.sql index 77a96cfd..3774e466 100644 Binary files a/DB.sql and b/DB.sql differ diff --git a/OpenAuth.App/OrgManagerApp.cs b/OpenAuth.App/OrgManagerApp.cs index e807eabb..eb6dd67b 100644 --- a/OpenAuth.App/OrgManagerApp.cs +++ b/OpenAuth.App/OrgManagerApp.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using OpenAuth.Domain; using OpenAuth.Domain.Interface; @@ -23,11 +24,20 @@ namespace OpenAuth.App public int AddOrg(Org org) { string cascadeId; - //根据同一级个数计算ID - int currentCascadeId = _repository.GetCount(o => o.ParentId == 0) + 1; + int currentCascadeId = 1; + if (org.ParentId != 0) { + //根据同一级中最大的语义ID + var maxCascadeIdOrg = _repository.Find(o => o.ParentId == org.ParentId) + .OrderByDescending(o =>o.CascadeId).FirstOrDefault(); + if (maxCascadeIdOrg != null) + { + var cascades = maxCascadeIdOrg.CascadeId.Split('.'); + currentCascadeId = int.Parse(cascades[cascades.Length - 1]) + 1; + } + var parentOrg = _repository.FindSingle(o => o.Id == org.ParentId); if (parentOrg != null) { diff --git a/OpenAuth.Mvc/BJUI/images/logo.png b/OpenAuth.Mvc/BJUI/images/logo.png index 021130b0..64232e82 100644 Binary files a/OpenAuth.Mvc/BJUI/images/logo.png and b/OpenAuth.Mvc/BJUI/images/logo.png differ diff --git a/OpenAuth.Mvc/BJUI/themes/css/style.css b/OpenAuth.Mvc/BJUI/themes/css/style.css index 6c7886a9..b3a1e1b7 100644 --- a/OpenAuth.Mvc/BJUI/themes/css/style.css +++ b/OpenAuth.Mvc/BJUI/themes/css/style.css @@ -147,7 +147,7 @@ td[align=right] input{text-align:right;} .table.nowrap th{white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} /* Main */ #bjui-window{margin:0 auto; overflow:hidden;} -#bjui-header{position:relative; margin-bottom:0; height:70px; overflow:visible; border-width:0; border-radius:0;} +#bjui-header{position:relative; margin-bottom:0; height:80px; overflow:visible; border-width:0; border-radius:0;} #bjui-header > .bjui-navbar-header{float:left;} #bjui-header > .bjui-navbar-header > .bjui-navbar-logo{display:block; padding-left:6px; padding-top:1px;} #bjui-header > .bjui-navbar-header > .bjui-navbar-toggle{display:none; position:absolute; top:5px; right:5px;} @@ -180,7 +180,7 @@ td[align=right] input{text-align:right;} #bjui-header > #bjui-navbar-collapse > .bjui-navbar-right > li > .dropdown-menu > li > a.theme_blue{color:blue;} #bjui-header > #bjui-navbar-collapse > .bjui-navbar-right > li > .dropdown-menu > li > a.theme_red{color:#fc5555;} #bjui-header > #bjui-navbar-collapse > .bjui-navbar-right > li > .dropdown-menu > li > a.theme_green{color:green;} -#bjui-hnav{position:absolute; top:38px; width:100%; height:32px; overflow:visible;} +#bjui-hnav{position:absolute; top:47px; height:32px; overflow:visible;} #bjui-hnav > .bjui-hnav-more-left{position:absolute; left:0; top:0; z-index:1; display:none;} #bjui-hnav > .bjui-hnav-more-right{position:absolute; right:0; top:0; z-index:1; display:none;} #bjui-hnav > .bjui-hnav-more-left, diff --git a/OpenAuth.Mvc/Controllers/OrgManagerController.cs b/OpenAuth.Mvc/Controllers/OrgManagerController.cs index d31a01a5..8d097171 100644 --- a/OpenAuth.Mvc/Controllers/OrgManagerController.cs +++ b/OpenAuth.Mvc/Controllers/OrgManagerController.cs @@ -29,5 +29,16 @@ namespace OpenAuth.Mvc.Controllers var orgs = _orgApp.GetAll(); return JsonHelper.Instance.Serialize(orgs); } + + public JsonResult LoadTree() + { + return Json(_orgApp.GetAll().Select(o =>new + { + id = o.Id, + pId = o.ParentId, + name = o.Name, + text = o.Name + }), JsonRequestBehavior.AllowGet); + } } } \ No newline at end of file diff --git a/OpenAuth.Mvc/OpenAuth.Mvc.csproj b/OpenAuth.Mvc/OpenAuth.Mvc.csproj index b22de4cd..2c93fde3 100644 --- a/OpenAuth.Mvc/OpenAuth.Mvc.csproj +++ b/OpenAuth.Mvc/OpenAuth.Mvc.csproj @@ -178,6 +178,7 @@ + diff --git a/OpenAuth.Mvc/Views/Home/Index.cshtml b/OpenAuth.Mvc/Views/Home/Index.cshtml index 330067ae..d62ac8fb 100644 --- a/OpenAuth.Mvc/Views/Home/Index.cshtml +++ b/OpenAuth.Mvc/Views/Home/Index.cshtml @@ -3,9 +3,9 @@ - B-JUI 客户端框架 - - + OpenAuth.net 基于经典DDD框架的权限管理 + + @@ -17,6 +17,7 @@ + @@ -33,7 +34,7 @@ - + @@ -55,17 +56,14 @@ - - - - - - + + + -
-
- -
- +
+
+
+
    +
    +
    +
    +
    -
    \ No newline at end of file +
    + + \ No newline at end of file diff --git a/OpenAuth.Repository/OpenAuth.Repository.csproj b/OpenAuth.Repository/OpenAuth.Repository.csproj index a8f81432..5ebb6d40 100644 --- a/OpenAuth.Repository/OpenAuth.Repository.csproj +++ b/OpenAuth.Repository/OpenAuth.Repository.csproj @@ -79,7 +79,6 @@ - diff --git a/OpenAuth.UnitTest/TestOrgApp.cs b/OpenAuth.UnitTest/TestOrgApp.cs index ba98d05b..91049c6e 100644 --- a/OpenAuth.UnitTest/TestOrgApp.cs +++ b/OpenAuth.UnitTest/TestOrgApp.cs @@ -65,16 +65,26 @@ namespace OpenAuth.UnitTest [TestMethod] public void TestAddOrg() { - int id = _app.AddOrg(new Org + int rootId = _app.AddOrg(new Org { Name = "集团总部", ParentId = 0 }); - Assert.IsTrue(id != 0); - id = _app.AddOrg(new Org + Assert.IsTrue(rootId != 0); + int id = _app.AddOrg(new Org { Name = "一分公司", - ParentId = id + ParentId = rootId + }); + id = _app.AddOrg(new Org + { + Name = "二分公司", + ParentId = rootId + }); + id = _app.AddOrg(new Org + { + Name = "三分公司", + ParentId = rootId }); Assert.IsTrue(id != 0);