优化树表代码生成,展开节点清理请求参数数据时排除状态查询条件;查询树表优化,编辑后支持刷新列表中无父节点数据;

This commit is contained in:
thinkgem
2018-11-30 21:50:20 +08:00
parent aef4837827
commit ac04d84c53
7 changed files with 21 additions and 15 deletions

View File

@@ -89,7 +89,7 @@ public class ${ClassName}Controller extends BaseController {
${className}.setParentCode(${ClassName}.ROOT_CODE);
}
<% for(c in table.columnList){ %>
<% if(c.isQuery == "1" && !c.isTreeEntityColumn){ %>
<% if(c.isQuery == "1" && !c.isTreeEntityColumn && c.attrName != 'status'){ %>
if (StringUtils.isNotBlank(${className}.${c.attrNameForGetMethod})){
${className}.setParentCode(null);
}

View File

@@ -130,7 +130,7 @@ $('#dataGrid').dataGrid({
defaultExpandLevel: 0, // 默认展开的层次
expandNodeClearPostData: '<%
for(c in table.columnList){
if(c.isQuery == "1" && !c.isTreeEntityColumn){
if(c.isQuery == "1" && !c.isTreeEntityColumn && c.attrName != 'status'){
print(c.attrName + ',');
}
} %>', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据)

View File

@@ -87,7 +87,7 @@ public class ${ClassName}Controller extends BaseController {
${className}.setParentCode(${ClassName}.ROOT_CODE);
}
<% for(c in table.columnList){ %>
<% if(c.isQuery == "1" && !c.isTreeEntityColumn){ %>
<% if(c.isQuery == "1" && !c.isTreeEntityColumn && c.attrName != 'status'){ %>
if (StringUtils.isNotBlank(${className}.${c.attrNameForGetMethod})){
${className}.setParentCode(null);
}

View File

@@ -111,7 +111,7 @@ $('#dataGrid').dataGrid({
defaultExpandLevel: 0, // 默认展开的层次
expandNodeClearPostData: '<%
for(c in table.columnList){
if(c.isQuery == "1" && !c.isTreeEntityColumn){
if(c.isQuery == "1" && !c.isTreeEntityColumn && c.attrName != 'status'){
print(c.attrName + ',');
}
} %>', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据)

View File

@@ -6,7 +6,7 @@ set global read_only=0;
create user 'jeesite'@'%' identified by 'jeesite';
create database jeesite DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database jeesite DEFAULT CHARSET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
grant all privileges on jeesite.* to 'jeesite'@'%' identified by 'jeesite';

View File

@@ -69,9 +69,6 @@ public class TestTreeController extends BaseController {
if (StringUtils.isNotBlank(testTree.getTreeName())){
testTree.setParentCode(null);
}
if (StringUtils.isNotBlank(testTree.getStatus())){
testTree.setParentCode(null);
}
if (StringUtils.isNotBlank(testTree.getRemarks())){
testTree.setParentCode(null);
}

View File

@@ -12,6 +12,7 @@
<a href="#" class="btn btn-default" id="btnCollapseTreeNode" title="${text('折叠全部')}"><i class="fa fa-angle-double-up"></i> ${text('折叠')}</a>
<% if(hasPermi('test:testTree:edit')){ %>
<a href="${ctx}/test/testTree/form" class="btn btn-default btnTool" title="${text('新增数据')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<a href="#" class="btn btn-default" id="btnFixTreeData" title="修复树表数据包含字段parentCodes、treeLeaf、treeLevel、treeSorts、treeNames"><i class="fa fa-refresh"></i> 修复</a>
<% } %>
</div>
</div>
@@ -24,17 +25,17 @@
<#form:input path="treeName" maxlength="200" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<label class="control-label">${text('状态')}</label>
<div class="control-inline width-120">
<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="control-label">${text('备注信息')}</label>
<div class="control-inline">
<#form:input path="remarks" maxlength="500" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<label class="control-label">${text('状态')}</label>
<div class="control-inline width-120">
<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control"/>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
@@ -79,9 +80,17 @@ $('#dataGrid').dataGrid({
],
treeGrid: true, // 启用树结构表格
defaultExpandLevel: 0, // 默认展开的层次
expandNodeClearPostData: 'treeName,status,remarks,', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据) // 加载成功后执行事件
expandNodeClearPostData: 'treeName,remarks,', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据) // 加载成功后执行事件
ajaxSuccess: function(data){
}
});
// 修复树表数据包含字段parentCodes、treeLeaf、treeLevel、treeSorts、treeNames
$("#btnFixTreeData").click(function(){
js.ajaxSubmit("${ctx}/test/testTree/fixTreeData", function(data){
js.showMessage(data.message);
});
return false;
});
</script>