From 9d930457bd5e84f8c4bf14c8537a83a210d37f2d Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Thu, 3 Nov 2016 21:29:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E8=A1=A8=E6=A0=BCCategoryName=E5=88=97=EF=BC=8C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=B1=89=E5=AD=97=EF=BC=8C=E6=9B=B4=E6=94=B9=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6CategoryName=E4=B8=BA=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E6=A0=B7=E5=BC=8F=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E4=B8=89=E5=88=97=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Content/css/site.css | 2 +- Bootstrap.Admin/Content/js/Longbow.Common.js | 2 +- Bootstrap.Admin/Models/QueryMenuOption.cs | 16 ++++++++++++++-- Bootstrap.Admin/Scripts/Menus.js | 6 +++--- Bootstrap.Admin/Views/Admin/Menus.cshtml | 16 ++++++++++++++-- Bootstrap.DataAccess/Menu.cs | 4 ++++ Bootstrap.DataAccess/MenuHelper.cs | 5 +++-- 7 files changed, 40 insertions(+), 11 deletions(-) diff --git a/Bootstrap.Admin/Content/css/site.css b/Bootstrap.Admin/Content/css/site.css index 8250f7e9..848c3f02 100644 --- a/Bootstrap.Admin/Content/css/site.css +++ b/Bootstrap.Admin/Content/css/site.css @@ -21,7 +21,7 @@ ul li { } .btn { - outline: none; + outline: none !important; } .btn span.fa, .btn span.glyphicon { diff --git a/Bootstrap.Admin/Content/js/Longbow.Common.js b/Bootstrap.Admin/Content/js/Longbow.Common.js index 1bd0dba0..2ad60033 100644 --- a/Bootstrap.Admin/Content/js/Longbow.Common.js +++ b/Bootstrap.Admin/Content/js/Longbow.Common.js @@ -184,7 +184,7 @@ $(function () { $('.form-group .btn-group .dropdown-menu a').on('click', function () { var parent = $(this).parents('div.btn-group'); - parent.children('input.hide').val($(this).attr("data-val")); + parent.prev('input.hide').val($(this).attr("data-val")); parent.children('button:first').text($(this).text()); }); }); \ No newline at end of file diff --git a/Bootstrap.Admin/Models/QueryMenuOption.cs b/Bootstrap.Admin/Models/QueryMenuOption.cs index 321edea5..0d8b56fe 100644 --- a/Bootstrap.Admin/Models/QueryMenuOption.cs +++ b/Bootstrap.Admin/Models/QueryMenuOption.cs @@ -28,8 +28,20 @@ namespace Bootstrap.Admin.Models } var ret = new QueryData(); ret.total = data.Count(); - // TODO: 通过option.Sort属性判断对那列进行排序,现在统一对名称列排序 - data = Order == "asc" ? data.OrderBy(t => t.Name) : data.OrderByDescending(t => t.Name); + switch (Sort) + { + case "Name": + data = Order == "asc" ? data.OrderBy(t => t.Name) : data.OrderByDescending(t => t.Name); + break; + case "Order": + data = Order == "asc" ? data.OrderBy(t => t.Order) : data.OrderByDescending(t => t.Order); + break; + case "CategoryName": + data = Order == "asc" ? data.OrderBy(t => t.CategoryName) : data.OrderByDescending(t => t.CategoryName); + break; + default: + break; + } ret.rows = data.Skip(Offset).Take(Limit); return ret; } diff --git a/Bootstrap.Admin/Scripts/Menus.js b/Bootstrap.Admin/Scripts/Menus.js index 248e8f1e..b686f38c 100644 --- a/Bootstrap.Admin/Scripts/Menus.js +++ b/Bootstrap.Admin/Scripts/Menus.js @@ -41,12 +41,12 @@ queryParams: function (params) { return $.extend(params, { name: $("#txt_menus_name").val(), category: $('#txt_menus_category').val() }); }, //传递参数(*) columns: [{ checkbox: true }, { title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter }, - { title: "父级Id", field: "ParentId", sortable: false }, + { title: "父级ID", field: "ParentId", sortable: false }, { title: "菜单名称", field: "Name", sortable: true }, - { title: "菜单序号", field: "Order", sortable: false }, + { title: "菜单序号", field: "Order", sortable: true }, { title: "菜单图标", field: "Icon", sortable: false }, { title: "菜单路径", field: "Url", sortable: false }, - { title: "菜单类别", field: "Category", sortable: false } + { title: "菜单类别", field: "CategoryName", sortable: true } ] }); diff --git a/Bootstrap.Admin/Views/Admin/Menus.cshtml b/Bootstrap.Admin/Views/Admin/Menus.cshtml index aab19506..6f7c178b 100644 --- a/Bootstrap.Admin/Views/Admin/Menus.cshtml +++ b/Bootstrap.Admin/Views/Admin/Menus.cshtml @@ -25,7 +25,19 @@
- + +
+ + + +
@@ -84,8 +96,8 @@
+
-