新增下拉按钮切换

pull/74/head
RuoYi 2019-02-28 16:23:09 +08:00
parent 8a37d2ae24
commit a0f07f786a
6 changed files with 35 additions and 49 deletions

View File

@ -107,7 +107,7 @@ public class SysDeptController extends BaseController
*/ */
@Log(title = "部门管理", businessType = BusinessType.DELETE) @Log(title = "部门管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dept:remove") @RequiresPermissions("system:dept:remove")
@PostMapping("/remove/{deptId}") @GetMapping("/remove/{deptId}")
@ResponseBody @ResponseBody
public AjaxResult remove(@PathVariable("deptId") Long deptId) public AjaxResult remove(@PathVariable("deptId") Long deptId)
{ {

View File

@ -55,7 +55,7 @@ public class SysMenuController extends BaseController
*/ */
@Log(title = "菜单管理", businessType = BusinessType.DELETE) @Log(title = "菜单管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:menu:remove") @RequiresPermissions("system:menu:remove")
@PostMapping("/remove/{menuId}") @GetMapping("/remove/{menuId}")
@ResponseBody @ResponseBody
public AjaxResult remove(@PathVariable("menuId") Long menuId) public AjaxResult remove(@PathVariable("menuId") Long menuId)
{ {

View File

@ -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-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 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-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-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, .bootstrap-tree-table .treetable-bars .tool-right{margin-top: 10px; margin-bottom: 10px;}
.bootstrap-tree-table .treetable-bars .tool-left{float: left;} .bootstrap-tree-table .treetable-bars .tool-left{float: left;}

View File

@ -128,6 +128,18 @@
} }
return '<a href="#" class="tooltip-show" data-toggle="tooltip" title="' + _value + '">' + _text +'</a>'; return '<a href="#" class="tooltip-show" data-toggle="tooltip" title="' + _value + '">' + _text +'</a>';
}, },
// 下拉按钮切换
dropdownToggle: function (value) {
var actions = [];
actions.push('<div class="btn-group">');
actions.push('<button type="button" class="btn btn-xs dropdown-toggle" data-toggle="dropdown" aria-expanded="false">');
actions.push('<i class="fa fa-cog"></i>&nbsp;<span class="fa fa-chevron-down"></span></button>');
actions.push('<ul class="dropdown-menu">');
actions.push(value.replace(/<a/g,"<li><a").replace(/<\/a>/g,"</a></li>"));
actions.push('</ul>');
actions.push('</div>');
return actions.join('');
},
// 搜索-默认第一个form // 搜索-默认第一个form
search: function(formId) { search: function(formId) {
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
@ -622,9 +634,14 @@
remove: function(id) { remove: function(id) {
$.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() { $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
var url = $.common.isEmpty(id) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{id}", id); 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 }; var data = { "ids": id };
$.operate.submit(url, "post", "json", data); $.operate.submit(url, "post", "json", data);
}
}); });
}, },
// 批量删除信息 // 批量删除信息
removeAll: function() { removeAll: function() {
@ -743,9 +760,12 @@
}, },
// 保存结果弹出msg刷新table表格 // 保存结果弹出msg刷新table表格
ajaxSuccess: function (result) { 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); $.modal.msgSuccess(result.msg);
$.table.refresh(); $.table.refresh();
} else if (result.code == web_status.SUCCESS && $.table._option.type == table_type.bootstrapTreeTable) {
$.modal.msgSuccess(result.msg);
$.treeTable.refresh();
} else { } else {
$.modal.alertError(result.msg); $.modal.alertError(result.msg);
} }

View File

@ -95,10 +95,10 @@
formatter: function(value, row, index) { formatter: function(value, row, index) {
if (row.parentId != 0) { if (row.parentId != 0) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.deptId + '\')"><i class="fa fa-edit">编辑</i></a> '); actions.push('<a class="' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.deptId + '\')"><i class="fa fa-edit"></i>编辑</a>');
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.deptId + '\')"><i class="fa fa-plus">新增</i></a> '); actions.push('<a class="' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.deptId + '\')"><i class="fa fa-trash"></i>删除</a>');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.deptId + '\')"><i class="fa fa-remove">删除</i></a>'); actions.push('<a class="' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.deptId + '\')"><i class="fa fa-plus"></i>添加下级部门</a>');
return actions.join(''); return $.table.dropdownToggle(actions.join(''));
} else { } else {
return ""; return "";
} }
@ -107,23 +107,6 @@
}; };
$.treeTable.init(options); $.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);
}
}
});
});
}
</script> </script>
</body> </body>
</html> </html>

View File

@ -131,32 +131,15 @@
align: "left", align: "left",
formatter: function(value, row, index) { formatter: function(value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.menuId + '\')"><i class="fa fa-edit"></i>编辑</a> '); actions.push('<a class="' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.menuId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.menuId + '\')"><i class="fa fa-plus"></i>新增</a> '); actions.push('<a class="' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.menuId + '\')"><i class="fa fa-trash"></i>删除</a>');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.menuId + '\')"><i class="fa fa-remove"></i>删除</a>'); actions.push('<a class="' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.menuId + '\')"><i class="fa fa-plus"></i>添加下级菜单</a> ');
return actions.join(''); return $.table.dropdownToggle(actions.join(''));
} }
}] }]
}; };
$.treeTable.init(options); $.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);
}
}
});
});
}
</script> </script>
</body> </body>
</html> </html>