diff --git a/docs/资料/GBT20091-2006组织机构类型.pdf b/docs/资料/GBT20091-2006组织机构类型.pdf new file mode 100644 index 00000000..5737e0f5 Binary files /dev/null and b/docs/资料/GBT20091-2006组织机构类型.pdf differ diff --git a/docs/资料/腾讯智慧校园-高等院校解决方案.pdf b/docs/资料/腾讯智慧校园-高等院校解决方案.pdf new file mode 100644 index 00000000..b3516ec2 Binary files /dev/null and b/docs/资料/腾讯智慧校园-高等院校解决方案.pdf differ diff --git a/projects/IoT.Shared/wwwroot/js/site.js b/projects/IoT.Shared/wwwroot/js/site.js index 3fdbdd42..657bd6f8 100644 --- a/projects/IoT.Shared/wwwroot/js/site.js +++ b/projects/IoT.Shared/wwwroot/js/site.js @@ -304,7 +304,7 @@ $(function () { InitControls(); }); -$('body').on('change', '#OrganNumber.submit', function () { +$('body').on('change', 'select.organ.submit', function () { $(this).parents('form').submit(); }); diff --git a/projects/Platform/Controllers/AccountController.cs b/projects/Platform/Controllers/AccountController.cs index e8cddf12..124dff27 100644 --- a/projects/Platform/Controllers/AccountController.cs +++ b/projects/Platform/Controllers/AccountController.cs @@ -926,10 +926,10 @@ namespace Platform.Controllers return Content($"var hasLogin={(User.Identity.IsAuthenticated ? "true" : "false")}"); } - public IActionResult ChangeOrgan(string organNumber, string returnUrl) + public IActionResult ChangeOrgan(string userCurrentOrganNumber, string returnUrl) { this.HttpContext.JwtSignOut(); - this.HttpContext.JwtSignIn(User.Identity.Name, false, organNumber); + this.HttpContext.JwtSignIn(User.Identity.Name, false, userCurrentOrganNumber); return Redirect(returnUrl); } @@ -981,4 +981,4 @@ namespace Platform.Controllers #endregion tools } -} \ No newline at end of file +} diff --git a/projects/Platform/Controllers/HomeController.cs b/projects/Platform/Controllers/HomeController.cs index aa5e8b1f..19c9da28 100644 --- a/projects/Platform/Controllers/HomeController.cs +++ b/projects/Platform/Controllers/HomeController.cs @@ -5,6 +5,7 @@ using IoT.Shared.Application.Domain.Entities; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Platform.ViewModels; using System.Linq; namespace Platform.Controllers @@ -62,18 +63,24 @@ namespace Platform.Controllers return Helper.Instance.MacEncrypt(id); } - public IActionResult Index2(string organNumber) + public IActionResult Index2(HomeModel model) { var currentOrganNumber = User.GetUserData(); - var organ = this._organRepo.ReadOnlyTable().FirstOrDefault(o => o.Number == currentOrganNumber); + var organ = this._organRepo.ReadOnlyTable() + .FirstOrDefault(o => o.Number == currentOrganNumber); var children = this._organRepo.Table() .Where(o => o.Left >= organ.Left && o.Right <= organ.Right) .Include(o => o.Buildings) .ToList(); var root = children.FirstOrDefault(o => o.Number == currentOrganNumber); - ViewBag.Organ = new object[] { Convert(root) }; - return View(); + + model.Organ = root; + if (string.IsNullOrEmpty(model.OrganNumber)) + { + model.OrganNumber = root.Number; + } + return View(model); } public IActionResult Index3() diff --git a/projects/Platform/ViewModels/HomeModel.cs b/projects/Platform/ViewModels/HomeModel.cs index 7ef827c5..cf2444cd 100644 --- a/projects/Platform/ViewModels/HomeModel.cs +++ b/projects/Platform/ViewModels/HomeModel.cs @@ -1,15 +1,10 @@ using IoT.Shared.Application.Domain.Entities; -using System; -using System.Collections.Generic; namespace Platform.ViewModels { public class HomeModel { - public Guid? OrganId { get; set; } + public string OrganNumber { get; set; } public Organ Organ { get; set; } - public Guid? BuildingId { get; set; } - public List Organs { get; set; } = new List(); - public List Buildings { get; set; } = new List(); } } diff --git a/projects/Platform/Views/Home/Index2.cshtml b/projects/Platform/Views/Home/Index2.cshtml index b20cf954..b9b94af5 100644 --- a/projects/Platform/Views/Home/Index2.cshtml +++ b/projects/Platform/Views/Home/Index2.cshtml @@ -1,39 +1,62 @@ @model Platform.ViewModels.HomeModel @{ - var organ = ViewBag.Organ as object; + HideBread = true; + var organTreeJson = new object[] { Convert(Model.Organ) }.ToJson(); } - - - - - - - - - - - - col-12 - +
+
+
+
+
+ 机构及下属机构 +
+
+ + +
+
+
+
+
+
+ 机构概况 +
+
+ +
+
+
+
@section scripts{ +} +@functions{ + object Convert(Organ root) + { + return new + { + title = root.Name, + key = root.Number, + children = root.Children.Select(o => Convert(o)) + }; + } } \ No newline at end of file diff --git a/projects/Platform/Views/Shared/_Layout.cshtml b/projects/Platform/Views/Shared/_Layout.cshtml index 2fcfc487..1c8f991b 100644 --- a/projects/Platform/Views/Shared/_Layout.cshtml +++ b/projects/Platform/Views/Shared/_Layout.cshtml @@ -51,7 +51,7 @@ }