新增下拉按钮切换

dep_wangsr
RuoYi 6 years ago committed by Limy
parent 42ed560201
commit 9ed3396c29

@ -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)
{

@ -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)
{

@ -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;}

@ -128,6 +128,18 @@
}
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
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);
}

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

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