mirror of https://gitee.com/stylefeng/guns
【user】增加左侧机构树的管理功能
parent
1a78b34d31
commit
b897ccd526
|
@ -17,6 +17,55 @@ layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSel
|
|||
tableId: "userTable", //表格id
|
||||
};
|
||||
|
||||
|
||||
var Organization = {
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* 点击新增对话框 */
|
||||
Organization.openAddDlg = function () {
|
||||
func.open({
|
||||
height: 800,
|
||||
title: '添加机构',
|
||||
content: Feng.ctxPath + '/view/organization/addView',
|
||||
tableId: OrganizationUser.tableId,
|
||||
endCallback: function () {
|
||||
renderTree();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 点击编辑对话框 */
|
||||
Organization.openEditDlg = function (data) {
|
||||
func.open({
|
||||
height: 800,
|
||||
title: '修改机构',
|
||||
content: Feng.ctxPath + '/view/organization/editView?orgId=' + data.id,
|
||||
tableId: OrganizationUser.tableId,
|
||||
endCallback: function () {
|
||||
renderTree();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 点击删除 */
|
||||
Organization.delete = function (data) {
|
||||
var operation = function () {
|
||||
var httpRequest = new HttpRequest(Feng.ctxPath + "/hrOrganization/delete", 'post', function (data) {
|
||||
Feng.success("删除成功!");
|
||||
table.reload(OrganizationUser.tableId);
|
||||
//刷新树
|
||||
renderTree();
|
||||
}, function (data) {
|
||||
Feng.error("删除失败!" + data.message + "!");
|
||||
});
|
||||
httpRequest.set(data);
|
||||
httpRequest.start(true);
|
||||
};
|
||||
Feng.confirm("是否删除?", operation);
|
||||
};
|
||||
|
||||
/* 点击新增对话框 */
|
||||
OrganizationUser.openAddDlg = function () {
|
||||
func.open({
|
||||
|
@ -152,6 +201,25 @@ layui.use(['layer', 'form', 'table', 'util', 'admin', 'tree', 'dropdown', 'xmSel
|
|||
return false;
|
||||
});
|
||||
|
||||
/* 添加 */
|
||||
$('#organizationAddBtn').click(function () {
|
||||
Organization.openAddDlg();
|
||||
});
|
||||
|
||||
/* 修改 */
|
||||
$('#organizationEditBtn').click(function () {
|
||||
if (!selObj) return layer.msg('未选择机构', {icon: 2});
|
||||
Organization.openEditDlg(selObj.data)
|
||||
});
|
||||
|
||||
/* 删除 */
|
||||
$('#organizationDelBtn').click(function () {
|
||||
if (!selObj) return layer.msg('未选择机构', {icon: 2});
|
||||
selObj.data.orgId = selObj.data.id;
|
||||
Organization.delete(selObj.data)
|
||||
|
||||
});
|
||||
|
||||
/* 表格工具条点击事件 */
|
||||
table.on('tool(userTable)', function (obj) {
|
||||
if (obj.event === 'edit') { // 修改
|
||||
|
|
|
@ -48,11 +48,15 @@
|
|||
<div class="layui-card-body" style="padding: 10px;">
|
||||
<!-- 树工具栏 -->
|
||||
<div class="layui-form toolbar" id="organizationTreeBar">
|
||||
<!--
|
||||
<button id="organizationAddBtn" class="layui-btn layui-btn-sm icon-btn">
|
||||
<i class="layui-icon"></i>添加
|
||||
</button>
|
||||
-->
|
||||
<button id="organizationEditBtn" class="layui-btn layui-btn-sm layui-btn-warm icon-btn">
|
||||
<i class="layui-icon"></i>修改
|
||||
</button>
|
||||
<button id="organizationDelBtn" class="layui-btn layui-btn-sm layui-btn-danger icon-btn">
|
||||
<i class="layui-icon"></i>删除
|
||||
</button>
|
||||
</div>
|
||||
<!-- 左树 -->
|
||||
<div id="organizationTree"></div>
|
||||
|
|
Loading…
Reference in New Issue