增加树表的左树右表生成模板
This commit is contained in:
@@ -61,11 +61,11 @@ var setting = {
|
|||||||
for (var i = 0; i < nodes.length; i++) {
|
for (var i = 0; i < nodes.length; i++) {
|
||||||
tree.expandNode(nodes[i], true, false, false);
|
tree.expandNode(nodes[i], true, false, false);
|
||||||
}
|
}
|
||||||
// 展开第二级节点
|
// // 展开第二级节点
|
||||||
nodes = tree.getNodesByParam("level", 1);
|
// nodes = tree.getNodesByParam("level", 1);
|
||||||
for (var i = 0; i < nodes.length; i++) {
|
// for (var i = 0; i < nodes.length; i++) {
|
||||||
tree.expandNode(nodes[i], true, false, false);
|
// tree.expandNode(nodes[i], true, false, false);
|
||||||
}
|
// }
|
||||||
}, null, null, js.text('loading.message'));
|
}, null, null, js.text('loading.message'));
|
||||||
};
|
};
|
||||||
loadTree();
|
loadTree();
|
||||||
|
|||||||
@@ -75,6 +75,18 @@ public class ${ClassName}Controller extends BaseController {
|
|||||||
return ${className}Service.getAndValid(${className});
|
return ${className}Service.getAndValid(${className});
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理主页
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
|
@RequestMapping(value = "index")
|
||||||
|
public String index(${ClassName} ${className}, Model model) {
|
||||||
|
model.addAttribute("${className}", ${className});
|
||||||
|
return "${lastPackageName}/${viewPrefix}Index";
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询列表
|
* 查询列表
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ $("#inputForm").validate({
|
|||||||
if(data.result == Global.TRUE){
|
if(data.result == Global.TRUE){
|
||||||
js.closeCurrentTabPage(function(contentWindow){
|
js.closeCurrentTabPage(function(contentWindow){
|
||||||
<% if(table.isTreeEntity){ %>
|
<% if(table.isTreeEntity){ %>
|
||||||
contentWindow.$('#dataGrid').dataGrid('refreshTreeChildren',
|
(contentWindow.win||contentWindow).$('#dataGrid').dataGrid('refreshTreeChildren',
|
||||||
$('#parentCode').val(), '\${${className}.id}');
|
$('#parentCode').val(), '\${${className}.id}');
|
||||||
<% }else{ %>
|
<% }else{ %>
|
||||||
contentWindow.page();
|
contentWindow.page();
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||||
|
No deletion without permission, or be held responsible to law. -->
|
||||||
|
<template>
|
||||||
|
<name>vueIndex</name>
|
||||||
|
<filePath>vue/src/views/${urlPrefix}</filePath>
|
||||||
|
<fileName>index.vue</fileName>
|
||||||
|
<content><![CDATA[
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
\<% layout('/layouts/default.html', {title: '${functionNameSimple}管理', 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('${functionNameSimple}')}
|
||||||
|
</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}/${urlPrefix}/list"></iframe>
|
||||||
|
</div>
|
||||||
|
\<% } %>
|
||||||
|
<script>
|
||||||
|
// 初始化布局
|
||||||
|
$('body').layout({
|
||||||
|
west__initClosed: $(window).width() <= 767, // 是否默认关闭
|
||||||
|
west__size: 200
|
||||||
|
});
|
||||||
|
// 主页框架
|
||||||
|
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();
|
||||||
|
<% for(pk in table.pkList){ %>
|
||||||
|
win.$('#${pk.attrName}').val(treeNode.id);
|
||||||
|
<% } %>
|
||||||
|
win.page();
|
||||||
|
}}
|
||||||
|
}, tree, loadTree = function(){
|
||||||
|
js.ajaxSubmit("\${ctx}/${urlPrefix}/treeData?___t=" + new Date().getTime(), 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();
|
||||||
|
});
|
||||||
|
// 调用子页分页函数
|
||||||
|
function page(){
|
||||||
|
win.page();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<% } %>
|
||||||
|
]]>
|
||||||
|
</content>
|
||||||
|
</template>
|
||||||
@@ -75,6 +75,18 @@ public class ${ClassName}Controller extends BaseController {
|
|||||||
return ${className}Service.getAndValid(${className});
|
return ${className}Service.getAndValid(${className});
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理主页
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
|
@RequestMapping(value = "index")
|
||||||
|
public String index(${ClassName} ${className}, Model model) {
|
||||||
|
model.addAttribute("${className}", ${className});
|
||||||
|
return "${lastPackageName}/${viewPrefix}Index";
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询列表
|
* 查询列表
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ $("#inputForm").validate({
|
|||||||
if(data.result == Global.TRUE){
|
if(data.result == Global.TRUE){
|
||||||
js.closeCurrentTabPage(function(contentWindow){
|
js.closeCurrentTabPage(function(contentWindow){
|
||||||
<% if(table.isTreeEntity){ %>
|
<% if(table.isTreeEntity){ %>
|
||||||
contentWindow.$('#dataGrid').dataGrid('refreshTreeChildren',
|
(contentWindow.win||contentWindow).$('#dataGrid').dataGrid('refreshTreeChildren',
|
||||||
$('#parentCode').val(), '\${${className}.id}');
|
$('#parentCode').val(), '\${${className}.id}');
|
||||||
<% }else{ %>
|
<% }else{ %>
|
||||||
contentWindow.page();
|
contentWindow.page();
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
<${'#'}form:form id="searchForm" model="\${${className}}" action="\${ctx}/${urlPrefix}/listData" method="post" class="form-inline hide"
|
<${'#'}form:form id="searchForm" model="\${${className}}" action="\${ctx}/${urlPrefix}/listData" method="post" class="form-inline hide"
|
||||||
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}">
|
||||||
<% for(c in table.columnList){ %>
|
<% for(c in table.columnList){ %>
|
||||||
<% if(c.isQuery == "1" && !c.isTreeEntityColumn){ %>
|
<% if(table.isTreeEntity && c.isPk == "1"){ %>
|
||||||
|
<${'#'}form:hidden path="${c.attrName}"/>
|
||||||
|
<% }else if(c.isQuery == "1" && !c.isTreeEntityColumn){ %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label">\${text('${c.columnLabel}')}:</label>
|
<label class="control-label">\${text('${c.columnLabel}')}:</label>
|
||||||
<% if(c.showType == 'input' || c.showType == 'textarea'){ %>
|
<% if(c.showType == 'input' || c.showType == 'textarea'){ %>
|
||||||
|
|||||||
@@ -69,6 +69,18 @@ public class ${ClassName}Controller extends BaseController {
|
|||||||
return ${className}Service.getAndValid(${className});
|
return ${className}Service.getAndValid(${className});
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
|
<% if(table.isTreeEntity){ %>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理主页
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
|
@RequestMapping(value = "index")
|
||||||
|
public String index(${ClassName} ${className}, Model model) {
|
||||||
|
model.addAttribute("${className}", ${className});
|
||||||
|
return "${lastPackageName}/${viewPrefix}Index";
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询列表
|
* 查询列表
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ $("#inputForm").validate({
|
|||||||
js.showMessage(data.message);
|
js.showMessage(data.message);
|
||||||
if(data.result == Global.TRUE){
|
if(data.result == Global.TRUE){
|
||||||
js.closeCurrentTabPage(function(contentWindow){
|
js.closeCurrentTabPage(function(contentWindow){
|
||||||
contentWindow.$('#dataGrid').dataGrid('refreshTreeChildren',
|
(contentWindow.win||contentWindow).$('#dataGrid').dataGrid('refreshTreeChildren',
|
||||||
$('#parentCode').val(), '${area.id}');
|
$('#parentCode').val(), '${area.id}');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,4 +68,8 @@ $('#btnCollapse').click(function(){
|
|||||||
$('#btnRefresh').click(function(){
|
$('#btnRefresh').click(function(){
|
||||||
loadTree();
|
loadTree();
|
||||||
});
|
});
|
||||||
|
// 调用子页分页函数
|
||||||
|
function page(){
|
||||||
|
win.page();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ $("#inputForm").validate({
|
|||||||
js.showMessage(data.message);
|
js.showMessage(data.message);
|
||||||
if(data.result == Global.TRUE){
|
if(data.result == Global.TRUE){
|
||||||
js.closeCurrentTabPage(function(contentWindow){
|
js.closeCurrentTabPage(function(contentWindow){
|
||||||
contentWindow.$('#dataGrid').dataGrid('refreshTreeChildren',
|
(contentWindow.win||contentWindow).$('#dataGrid').dataGrid('refreshTreeChildren',
|
||||||
$('#parentCode').val(), '${company.id}');
|
$('#parentCode').val(), '${company.id}');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,4 +69,8 @@ $('#btnCollapse').click(function(){
|
|||||||
$('#btnRefresh').click(function(){
|
$('#btnRefresh').click(function(){
|
||||||
loadTree();
|
loadTree();
|
||||||
});
|
});
|
||||||
|
// 调用子页分页函数
|
||||||
|
function page(){
|
||||||
|
win.page();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -69,4 +69,8 @@ $('#btnCollapse').click(function(){
|
|||||||
$('#btnRefresh').click(function(){
|
$('#btnRefresh').click(function(){
|
||||||
loadTree();
|
loadTree();
|
||||||
});
|
});
|
||||||
|
// 调用子页分页函数
|
||||||
|
function page(){
|
||||||
|
win.page();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user