diff --git a/src/main/webapp/assets/modular/system/organization/organization.js b/src/main/webapp/assets/modular/system/organization/organization.js index 1b8e27e7..de91700f 100644 --- a/src/main/webapp/assets/modular/system/organization/organization.js +++ b/src/main/webapp/assets/modular/system/organization/organization.js @@ -1,40 +1,22 @@ -layui.use(['table', 'form', 'func', 'HttpRequest', 'tree', 'util'], function () { - var $ = layui.$; - var table = layui.table; +layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', 'func', 'tree', 'util'], function () { var form = layui.form; - var func = layui.func; + var table = layui.table; var HttpRequest = layui.HttpRequest; - var xmSelect = layui.xmSelect; + var func = layui.func; var tree = layui.tree; - // 职位表管理 + /** + * 系统管理--用户管理 + */ var Organization = { - tableId: "organizationTable" + tableId: "userTable", //表格id + condition: { + orgName: "", + orgParentId: "", + orgCode: "" + } }; - - /* 渲染树形 */ - function renderTree() { - $.get(Feng.ctxPath + '/hrOrganization/treeLayui', function (data) { - tree.render({ - elem: '#organizationTree', - onlyIconControl: true, - data: data.data, - click: function (rest) { - $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click'); - $(rest.elem).children('.layui-tree-entry').addClass('ew-tree-click'); - table.reload(Organization.tableId, { - where: {organizationId: rest.data.id}, - page: {curr: 1} - }); - } - }); - $('#organizationTree').find('.layui-tree-entry:first>.layui-tree-main>.layui-tree-txt').trigger('click'); - }); - } - - renderTree(); - // 初始化表格的列 Organization.initColumn = function () { return [[ @@ -49,13 +31,22 @@ layui.use(['table', 'form', 'func', 'HttpRequest', 'tree', 'util'], function () ]]; }; + // 选择部门时 + Organization.onClickDept = function (obj) { + console.log(obj); + Organization.condition.orgParentId = obj.data.id; + Organization.search(); + }; + + // 点击查询按钮 Organization.search = function () { var queryData = {}; + queryData['orgParentId'] = Organization.condition.orgParentId; queryData['orgName'] = $("#orgName").val(); + queryData['orgCode'] = $("#orgCode").val(); table.reload(Organization.tableId, { - where: queryData, - page: {curr: 1} + where: queryData, page: {curr: 1} }); }; @@ -122,13 +113,23 @@ layui.use(['table', 'form', 'func', 'HttpRequest', 'tree', 'util'], function () elem: '#' + Organization.tableId, url: Feng.ctxPath + '/hrOrganization/page', page: true, - request: {pageName: 'pageNo', limitName: 'pageSize'}, //自定义分页参数 - height: "full-158", + height: "full-98", cellMinWidth: 100, cols: Organization.initColumn(), parseData: Feng.parseData }); + // 初始化部门树 + var request = new HttpRequest(Feng.ctxPath + '/hrOrganization/treeLayui', 'get', function (data) { + tree.render({ + elem: '#deptTree', + data: data.data, + click: Organization.onClickDept, + onlyIconControl: true + }); + }); + request.start(); + // 搜索按钮点击事件 $('#btnSearch').click(function () { Organization.search(); @@ -161,4 +162,13 @@ layui.use(['table', 'form', 'func', 'HttpRequest', 'tree', 'util'], function () var checked = obj.elem.checked ? 1 : 2; Organization.updateStatus(orgId, checked); }); + }); + +$(function () { + var panehHidden = false; + if ($(this).width() < 769) { + panehHidden = true; + } + $('#myContiner').layout({initClosed: panehHidden, west__size: 260}); +}); \ No newline at end of file diff --git a/src/main/webapp/assets/modular/system/organization/organization_add.js b/src/main/webapp/assets/modular/system/organization/organization_add.js index dd47fac2..e81ff920 100644 --- a/src/main/webapp/assets/modular/system/organization/organization_add.js +++ b/src/main/webapp/assets/modular/system/organization/organization_add.js @@ -4,35 +4,31 @@ layui.use(['form', 'admin', 'HttpRequest', 'xmSelect'], function () { var admin = layui.admin; var HttpRequest = layui.HttpRequest; var xmSelect = layui.xmSelect; - var insXmSel; + var organizationXmSel; - /* 渲染树形 */ - function renderTree() { - $.get(Feng.ctxPath + '/hrOrganization/treeLayui', function (data) { - insXmSel = xmSelect.render({ - el: '#organizationEditParentSel', - height: '250px', - data: data.data, - model: {label: {type: 'text'}}, - prop: {name: 'title', value: 'id'}, - radio: true, - clickClose: true, - tree: { - show: true, - indent: 15, - strict: false, - expandedKeys: true - } - }); + // 初始化组织树 + new HttpRequest(Feng.ctxPath + "/hrOrganization/treeLayui", 'get', function (data) { + organizationXmSel = xmSelect.render({ + el: '#organization', + data: data.data, + model: {label: {type: 'text'}}, + prop: {name: 'title', value: 'id'}, + radio: true, + layVerify: 'required', + clickClose: true, + tree: { + show: true, + indent: 15, + strict: false, + expandedKeys: true + } }); - } - - renderTree(); + }).start(); //表单提交事件 form.on('submit(btnSubmit)', function (data) { //获取机构id - data.field.orgParentId = insXmSel.getValue('valueStr'); + data.field.orgParentId = organizationXmSel.getValue('valueStr'); var request = new HttpRequest(Feng.ctxPath + "/hrOrganization/add", 'post', function (data) { admin.closeThisDialog(); Feng.success("添加成功!"); diff --git a/src/main/webapp/assets/modular/system/organization/organization_edit.js b/src/main/webapp/assets/modular/system/organization/organization_edit.js index 1ace2dda..3a55c222 100644 --- a/src/main/webapp/assets/modular/system/organization/organization_edit.js +++ b/src/main/webapp/assets/modular/system/organization/organization_edit.js @@ -4,41 +4,38 @@ layui.use(['form', 'admin', 'HttpRequest', 'xmSelect'], function () { var admin = layui.admin; var HttpRequest = layui.HttpRequest; var xmSelect = layui.xmSelect; - var insXmSel; + var organizationXmSel; //获取信息详情填充表单 var request = new HttpRequest(Feng.ctxPath + "/hrOrganization/detail?orgId=" + Feng.getUrlParam("orgId"), 'get'); var result = request.start(); form.val('organizationForm', result.data); - renderTree(result.data.orgParentId); - /* 渲染树形 */ - function renderTree(orgParentId) { - $.get(Feng.ctxPath + '/hrOrganization/treeLayui', function (data) { - insXmSel = xmSelect.render({ - el: '#organizationEditParentSel', - height: '250px', - data: data.data, - initValue: [orgParentId], - model: {label: {type: 'text'}}, - prop: {name: 'title', value: 'id'}, - radio: true, - clickClose: true, - tree: { - show: true, - indent: 15, - strict: false, - expandedKeys: true - } - }); + // 初始化组织树 + new HttpRequest(Feng.ctxPath + "/hrOrganization/treeLayui", 'get', function (data) { + organizationXmSel = xmSelect.render({ + el: '#organization', + data: data.data, + initValue: [result.data.orgId], + layVerify: 'required', + model: {label: {type: 'text'}}, + prop: {name: 'title', value: 'id'}, + radio: true, + clickClose: true, + tree: { + show: true, + indent: 15, + strict: false, + expandedKeys: true + } }); - } + }).start(); //表单提交事件 form.on('submit(btnSubmit)', function (data) { //获取机构id - data.field.orgParentId = insXmSel.getValue('valueStr'); + data.field.orgParentId = organizationXmSel.getValue('valueStr'); var request = new HttpRequest(Feng.ctxPath + "/hrOrganization/edit", 'post', function (data) { admin.closeThisDialog(); diff --git a/src/main/webapp/assets/modular/system/user/user.js b/src/main/webapp/assets/modular/system/user/user.js index ec190fa4..73282e2c 100644 --- a/src/main/webapp/assets/modular/system/user/user.js +++ b/src/main/webapp/assets/modular/system/user/user.js @@ -13,9 +13,9 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', var MgrUser = { tableId: "userTable", //表格id condition: { - name: "", - deptId: "", - timeLimit: "" + realName: "", + orgId: "", + account: "" } }; @@ -25,7 +25,7 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', MgrUser.initColumn = function () { //获取多语言 - var langs = layui.data('system').lang; + //var langs = layui.data('system').lang; return [[ {type: 'checkbox'}, @@ -45,7 +45,8 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', * 选择部门时 */ MgrUser.onClickDept = function (obj) { - MgrUser.condition.deptId = obj.data.id; + console.log(obj); + MgrUser.condition.orgId = obj.data.id; MgrUser.search(); }; @@ -54,9 +55,9 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'HttpRequest', */ MgrUser.search = function () { var queryData = {}; - queryData['deptId'] = MgrUser.condition.deptId; - queryData['name'] = $("#name").val(); - queryData['timeLimit'] = $("#timeLimit").val(); + queryData['orgId'] = MgrUser.condition.orgId; + queryData['account'] = $("#account").val(); + queryData['realName'] = $("#realName").val(); table.reload(MgrUser.tableId, { where: queryData, page: {curr: 1} }); diff --git a/src/main/webapp/assets/modular/system/user/user_add.js b/src/main/webapp/assets/modular/system/user/user_add.js index 283aa21c..98aa3ea0 100644 --- a/src/main/webapp/assets/modular/system/user/user_add.js +++ b/src/main/webapp/assets/modular/system/user/user_add.js @@ -7,23 +7,6 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'xmSelect'], func var xmSelect = layui.xmSelect; var organizationXmSel; var positionXmSel; - // 点击部门时 - // $('#deptName').click(function () { - // var formName = encodeURIComponent("parent.UserInfoDlg.data.deptName"); - // var formId = encodeURIComponent("parent.UserInfoDlg.data.deptId"); - // var treeUrl = encodeURIComponent("/dept/tree"); - // - // layer.open({ - // type: 2, - // title: '部门选择', - // area: ['300px', '400px'], - // content: Feng.ctxPath + '/system/commonTree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl, - // end: function () { - // $("#deptId").val(UserInfoDlg.data.deptId); - // $("#deptName").val(UserInfoDlg.data.deptName); - // } - // }); - // }); // 初始化组织树 new HttpRequest(Feng.ctxPath + "/hrOrganization/treeLayui", 'get', function (data) { diff --git a/src/main/webapp/pages/modular/system/organization/organization.html b/src/main/webapp/pages/modular/system/organization/organization.html index 5c941eeb..65d5d9f7 100644 --- a/src/main/webapp/pages/modular/system/organization/organization.html +++ b/src/main/webapp/pages/modular/system/organization/organization.html @@ -1,49 +1,43 @@ -@layout("/layout/_container.html",{js:["/assets/modular/system/organization/organization.js"]}){ +@layout("/layout/_tree_container.html",{plugins:["ztree"],js:["/assets/modular/system/organization/organization.js"]}){