用户列表选择,改为左树右表结构,增加组织机构树

This commit is contained in:
thinkgem
2020-04-16 15:38:11 +08:00
parent e70eb14cf7
commit 97f3f48db1
3 changed files with 117 additions and 52 deletions

View File

@@ -344,7 +344,7 @@ public class LoginController extends BaseController{
CookieUtils.setCookie(response, "skinName_" + loginInfo.getId(), skinName); CookieUtils.setCookie(response, "skinName_" + loginInfo.getId(), skinName);
return REDIRECT + adminPath + "/index"; return REDIRECT + adminPath + "/index";
} }
return "modules/sys/sysSwitchSkin"; return "modules/sys/switchSkin";
} }
/** /**

View File

@@ -1,7 +1,25 @@
<% layout('/layouts/default.html', {title: '用户选择', libs: ['dataGrid']}){ %> <% layout('/layouts/default.html', {title: '用户选择', libs: ['layout', 'zTree', 'dataGrid']}){ %>
<div class="main-content"> <div class="ui-layout-west">
<div class="box box-main"> <div class="box box-main">
<div class="box-body"> <div class="box-header">
<div class="box-title">
<i class="fa icon-grid"></i> ${text('组织机构')}
</div>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" id="btnExpand" title="${text('展开')}" style="display:none;"><i class="fa fa-chevron-up"></i></button>
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="${text('折叠')}"><i class="fa fa-chevron-down"></i></button>
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="${text('刷新')}"><i class="fa fa-refresh"></i></button>
</div>
</div>
<div class="ui-layout-content">
<div id="tree" class="ztree"></div>
</div>
</div>
</div>
<div class="ui-layout-center">
<div class="main-content">
<div class="box box-main">
<div class="box-body pb0">
<#form:form id="searchForm" model="${empUser}" action="${ctx}/sys/empUser/listData" method="post" class="form-inline " <#form:form id="searchForm" model="${empUser}" action="${ctx}/sys/empUser/listData" method="post" class="form-inline "
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}"> data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<#form:hidden name="status" value="${isNotBlank(empUser.status) ? empUser.status : '0'}"/> <#form:hidden name="status" value="${isNotBlank(empUser.status) ? empUser.status : '0'}"/>
@@ -51,12 +69,11 @@
<button type="reset" class="btn btn-default btn-sm">重置</button> <button type="reset" class="btn btn-default btn-sm">重置</button>
</div> </div>
</#form:form> </#form:form>
<div class="row"> <div class="col-xs-10 p0 pr10">
<div class="col-xs-10 pr10">
<table id="dataGrid"></table> <table id="dataGrid"></table>
<div id="dataGridPage"></div> <div id="dataGridPage"></div>
</div> </div>
<div class="col-xs-2 pl0"> <div class="col-xs-2 p0">
<div id="selectData" class="tags-input"></div> <div id="selectData" class="tags-input"></div>
</div> </div>
</div> </div>
@@ -65,6 +82,53 @@
</div> </div>
<% } %> <% } %>
<script> <script>
// 初始化布局
$('body').layout({
west__size: 200,
onresize_end: function(){
$('#dataGrid').dataGrid('resize');
}
});
//树结构初始化加载
var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData:{enable:true}},
callback:{onClick:function(event, treeId, treeNode){
tree.expandNode(treeNode);
//$('button[type=reset]').click();
$('#officeCode').val(treeNode.id);
$('#officeName').val(treeNode.name);
page(1);
}}
}, tree, loadTree = function(){
js.ajaxSubmit("${ctx}/sys/office/treeData?___t=" + new Date().getTime(),
{ctrlPermi:'${@Global.getConfig("user.adminCtrlPermi", "2")}'/*1拥有的权限 2管理的权限*/}, function(data){
tree = $.fn.zTree.init($("#tree"), setting, data);//.expandAll(true);
// 展开第一级节点
var nodes = tree.getNodesByParam("level", 0);
for(var i=0; i<nodes.length; i++) {
tree.expandNode(nodes[i], true, false, false);
}
// 展开第二级节点
// nodes = tree.getNodesByParam("level", 1);
// for(var i=0; i<nodes.length; i++) {
// tree.expandNode(nodes[i], true, false, false);
// }
}, null, null, js.text('loading.message'));
};loadTree();
// 工具栏按钮绑定
$('#btnExpand').click(function(){
tree.expandAll(true);
$(this).hide();
$('#btnCollapse').show();
});
$('#btnCollapse').click(function(){
tree.expandAll(false);
$(this).hide();
$('#btnExpand').show();
});
$('#btnRefresh').click(function(){
loadTree();
});
// 加载用户列表
var selectData = ${isNotBlank(selectData!) ? selectData! : "{\}"}, var selectData = ${isNotBlank(selectData!) ? selectData! : "{\}"},
selectNum = 0, dataGrid = $('#dataGrid').dataGrid({ selectNum = 0, dataGrid = $('#dataGrid').dataGrid({
searchForm: $("#searchForm"), searchForm: $("#searchForm"),
@@ -83,8 +147,9 @@ selectNum = 0, dataGrid = $('#dataGrid').dataGrid({
return JSON.stringify(row); return JSON.stringify(row);
}} }}
], ],
// autoGridWidthFix: 100,
autoGridHeight: function(){ autoGridHeight: function(){
var height = $(window).height() - $('#searchForm').height() - $('#dataGridPage').height() - 75; var height = $(window).height() - $('#searchForm').height() - $('#dataGridPage').height() - 70;
$('.tags-input').height($('.ui-jqgrid').height() - 10); $('.tags-input').height($('.ui-jqgrid').height() - 10);
return height; return height;
}, },

View File

@@ -80,7 +80,7 @@ selectNum = 0, dataGrid = $('#dataGrid').dataGrid({
}} }}
], ],
autoGridHeight: function(){ autoGridHeight: function(){
var height = $(window).height() - $('#searchForm').height() - $('#dataGridPage').height() - 75; var height = $(window).height() - $('#searchForm').height() - $('#dataGridPage').height() - 74;
$('.tags-input').height($('.ui-jqgrid').height() - 10); $('.tags-input').height($('.ui-jqgrid').height() - 10);
return height; return height;
}, },