diff --git a/DOC/核心设计.EAP b/DOC/核心设计.EAP index 982288d2..0e50a4aa 100644 Binary files a/DOC/核心设计.EAP and b/DOC/核心设计.EAP differ diff --git a/OpenAuth.App/ModuleManagerApp.cs b/OpenAuth.App/ModuleManagerApp.cs index 0d1f7015..eec2904a 100644 --- a/OpenAuth.App/ModuleManagerApp.cs +++ b/OpenAuth.App/ModuleManagerApp.cs @@ -86,5 +86,10 @@ namespace OpenAuth.App } #endregion + public void UpdateMenu(ModuleElement model) + { + UnitWork.Update(u =>u.Id, model); + UnitWork.Save(); + } } } \ No newline at end of file diff --git a/OpenAuth.Mvc/Controllers/ModuleManagerController.cs b/OpenAuth.Mvc/Controllers/ModuleManagerController.cs index bcd97d2f..642527ae 100644 --- a/OpenAuth.Mvc/Controllers/ModuleManagerController.cs +++ b/OpenAuth.Mvc/Controllers/ModuleManagerController.cs @@ -177,6 +177,24 @@ namespace OpenAuth.Mvc.Controllers return JsonHelper.Instance.Serialize(Result); } + //添加菜单 + [HttpPost] + [ValidateInput(false)] + public string UpdateMenu(ModuleElement model) + { + try + { + App.UpdateMenu(model); + } + catch (Exception ex) + { + Result.Code = 500; + Result.Message = ex.Message; + } + return JsonHelper.Instance.Serialize(Result); + } + + /// /// 删除菜单 /// diff --git a/OpenAuth.Mvc/Views/ModuleManager/Index.cshtml b/OpenAuth.Mvc/Views/ModuleManager/Index.cshtml index 0057b396..9f9f56f7 100644 --- a/OpenAuth.Mvc/Views/ModuleManager/Index.cshtml +++ b/OpenAuth.Mvc/Views/ModuleManager/Index.cshtml @@ -5,68 +5,63 @@ -
- - - - - - - - - - - - - - - -
模块名称层级ID模块标识Url图标父节点名称排序号
- - - +
+
+
    +
+
+
+ + + + + + + + + + + + + + +
模块名称层级ID模块标识Url图标父节点名称排序号
+ + + +
- - - - - - - - - - - - - -
名称DomId样式图标排序号
- - - +
+ + + + + + + + +
已有菜单
+ + +
-
- +
- +
-
diff --git a/OpenAuth.Mvc/userJs/modules.js b/OpenAuth.Mvc/userJs/modules.js index 291e95c5..4d5f0ceb 100644 --- a/OpenAuth.Mvc/userJs/modules.js +++ b/OpenAuth.Mvc/userJs/modules.js @@ -73,7 +73,7 @@ layui.config({ reload: load } }(); - + $("#tree").height($("div.layui-table-view").height()); //添加(编辑)模块对话框 var editDlg = function() { var vm = new Vue({ @@ -163,7 +163,7 @@ layui.config({ show({ Id: "", ModuleId:moduleId, - SortNo: 1 + Sort: 1 }); }, update: function (data) { //弹出编辑框 @@ -182,25 +182,22 @@ layui.config({ } }); - //监听菜单表格内部按钮 - table.on('tool(menulist)', function (obj) { - var data = obj.data; - if (obj.event === 'del') { //删除菜单 - openauth.del("/moduleManager/delMenu", - data.Id,menuList); - } - }); - - //监听页面主按钮操作 var active = { - btnDel: function () { //批量删除 + btnDel: function () { //删除模块 var checkStatus = table.checkStatus('mainList') , data = checkStatus.data; openauth.del("/moduleManager/Delete", data.map(function (e) { return e.Id; }), mainList); } + , btnDelMenu: function () { //删除菜单 + var checkStatus = table.checkStatus('menuList') + , data = checkStatus.data; + openauth.del("/moduleManager/DelMenu", + data.map(function (e) { return e.Id; }), + menuList); + } , btnAdd: function () { //添加模块 editDlg.add(); } @@ -223,22 +220,22 @@ layui.config({ editDlg.update(data[0]); } + , btnEditMenu: function () { //编辑菜单 + var checkStatus = table.checkStatus('menuList') + , data = checkStatus.data; + if (data.length != 1) { + layer.msg("请选择编辑的菜单"); + return; + } + meditDlg.update(data[0]); + } + , search: function () { //搜索 mainList({ key: $('#key').val() }); } , btnRefresh: function() { mainList(); } - , btnAccessModule: function () { - var index = layer.open({ - title: "为用户分配模块", - type: 2, - content: "newsAdd.html", - success: function(layero, index) { - - } - }); - } }; $('.toolList .layui-btn').on('click', function () { diff --git a/建表&初始化数据.sql b/建表&初始化数据.sql index a7c96698..6787346c 100644 Binary files a/建表&初始化数据.sql and b/建表&初始化数据.sql differ