fix(I13MQ4): 菜单维护页面增加删除时更新侧边栏
#Comment comment #I13MQ4 增加局部视图同步更新侧边栏 #Issue link https://gitee.com/LongbowEnterprise/dashboard/issues?id=I13MQ4
This commit is contained in:
parent
dda0d35938
commit
b3b71a143f
|
@ -279,7 +279,7 @@
|
|||
"_id": ObjectId("5bd7b8445fa31256f77e4b14"),
|
||||
"ParentId": "0",
|
||||
"Name": "图标页面",
|
||||
"Order": NumberInt(55),
|
||||
"Order": NumberInt(50),
|
||||
"Icon": "fa fa-fa",
|
||||
"Url": "~/Admin/IconView",
|
||||
"Category": "0",
|
||||
|
@ -287,6 +287,18 @@
|
|||
"IsResource": NumberInt(1),
|
||||
"Application": "BA"
|
||||
},
|
||||
{
|
||||
"_id": ObjectId("5bd7b8445fa31256f77e4b15"),
|
||||
"ParentId": "0",
|
||||
"Name": "侧边栏",
|
||||
"Order": NumberInt(55),
|
||||
"Icon": "fa fa-fa",
|
||||
"Url": "~/Admin/Sidebar",
|
||||
"Category": "0",
|
||||
"Target": "_self",
|
||||
"IsResource": NumberInt(1),
|
||||
"Application": "BA"
|
||||
},
|
||||
{
|
||||
"_id": ObjectId("5bd7b8445fa31256f77e4b95"),
|
||||
"ParentId": "0",
|
||||
|
|
|
@ -83,6 +83,7 @@ INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResourc
|
|||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 3, '分配角色', 40, 'fa fa-fa', 'assignRole', '0', 2);
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (0, '图标页面', 50, 'fa fa-fa', '~/Admin/IconView', '0', 1);
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (0, '侧边栏', 55, 'fa fa-fa', '~/Admin/Sidebar', '0', 1);
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '用户管理', 60, 'fa fa-user', '~/Admin/Users', '0');
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '新增', 10, 'fa fa-fa', 'add', '0', 2);
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
|
||||
|
|
|
@ -84,6 +84,7 @@ INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category
|
|||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 3, '删除', 30, 'fa fa-fa', 'del', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 4, '分配角色', 40, 'fa fa-fa', 'assignRole', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (0, '图标页面', 50, 'fa fa-fa', '~/Admin/IconView', '0', 1);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (0, '侧边栏', 55, 'fa fa-fa', '~/Admin/Sidebar', '0', 1);
|
||||
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '用户管理', 60, 'fa fa-user', '~/Admin/Users', '0');
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 1, '新增', 10, 'fa fa-fa', 'add', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 2, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
|
||||
|
|
|
@ -83,6 +83,7 @@ INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category
|
|||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 2, '删除', 30, 'fa fa-fa', 'del', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 3, '分配角色', 40, 'fa fa-fa', 'assignRole', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (0, '图标页面', 50, 'fa fa-fa', '~/Admin/IconView', '0', 1);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (0, '侧边栏', 55, 'fa fa-fa', '~/Admin/Sidebar', '0', 1);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '用户管理', 60, 'fa fa-user', '~/Admin/Users', '0');
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '新增', 10, 'fa fa-fa', 'add', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
|
||||
|
|
|
@ -86,6 +86,7 @@ INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category
|
|||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 2, N'删除', 30, 'fa fa-fa', 'del', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 3, N'分配角色', 40, 'fa fa-fa', 'assignRole', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (0, N'图标页面', 50, 'fa fa-fa', '~/Admin/IconView', '0', 1);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (0, N'侧边栏', 55, 'fa fa-fa', '~/Admin/Sidebar', '0', 1);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'用户管理', 60, N'fa fa-user', N'~/Admin/Users', N'0')
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'新增', 10, 'fa fa-fa', 'add', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 1, N'编辑', 20, 'fa fa-fa', 'edit', '0', 2);
|
||||
|
|
Binary file not shown.
|
@ -92,6 +92,13 @@ namespace Bootstrap.Admin.Controllers
|
|||
[ResponseCache(Duration = 600)]
|
||||
public PartialViewResult IconView() => PartialView("IconView");
|
||||
|
||||
/// <summary>
|
||||
/// 侧边栏局部视图
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <remark>菜单维护页面增删菜单时局部刷新时调用</remark>
|
||||
public PartialViewResult Sidebar() => PartialView("Sidebar", new NavigatorBarModel(this));
|
||||
|
||||
/// <summary>
|
||||
/// 网站设置
|
||||
/// </summary>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
@model NavigatorBarModel
|
||||
@foreach (var menu in Model.Navigations)
|
||||
{
|
||||
@await Html.PartialAsync("SubNavItem", menu)
|
||||
}
|
|
@ -16,10 +16,7 @@
|
|||
<!-- sidebar menu start-->
|
||||
<div class="sidebar">
|
||||
<ul class="nav-sidebar nav nav-pills flex-column flex-nowrap">
|
||||
@foreach (var menu in Model.Navigations)
|
||||
{
|
||||
@await Html.PartialAsync("SubNavItem", menu)
|
||||
}
|
||||
@await Html.PartialAsync("Sidebar", Model)
|
||||
</ul>
|
||||
</div>
|
||||
<!-- sidebar menu end-->
|
||||
|
|
|
@ -252,6 +252,7 @@ $(function () {
|
|||
window.Menu = {
|
||||
url: 'api/Menus',
|
||||
iconView: 'Admin/IconView',
|
||||
sidebar: 'Admin/Sidebar',
|
||||
title: "分配菜单"
|
||||
};
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ $(function () {
|
|||
var $parentMenuID = $('#parentId');
|
||||
var $parentMenuName = $('#parentName');
|
||||
var $category = $('#category');
|
||||
var $sidebar = $('.sidebar');
|
||||
var $sidebar = $('.sidebar .nav-sidebar');
|
||||
|
||||
var initNestMenu = function () {
|
||||
$nestMenuInput = $nestMenu.find('div.dd3-content');
|
||||
|
@ -69,15 +69,7 @@ $(function () {
|
|||
callback: function (result) {
|
||||
if (!result.success) return;
|
||||
if ((result.oper === "save") || result.oper === "del") {
|
||||
if (result.oper === "del") {
|
||||
var $menu = $sidebar.find('#menus_' + result.Id + '');
|
||||
var $menuCount = $menu.parent().parent().parent();
|
||||
$menu.remove();
|
||||
if ($menuCount.find('li').length === 0) {
|
||||
$menuCount.find('.fa-angle-left').remove();
|
||||
|
||||
}
|
||||
}
|
||||
refreshSidebar();
|
||||
$nestMenu.nestMenu(initNestMenu);
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +224,7 @@ $(function () {
|
|||
$dialogNew.find('[data-toggle="LgbValidate"] [aria-describedby]').tooltip('hide');
|
||||
$dialogNew.hide();
|
||||
$dialogMenu.modal('show');
|
||||
}
|
||||
};
|
||||
|
||||
$dialogMenu.on('hidden.bs.modal', function () {
|
||||
var sta = state.pop();
|
||||
|
@ -275,6 +267,19 @@ $(function () {
|
|||
|
||||
$nestMenu.nestMenu(initNestMenu);
|
||||
|
||||
function refreshSidebar() {
|
||||
$.bc({
|
||||
url: Menu.sidebar,
|
||||
contentType: 'text/html',
|
||||
dataType: 'html',
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$sidebar.html(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var $scroll = null;
|
||||
$.bc({
|
||||
url: Menu.iconView,
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
url: options.url, data: iDs, method: 'delete', title: options.delTitle, logData: arrselections,
|
||||
callback: function (result) {
|
||||
if (result) $(options.bootstrapTable).bootstrapTable('refresh');
|
||||
handlerCallback.call(that, null, element, { oper: 'del', success: result });
|
||||
handlerCallback.call(that, null, element, { oper: 'del', success: result, data: iDs });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -240,7 +240,7 @@
|
|||
url: op.url, data: iDs, method: 'delete', title: '删除数据', logData: data,
|
||||
callback: function (result) {
|
||||
if (result) $(op.table).bootstrapTable('refresh');
|
||||
handlerCallback.call(op.src, null, e, { oper: 'del', success: result, Id: row.Id });
|
||||
handlerCallback.call(op.src, null, e, { oper: 'del', success: result, data: data });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Bootstrap.Admin.Controllers.SqlServer
|
|||
[InlineData("Traces", "访问日志")]
|
||||
[InlineData("Logins", "登录日志")]
|
||||
[InlineData("FAIcon", "图标集")]
|
||||
[InlineData("Sidebar", "后台管理")]
|
||||
[InlineData("IconView", "图标分类")]
|
||||
[InlineData("Settings", "网站设置")]
|
||||
[InlineData("Notifications", "通知管理")]
|
||||
|
|
Loading…
Reference in New Issue