组织机构部门管理增加左树右表风格维护

This commit is contained in:
thinkgem
2019-07-13 23:55:29 +08:00
parent 85cca6de4d
commit 7919ede2f0
6 changed files with 96 additions and 9 deletions

View File

@@ -40,7 +40,8 @@ public class OfficeServiceSupport extends TreeService<OfficeDao, Office>
*/
@Override
public void addDataScopeFilter(Office office, String ctrlPermi) {
office.getSqlMap().getDataScope().addFilter("dsf", "Office", "a.office_code", ctrlPermi);
office.getSqlMap().getDataScope().addFilter("dsf", "Office", "a.office_code",
null, ctrlPermi , "office_user");
}
/**

View File

@@ -23,6 +23,7 @@ import com.jeesite.common.config.Global;
import com.jeesite.common.idgen.IdGen;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.sys.entity.EmpUser;
import com.jeesite.modules.sys.entity.Office;
import com.jeesite.modules.sys.service.OfficeService;
import com.jeesite.modules.sys.utils.UserUtils;
@@ -52,6 +53,15 @@ public class OfficeController extends BaseController {
return officeService.get(officeCode, isNewRecord);
}
/**
* 机构管理主页面
*/
@RequiresPermissions("sys:office:view")
@RequestMapping(value = "index")
public String index(EmpUser empUser, Model model) {
return "modules/sys/officeIndex";
}
/**
* 机构列表
* @param office

View File

@@ -162,7 +162,7 @@ $("#inputForm").validate({
js.showMessage(data.message);
if(data.result == Global.TRUE){
js.closeCurrentTabPage(function(contentWindow){
contentWindow.$('#dataGrid').dataGrid('refreshTreeChildren',
(contentWindow.win||contentWindow).$('#dataGrid').dataGrid('refreshTreeChildren',
$('#parentCode').val(), '${office.id}');
});
}

View File

@@ -0,0 +1,72 @@
<% layout('/layouts/default.html', {title: '用户管理', libs: ['layout','zTree']}){ %>
<div class="ui-layout-west">
<div class="main-content">
<div class="box box-main">
<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>
<div class="ui-layout-center">
<iframe id="mainFrame" name="mainFrame" class="ui-layout-content p0"
src="${ctx}/sys/office/list"></iframe>
</div>
<% } %>
<script>
// 初始化布局
$('body').layout({
west__initClosed: false, // 是否默认关闭
west__size: 180
});
// 主页框架
var win = $("#mainFrame")[0].contentWindow;
// 树结构初始化加载
var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData:{enable:true}},
callback:{onClick:function(event, treeId, treeNode){
tree.expandNode(treeNode);
win.$('button[type=reset]').click();
win.$('#officeCode').val(treeNode.id);
win.page();
}}
}, 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();
});
</script>

View File

@@ -19,22 +19,23 @@
<#form:form id="searchForm" model="${office}" action="${ctx}/sys/office/listData" method="post" class="form-inline hide"
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<#form:hidden name="ctrlPermi" value="${@Global.getConfig('user.adminCtrlPermi', '2')}"/>
<#form:hidden path="officeCode" class="isReset"/>
<div class="form-group">
<label class="control-label">${text('机构代码')}</label>
<div class="control-inline">
<#form:input path="viewCode" maxlength="100" class="form-control width-120"/>
<#form:input path="viewCode" maxlength="100" class="form-control width-90"/>
</div>
</div>
<div class="form-group">
<label class="control-label">${text('机构名称')}</label>
<div class="control-inline">
<#form:input path="officeName" maxlength="100" class="form-control width-120"/>
<div class="control-inline">
<#form:input path="officeName" maxlength="100" class="form-control width-90"/>
</div>
</div>
<div class="form-group">
<label class="control-label">${text('机构全称')}</label>
<div class="control-inline">
<#form:input path="fullName" maxlength="200" class="form-control width-120"/>
<#form:input path="fullName" maxlength="200" class="form-control width-90"/>
</div>
</div>
<div class="form-group">
@@ -64,7 +65,7 @@
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
{header:'${text("机构名称")}', name:'officeName', index:'a.office_name', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
{header:'${text("机构名称")}', name:'officeName', index:'a.office_name', width:300, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '( '+row.viewCode+' ) '+'<a href="${ctx}/sys/office/form?officeCode='+row.officeCode+'" class="btnList" data-title="${text("编辑机构")}">'+(val||row.id)+'</a>';
}},
{header:'${text("机构全称")}', name:'fullName', index:'a.full_name', width:200, align:"left"},
@@ -73,7 +74,7 @@ $('#dataGrid').dataGrid({
return js.getDictLabel(${@DictUtils.getDictListJson('sys_office_type')}, val, '${text("未知")}', true);
}},
{header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:200, align:"left"},
{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:100, align:"left"},
{header:'${text("状态")}', name:'status', index:'a.status', width:80, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_status')}, val, '${text("未知")}', true);
}},
@@ -97,7 +98,10 @@ $('#dataGrid').dataGrid({
defaultExpandLevel: 0, // 默认展开的层次
expandNodeClearPostData: 'viewCode,officeName,fullName,officeType,', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据) // 加载成功后执行事件
ajaxSuccess: function(data){
if ($('#officeCode').val() != ''){
$('#officeCode').val('');
$('#btnExpandTreeNode').click();
}
}
});
</script>