格式化菜单表格CategoryName列,显示汉字,更改查询条件CategoryName为下拉框样式,支持表格三列排序
This commit is contained in:
parent
be81d04f33
commit
9d930457bd
|
@ -21,7 +21,7 @@ ul li {
|
|||
}
|
||||
|
||||
.btn {
|
||||
outline: none;
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.btn span.fa, .btn span.glyphicon {
|
||||
|
|
|
@ -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());
|
||||
});
|
||||
});
|
|
@ -28,8 +28,20 @@ namespace Bootstrap.Admin.Models
|
|||
}
|
||||
var ret = new QueryData<Menu>();
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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 }
|
||||
]
|
||||
});
|
||||
|
||||
|
|
|
@ -25,7 +25,19 @@
|
|||
</div>
|
||||
<div class="form-group col-lg-5">
|
||||
<label class="control-label" for="txt_menus_category">菜单类别</label>
|
||||
<input type="text" class="form-control" id="txt_menus_category" />
|
||||
<input type="text" class="form-control hide" id="txt_menus_category" />
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default">未选择</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">下拉按钮</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="#" data-val="">未选择</a></li>
|
||||
<li><a href="#" data-val="0">系统菜单</a></li>
|
||||
<li><a href="#" data-val="1">自定义菜单</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-lg-2">
|
||||
<button type="button" id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>查询</button>
|
||||
|
@ -84,8 +96,8 @@
|
|||
<div class="form-group col-lg-6">
|
||||
<label class="control-label" for="category">类别</label>
|
||||
<!-- Split button -->
|
||||
<input type="text" class="form-control hide" id="category" name="category" value="1" />
|
||||
<div class="btn-group">
|
||||
<input type="text" class="form-control hide" id="category" name="category" value="1" />
|
||||
<button type="button" class="btn btn-default">自定义菜单</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
|
|
|
@ -35,6 +35,10 @@ namespace Bootstrap.DataAccess
|
|||
/// </summary>
|
||||
public string Category { get; set; }
|
||||
/// <summary>
|
||||
/// 获得 菜单分类名称,取字典表中的Name category="菜单"
|
||||
/// </summary>
|
||||
public string CategoryName { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 是否当前被选中 active为选中
|
||||
/// </summary>
|
||||
public string Active { get; set; }
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public static IEnumerable<Menu> RetrieveMenus(string tId = null)
|
||||
{
|
||||
string sql = "select * from Navigations";
|
||||
string sql = "select n.*, d.Name as CategoryName from Navigations n inner join Dicts d on n.Category = d.Code and d.Category = N'菜单' and d.Define = 0";
|
||||
var ret = CacheManager.GetOrAdd(MenuDataKey, CacheSection.RetrieveIntervalByKey(MenuDataKey), key =>
|
||||
{
|
||||
List<Menu> Menus = new List<Menu>();
|
||||
|
@ -42,7 +42,8 @@ namespace Bootstrap.DataAccess
|
|||
Order = (int)reader[3],
|
||||
Icon = LgbConvert.ReadValue(reader[4], string.Empty),
|
||||
Url = LgbConvert.ReadValue(reader[5], string.Empty),
|
||||
Category = (string)reader[6]
|
||||
Category = (string)reader[6],
|
||||
CategoryName = (string)reader[7]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue