代码优化,减少一些js警告的提示。建议设置IDE忽略一些无关紧要的警告提示。

This commit is contained in:
thinkgem
2018-12-16 16:18:33 +08:00
parent c7a9ccf615
commit 1724e3ead1
13 changed files with 256 additions and 256 deletions

View File

@@ -92,7 +92,7 @@
<span class="required hide">*</span> ${text('日期时间')}<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="testDatetime" readonly="true" maxlength="20" class="form-control Wdate"
dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:true});"/>
</div>
</div>
</div>
@@ -204,11 +204,11 @@ $("#testDataChildDataGrid").dataGrid({
columnModel: [
{header:'状态', name:'status', editable:true, hidden:true},
{header:'主键', name:'id', editable:true, hidden:true},
{header:'${text('排序号')}', name:'testSort', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'11', 'class':'form-control digits'}},
{header:'${text('父表主键')}', name:'testData.id', editable:true, hidden:true},
{header:'${text('单行文本')}', name:'testInput', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'}},
{header:'${text('多行文本')}', name:'testTextarea', width:150, editable:true, edittype:'textarea', editoptions:{'maxlength':'200', 'class':'form-control', 'rows':'1'}},
{header:'${text('下拉框')}', name:'testSelect', width:100,
{header:'${text("排序号")}', name:'testSort', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'11', 'class':'form-control digits'}},
{header:'${text("父表主键")}', name:'testData.id', editable:true, hidden:true},
{header:'${text("单行文本")}', name:'testInput', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'}},
{header:'${text("多行文本")}', name:'testTextarea', width:150, editable:true, edittype:'textarea', editoptions:{'maxlength':'200', 'class':'form-control', 'rows':'1'}},
{header:'${text("下拉框")}', name:'testSelect', width:100,
editable:true, edittype:'select', editoptions:{'class':'form-control',
items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
@@ -216,7 +216,7 @@ $("#testDataChildDataGrid").dataGrid({
}
}
},
{header:'${text('下拉多选')}', name:'testSelectMultiple', width:100,
{header:'${text("下拉多选")}', name:'testSelectMultiple', width:100,
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
@@ -224,7 +224,7 @@ $("#testDataChildDataGrid").dataGrid({
}
}
},
{header:'${text('单选框')}', name:'testRadio', width:100,
{header:'${text("单选框")}', name:'testRadio', width:100,
editable:true, edittype:'select', editoptions:{'class':'form-control',
items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
@@ -232,7 +232,7 @@ $("#testDataChildDataGrid").dataGrid({
}
}
},
{header:'${text('复选框')}', name:'testCheckbox', width:100,
{header:'${text("复选框")}', name:'testCheckbox', width:100,
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
@@ -240,23 +240,23 @@ $("#testDataChildDataGrid").dataGrid({
}
}
},
{header:'${text('日期选择')}', name:'testDate', width:150,
{header:'${text("日期选择")}', name:'testDate', width:150,
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},
editable:true, edittype:'text', editoptions:{'class':'form-control Wdate', 'readonly':'true',
dataInit: function(element){ $(element).on('focus', function(){
WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});
WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});
});
}}
},
{header:'${text('日期时间')}', name:'testDatetime', width:150,
{header:'${text("日期时间")}', name:'testDatetime', width:150,
formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d H:i:s'},
editable:true, edittype:'text', editoptions:{'class':'form-control Wdate', 'readonly':'true',
dataInit: function(element){ $(element).on('focus', function(){
WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});
WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:true});
});
}}
},
{header:'${text('用户选择')}', name:'testUser', width:150,
{header:'${text("用户选择")}', name:'testUser', width:150,
formatter: function(val, obj, row, act){
return js.val(row, 'testUser.userCode')+'|'+js.val(row, 'testUser.userName');
}, editable: true, edittype: "custom", editoptions: {
@@ -270,7 +270,7 @@ $("#testDataChildDataGrid").dataGrid({
}
}
},
{header:'${text('机构选择')}', name:'testOffice', width:150,
{header:'${text("机构选择")}', name:'testOffice', width:150,
formatter: function(val, obj, row, act){
return js.val(row, 'testOffice.officeCode')+'|'+js.val(row, 'testOffice.officeName');
}, editable: true, edittype: "custom", editoptions: {
@@ -284,7 +284,7 @@ $("#testDataChildDataGrid").dataGrid({
}
}
},
{header:'${text('区域选择')}', name:'testAreaCode', width:150,
{header:'${text("区域选择")}', name:'testAreaCode', width:150,
formatter: function(val, obj, row, act){
return js.val(row, 'testAreaCode')+'|'+js.val(row, 'testAreaName');
}, editable: true, edittype: "custom", editoptions: {
@@ -298,12 +298,12 @@ $("#testDataChildDataGrid").dataGrid({
}
}
},
{header:'${text('操作')}', name:'actions', width:80, sortable:false, fixed:true, formatter: function(val, obj, row, act){
{header:'${text("操作")}', name:'actions', width:80, sortable:false, fixed:true, formatter: function(val, obj, row, act){
var actions = [];
if (val == 'new'){
actions.push('<a href="#" onclick="js.confirm(\'${text('你确认要删除这条数据吗')}\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗")}\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
}else{
actions.push('<a href="#" onclick="js.confirm(\'${text('你确认要删除这条数据吗')}\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'})});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗")}\', function(){$(\'#testDataChildDataGrid\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'})});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');return false;"><i class="fa fa-trash-o"></i></a>&nbsp;');
}
return actions.join('');
}, editoptions: {defaultValue: 'new'}}

View File

@@ -118,56 +118,56 @@
</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
{header:'${text('单行文本')}', name:'testInput', index:'a.test_input', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" data-title="${text('编辑数据')}">'+(val||row.id)+'</a>';
}},
{header:'${text('多行文本')}', name:'testTextarea', index:'a.test_textarea', width:150, align:"left"},
{header:'${text('下拉框')}', name:'testSelect', index:'a.test_select', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '${text('未知')}', true);
}},
{header:'${text('下拉多选')}', name:'testSelectMultiple', index:'a.test_select_multiple', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '${text('未知')}', true);
}},
{header:'${text('单选框')}', name:'testRadio', index:'a.test_radio', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '${text('未知')}', true);
}},
{header:'${text('复选框')}', name:'testCheckbox', index:'a.test_checkbox', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '${text('未知')}', true);
}},
{header:'${text('日期选择')}', name:'testDate', index:'a.test_date', width:150, align:"center"},
{header:'${text('日期时间')}', name:'testDatetime', index:'a.test_datetime', width:150, align:"center"},
{header:'${text('用户选择')}', name:'testUser.userName', index:'a.test_user_code', width:150, align:"center"},
{header:'${text('机构选择')}', name:'testOffice.officeName', index:'a.test_office_code', width:150, align:"center"},
{header:'${text('区域选择')}', name:'testAreaName', index:'a.test_area_code', width:150, align:"center"},
{header:'${text('区域名称')}', name:'testAreaName', index:'a.test_area_name', width:150, align:"left"},
{header:'${text('状态')}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text('未知')}', true);
}},
{header:'${text('创建时间')}', name:'createDate', index:'a.create_date', width:150, align:"center"},
{header:'${text('备注信息')}', name:'remarks', index:'a.remarks', width:150, align:"left"},
{header:'${text('操作')}', name:'actions', width:200, sortable:false, title:false, formatter: function(val, obj, row, act){
var actions = [];
<% if(hasPermi('test:testData:edit')){ %>
actions.push('<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" title="${text('编辑数据')}"><i class="fa fa-pencil"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/test/testData/disable?id='+row.id+'" class="btnList" title="${text('停用数据')}" data-confirm="${text('确认要停用该数据吗')}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/test/testData/enable?id='+row.id+'" class="btnList" title="${text('启用数据')}" data-confirm="${text('确认要启用该数据吗')}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/test/testData/delete?id='+row.id+'" class="btnList" title="${text('删除数据')}" data-confirm="${text('确认要删除该数据吗')}"><i class="fa fa-trash-o"></i></a>&nbsp;');
<% } %>
return actions.join('');
}}
],
// 加载成功后执行事件
ajaxSuccess: function(data){
}
});
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
{header:'${text("单行文本")}', name:'testInput', index:'a.test_input', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" data-title="${text("编辑数据")}">'+(val||row.id)+'</a>';
}},
{header:'${text("多行文本")}', name:'testTextarea', index:'a.test_textarea', width:150, align:"left"},
{header:'${text("下拉框")}', name:'testSelect', index:'a.test_select', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '${text("未知")}', true);
}},
{header:'${text("下拉多选")}', name:'testSelectMultiple', index:'a.test_select_multiple', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '${text("未知")}', true);
}},
{header:'${text("单选框")}', name:'testRadio', index:'a.test_radio', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '${text("未知")}', true);
}},
{header:'${text("复选框")}', name:'testCheckbox', index:'a.test_checkbox', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '${text("未知")}', true);
}},
{header:'${text("日期选择")}', name:'testDate', index:'a.test_date', width:150, align:"center"},
{header:'${text("日期时间")}', name:'testDatetime', index:'a.test_datetime', width:150, align:"center"},
{header:'${text("用户选择")}', name:'testUser.userName', index:'a.test_user_code', width:150, align:"center"},
{header:'${text("机构选择")}', name:'testOffice.officeName', index:'a.test_office_code', width:150, align:"center"},
{header:'${text("区域选择")}', name:'testAreaName', index:'a.test_area_code', width:150, align:"center"},
{header:'${text("区域名称")}', name:'testAreaName', index:'a.test_area_name', width:150, align:"left"},
{header:'${text("状态")}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text("未知")}', true);
}},
{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
{header:'${text("操作")}', name:'actions', width:200, sortable:false, title:false, formatter: function(val, obj, row, act){
var actions = [];
<% if(hasPermi('test:testData:edit')){ %>
actions.push('<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" title="${text("编辑数据")}"><i class="fa fa-pencil"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/test/testData/disable?id='+row.id+'" class="btnList" title="${text("停用数据")}" data-confirm="${text("确认要停用该数据吗")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/test/testData/enable?id='+row.id+'" class="btnList" title="${text("启用数据")}" data-confirm="${text("确认要启用该数据吗")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/test/testData/delete?id='+row.id+'" class="btnList" title="${text("删除数据")}" data-confirm="${text("确认要删除该数据吗")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
<% } %>
return actions.join('');
}}
],
// 加载成功后执行事件
ajaxSuccess: function(data){
}
});
</script>

View File

@@ -23,27 +23,27 @@
class="" allowClear="true" canSelectRoot="true" canSelectParent="true"/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required ">*</span> ${text('节点编码')}<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:hidden path="isNewRecord"/>
<#form:input path="treeCode" maxlength="64" readonly="${!testTree.isNewRecord}" class="form-control required abc"/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required ">*</span> ${text('节点编码')}<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:hidden path="isNewRecord"/>
<#form:input path="treeCode" maxlength="64" readonly="${!testTree.isNewRecord}" class="form-control required abc"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required ">*</span> ${text('节点名称')}<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="treeName" maxlength="200" class="form-control required"/>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required ">*</span> ${text('节点名称')}<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="treeName" maxlength="200" class="form-control required"/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
@@ -53,9 +53,9 @@
<#form:input path="treeSort" class="form-control required digits"/>
</div>
</div>
</div>
</div>
<div class="row">
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2" title="">
@@ -69,7 +69,7 @@
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2">图片上传:</label>
<label class="control-label col-sm-2">${text('图片上传')}</label>
<div class="col-sm-10">
<#form:fileupload id="uploadImage" bizKey="${testTree.id}" bizType="testTree_image"
uploadType="image" class="" readonly="false"/>
@@ -80,7 +80,7 @@
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2">附件上传:</label>
<label class="control-label col-sm-2">${text('附件上传')}</label>
<div class="col-sm-10">
<#form:fileupload id="uploadFile" bizKey="${testTree.id}" bizType="testTree_file"
uploadType="all" class="" readonly="false"/>

View File

@@ -11,9 +11,9 @@
<a href="#" class="btn btn-default" id="btnExpandTreeNode" title="${text('展开一级')}"><i class="fa fa-angle-double-down"></i> ${text('展开')}</a>
<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>
<% } %>
<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>
<div class="box-body">
@@ -30,12 +30,12 @@
<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">
<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>
@@ -47,50 +47,50 @@
</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
{header:'${text('节点名称')}', name:'treeName', index:'a.tree_name', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '( '+row.treeCode+' ) '+'<a href="${ctx}/test/testTree/form?treeCode='+row.treeCode+'" class="btnList" data-title="${text('编辑数据')}">'+(val||row.id)+'</a>';
}},
{header:'${text('本级排序号')}', name:'treeSort', index:'a.tree_sort', width:150, align:"center"},
{header:'${text('节点名称')}', name:'treeName', index:'a.tree_name', width:150, align:"left"},
{header:'${text('状态')}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text('未知')}', true);
}},
{header:'${text('创建时间')}', name:'createDate', index:'a.create_date', width:150, align:"center"},
{header:'${text('备注信息')}', name:'remarks', index:'a.remarks', width:150, align:"left"},
{header:'${text('操作')}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
var actions = [];
<% if(hasPermi('test:testTree:edit')){ %>
actions.push('<a href="${ctx}/test/testTree/form?treeCode='+row.treeCode+'" class="btnList" title="${text('编辑数据')}"><i class="fa fa-pencil"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/test/testTree/disable?treeCode='+row.treeCode+'" class="btnList" title="${text('停用数据')}" data-confirm="${text('确认要停用该数据吗')}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/test/testTree/enable?treeCode='+row.treeCode+'" class="btnList" title="${text('启用数据')}" data-confirm="${text('确认要启用该数据吗')}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/test/testTree/delete?treeCode='+row.treeCode+'" class="btnList" title="${text('删除数据')}" data-confirm="${text('确认要删除该数据及所有子数据吗')}" data-deltreenode="'+row.id+'"><i class="fa fa-trash-o"></i></a>&nbsp;');
actions.push('<a href="${ctx}/test/testTree/form?parentCode='+row.id+'" class="btnList" title="${text('新增下级数据')}"><i class="fa fa-plus-square"></i></a>&nbsp;');
<% } %>
return actions.join('');
}}
],
treeGrid: true, // 启用树结构表格
defaultExpandLevel: 0, // 默认展开的层次
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>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
{header:'${text("节点名称")}', name:'treeName', index:'a.tree_name', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '( '+row.treeCode+' ) '+'<a href="${ctx}/test/testTree/form?treeCode='+row.treeCode+'" class="btnList" data-title="${text("编辑数据")}">'+(val||row.id)+'</a>';
}},
{header:'${text("本级排序号")}', name:'treeSort', index:'a.tree_sort', width:150, align:"center"},
{header:'${text("节点名称")}', name:'treeName', index:'a.tree_name', width:150, align:"left"},
{header:'${text("状态")}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text("未知")}', true);
}},
{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
{header:'${text("操作")}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
var actions = [];
<% if(hasPermi('test:testTree:edit')){ %>
actions.push('<a href="${ctx}/test/testTree/form?treeCode='+row.treeCode+'" class="btnList" title="${text("编辑数据")}"><i class="fa fa-pencil"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/test/testTree/disable?treeCode='+row.treeCode+'" class="btnList" title="${text("停用数据")}" data-confirm="${text("确认要停用该数据吗")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/test/testTree/enable?treeCode='+row.treeCode+'" class="btnList" title="${text("启用数据")}" data-confirm="${text("确认要启用该数据吗")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/test/testTree/delete?treeCode='+row.treeCode+'" class="btnList" title="${text("删除数据")}" data-confirm="${text("确认要删除该数据及所有子数据吗")}" data-deltreenode="'+row.id+'"><i class="fa fa-trash-o"></i></a>&nbsp;');
actions.push('<a href="${ctx}/test/testTree/form?parentCode='+row.id+'" class="btnList" title="${text("新增下级数据")}"><i class="fa fa-plus-square"></i></a>&nbsp;');
<% } %>
return actions.join('');
}}
],
treeGrid: true, // 启用树结构表格
defaultExpandLevel: 0, // 默认展开的层次
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>