菜单页面增加资源查询与排序
This commit is contained in:
parent
2f6b489032
commit
0f2030b35a
|
@ -18,6 +18,10 @@ namespace Bootstrap.Admin.Models
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Category { get; set; }
|
public string Category { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string IsResource { get; set; }
|
||||||
|
|
||||||
public QueryData<Menu> RetrieveData(string userName)
|
public QueryData<Menu> RetrieveData(string userName)
|
||||||
{
|
{
|
||||||
|
@ -34,6 +38,10 @@ namespace Bootstrap.Admin.Models
|
||||||
{
|
{
|
||||||
data = data.Where(t => t.Category.Contains(Category));
|
data = data.Where(t => t.Category.Contains(Category));
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrEmpty(IsResource))
|
||||||
|
{
|
||||||
|
data = data.Where(t => t.IsResource.ToString() == IsResource);
|
||||||
|
}
|
||||||
var ret = new QueryData<Menu>();
|
var ret = new QueryData<Menu>();
|
||||||
ret.total = data.Count();
|
ret.total = data.Count();
|
||||||
switch (Sort)
|
switch (Sort)
|
||||||
|
@ -53,6 +61,9 @@ namespace Bootstrap.Admin.Models
|
||||||
case "Target":
|
case "Target":
|
||||||
data = Order == "asc" ? data.OrderBy(t => t.Target) : data.OrderByDescending(t => t.Target);
|
data = Order == "asc" ? data.OrderBy(t => t.Target) : data.OrderByDescending(t => t.Target);
|
||||||
break;
|
break;
|
||||||
|
case "IsResource":
|
||||||
|
data = Order == "asc" ? data.OrderBy(t => t.IsResource) : data.OrderByDescending(t => t.IsResource);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
$('table').smartTable({
|
$('table').smartTable({
|
||||||
url: Menu.url, //请求后台的URL(*)
|
url: Menu.url, //请求后台的URL(*)
|
||||||
sortName: 'Order',
|
sortName: 'Order',
|
||||||
queryParams: function (params) { return $.extend(params, { parentName: $('#txt_parent_menus_name').val(), name: $("#txt_menus_name").val(), category: $('#sel_menus_category').val() }); }, //传递参数(*)
|
queryParams: function (params) { return $.extend(params, { parentName: $('#txt_parent_menus_name').val(), name: $("#txt_menus_name").val(), category: $('#sel_menus_category').val(), isresource: $('#sel_menus_res').val() }); }, //传递参数(*)
|
||||||
columns: [{ checkbox: true },
|
columns: [{ checkbox: true },
|
||||||
{ title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter },
|
{ title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter },
|
||||||
{ title: "父级菜单", field: "ParentName", sortable: true },
|
{ title: "父级菜单", field: "ParentName", sortable: true },
|
||||||
|
|
|
@ -15,15 +15,15 @@
|
||||||
@section query {
|
@section query {
|
||||||
<form class="form-inline" role="form">
|
<form class="form-inline" role="form">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-sm-6 col-lg-3">
|
<div class="form-group col-sm-6 col-md-3">
|
||||||
<label class="control-label" for="txt_parent_menus_name">父级菜单</label>
|
<label class="control-label" for="txt_parent_menus_name">父级菜单</label>
|
||||||
<input type="text" class="form-control" id="txt_parent_menus_name" />
|
<input type="text" class="form-control" id="txt_parent_menus_name" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-sm-6 col-lg-3">
|
<div class="form-group col-sm-6 col-md-3">
|
||||||
<label class="control-label" for="txt_menus_name">菜单名称</label>
|
<label class="control-label" for="txt_menus_name">菜单名称</label>
|
||||||
<input type="text" class="form-control" id="txt_menus_name" />
|
<input type="text" class="form-control" id="txt_menus_name" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-sm-6 col-lg-3">
|
<div class="form-group col-sm-6 col-md-2">
|
||||||
<label class="control-label" for="sel_menus_category">菜单类别</label>
|
<label class="control-label" for="sel_menus_category">菜单类别</label>
|
||||||
<div class="dropdown lgbDropdown">
|
<div class="dropdown lgbDropdown">
|
||||||
<a id="sel_menus_category" class="btn btn-success" data-toggle="dropdown">
|
<a id="sel_menus_category" class="btn btn-success" data-toggle="dropdown">
|
||||||
|
@ -38,7 +38,22 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-sm-6 col-lg-3">
|
<div class="form-group col-sm-6 col-md-2">
|
||||||
|
<label class="control-label" for="sel_menus_category">菜单类型</label>
|
||||||
|
<div class="dropdown lgbDropdown">
|
||||||
|
<a id="sel_menus_res" class="btn btn-success" data-toggle="dropdown">
|
||||||
|
<span>全部</span>
|
||||||
|
<span class="caret"></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="#" data-val="">全部</a></li>
|
||||||
|
<li class="divider"></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-xs-12 col-sm-1">
|
||||||
<button type="button" id="btn_query" class="btn btn-primary form-control"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button>
|
<button type="button" id="btn_query" class="btn btn-primary form-control"><i class="fa fa-search" aria-hidden="true"></i><span>查询</span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue