From a0f07f786a876a39dfd9994a3ed51f4c2b79202e Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 28 Feb 2019 16:23:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8B=E6=8B=89=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysDeptController.java | 2 +- .../controller/system/SysMenuController.java | 2 +- .../bootstrap-treetable.css | 2 +- .../main/resources/static/ruoyi/js/ry-ui.js | 28 ++++++++++++++++--- .../resources/templates/system/dept/dept.html | 25 +++-------------- .../resources/templates/system/menu/menu.html | 25 +++-------------- 6 files changed, 35 insertions(+), 49 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 2721dca56..5d1a1dbea 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -107,7 +107,7 @@ public class SysDeptController extends BaseController */ @Log(title = "部门管理", businessType = BusinessType.DELETE) @RequiresPermissions("system:dept:remove") - @PostMapping("/remove/{deptId}") + @GetMapping("/remove/{deptId}") @ResponseBody public AjaxResult remove(@PathVariable("deptId") Long deptId) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index e02263fe6..27be7dbdb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -55,7 +55,7 @@ public class SysMenuController extends BaseController */ @Log(title = "菜单管理", businessType = BusinessType.DELETE) @RequiresPermissions("system:menu:remove") - @PostMapping("/remove/{menuId}") + @GetMapping("/remove/{menuId}") @ResponseBody public AjaxResult remove(@PathVariable("menuId") Long menuId) { diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css index 85b40c788..25c29ddf9 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css @@ -6,7 +6,7 @@ .bootstrap-tree-table .treetable-table thead, .treetable-table tbody tr {display:table;width:100%;table-layout:fixed;} .bootstrap-tree-table .treetable-thead th{line-height:24px;border: 0 !important;border-radius: 4px;border-left:0px solid #e7eaec !important;border-bottom:1px solid #ccc!important;text-align: left;} .bootstrap-tree-table .treetable-thead tr :first-child{border-left:0 !important} -.bootstrap-tree-table .treetable-tbody td{border: 0 !important;border-left:0px solid #e7eaec !important;border-bottom:1px solid #e7eaec!important;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;} +.bootstrap-tree-table .treetable-tbody td{border: 0 !important;border-left:0px solid #e7eaec !important;border-bottom:1px solid #e7eaec!important;white-space: nowrap; text-overflow: ellipsis;} .bootstrap-tree-table .treetable-tbody tr :first-child{border-left:0 !important} .bootstrap-tree-table .treetable-bars .tool-left, .bootstrap-tree-table .treetable-bars .tool-right{margin-top: 10px; margin-bottom: 10px;} .bootstrap-tree-table .treetable-bars .tool-left{float: left;} diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index aa5ec9646..b2c545f8b 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -128,6 +128,18 @@ } return '' + _text +''; }, + // 下拉按钮切换 + dropdownToggle: function (value) { + var actions = []; + actions.push('
'); + actions.push(''); + actions.push(''); + actions.push('
'); + return actions.join(''); + }, // 搜索-默认第一个form search: function(formId) { var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; @@ -621,10 +633,15 @@ // 删除信息 remove: function(id) { $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() { - var url = $.common.isEmpty(id) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{id}", id); - var data = { "ids": id }; - $.operate.submit(url, "post", "json", data); + var url = $.common.isEmpty(id) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{id}", id); + if($.table._option.type == table_type.bootstrapTreeTable) { + $.operate.get(url); + } else { + var data = { "ids": id }; + $.operate.submit(url, "post", "json", data); + } }); + }, // 批量删除信息 removeAll: function() { @@ -743,9 +760,12 @@ }, // 保存结果弹出msg刷新table表格 ajaxSuccess: function (result) { - if (result.code == web_status.SUCCESS) { + if (result.code == web_status.SUCCESS && $.table._option.type == table_type.bootstrapTable) { $.modal.msgSuccess(result.msg); $.table.refresh(); + } else if (result.code == web_status.SUCCESS && $.table._option.type == table_type.bootstrapTreeTable) { + $.modal.msgSuccess(result.msg); + $.treeTable.refresh(); } else { $.modal.alertError(result.msg); } diff --git a/ruoyi-admin/src/main/resources/templates/system/dept/dept.html b/ruoyi-admin/src/main/resources/templates/system/dept/dept.html index f5f4d1298..34caa514f 100644 --- a/ruoyi-admin/src/main/resources/templates/system/dept/dept.html +++ b/ruoyi-admin/src/main/resources/templates/system/dept/dept.html @@ -95,10 +95,10 @@ formatter: function(value, row, index) { if (row.parentId != 0) { var actions = []; - actions.push('编辑 '); - actions.push('新增 '); - actions.push('删除'); - return actions.join(''); + actions.push('编辑'); + actions.push('删除'); + actions.push('添加下级部门'); + return $.table.dropdownToggle(actions.join('')); } else { return ""; } @@ -107,23 +107,6 @@ }; $.treeTable.init(options); }); - - function remove(id) { - $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() { - $.ajax({ - type : 'post', - url: prefix + "/remove/" + id, - success : function(result) { - if (result.code == web_status.SUCCESS) { - $.modal.msgSuccess(result.msg); - $.treeTable.refresh(); - } else { - $.modal.msgError(result.msg); - } - } - }); - }); - } \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/menu/menu.html b/ruoyi-admin/src/main/resources/templates/system/menu/menu.html index 282995b20..753aa3309 100644 --- a/ruoyi-admin/src/main/resources/templates/system/menu/menu.html +++ b/ruoyi-admin/src/main/resources/templates/system/menu/menu.html @@ -131,32 +131,15 @@ align: "left", formatter: function(value, row, index) { var actions = []; - actions.push('编辑 '); - actions.push('新增 '); - actions.push('删除'); - return actions.join(''); + actions.push('编辑 '); + actions.push('删除'); + actions.push('添加下级菜单 '); + return $.table.dropdownToggle(actions.join('')); } }] }; $.treeTable.init(options); }); - - function remove(id) { - $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() { - $.ajax({ - type : 'post', - url: prefix + "/remove/" + id, - success : function(result) { - if (result.code == web_status.SUCCESS) { - $.modal.msgSuccess(result.msg); - $.treeTable.refresh(); - } else { - $.modal.msgError(result.msg); - } - } - }); - }); - } \ No newline at end of file