调整表格树兼容父节点判断

master
RuoYi 5 years ago committed by Limy
parent 82d17c2983
commit 29ca53de18

File diff suppressed because one or more lines are too long

@ -241,19 +241,22 @@
// 缓存并格式化数据
var formatData = function(data) {
var _root = options.rootIdValue ? options.rootIdValue : null;
var firstCode = data[0][options.parentCode];
// 父节点属性列表
var parentCodes = [];
var rootFlag = false;
$.each(data, function(index, item) {
if($.inArray(item[options.parentCode], parentCodes) == -1){
parentCodes.push(item[options.parentCode]);
}
});
$.each(data, function(index, item) {
// 添加一个默认属性,用来判断当前节点有没有被显示
item.isShow = false;
// 这里兼容几种常见Root节点写法
// 默认的几种判断
var _defaultRootFlag = item[options.parentCode] == '0' ||
item[options.parentCode] == 0 ||
item[options.parentCode] == null ||
item[options.parentCode] == firstCode ||
item[options.parentCode] == '';
// 顶级节点校验判断
var _defaultRootFlag = $.inArray(item[options.code], parentCodes) > 0 && !rootFlag;
if (!item[options.parentCode] || (_root ? (item[options.parentCode] == options.rootIdValue) : _defaultRootFlag)) {
if (!target.data_list["_root_"]) {
rootFlag = true;
if (!target.data_list["_root_"]) {
target.data_list["_root_"] = [];
}
if (!target.data_obj["id_" + item[options.code]]) {

@ -817,12 +817,26 @@ label {
border: 0px!important;
}
.table-striped .table, .table-striped .table, .table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td {
.table-striped table>thead>tr>th, .table-striped table>tbody>tr>th, .table-striped table>tfoot>tr>th, .table-striped table>thead>tr>td, .table-striped table>tbody>tr>td, .table-striped table>tfoot>tr>td {
border-bottom: 1px solid #e7eaec!important;
background-color: transparent;
border: 0px;
}
.table-bordered table>thead>tr>th:first-child, .table-bordered table>tbody>tr>td:first-child {
border-left: 1px solid #ddd;
}
.table-bordered table>thead>tr>th:last-child, .table-bordered table>tbody>tr>td:last-child {
border-right: 1px solid #ddd;
}
.table-bordered table>thead>tr>th, .table-bordered table>tbody>tr>td {
border-top: 1px solid #ddd!important;
border-bottom: 1px solid #ddd;
}
.fixed-table-footer {
border-top: 0px solid #ddd;
}
@ -844,10 +858,6 @@ label {
background-color: #eff3f8;
}
.table-bordered td,.table-bordered th {
border: 1px solid #ddd!important
}
.fixed-table-container thead th >.both{
display: inline-block
}

@ -528,7 +528,7 @@ var table = {
height: options.height, // 表格树的高度
expandColumn: options.expandColumn, // 在哪一列上面显示展开按钮
striped: options.striped, // 是否显示行间隔色
bordered: true, // 是否显示边框
bordered: false, // 是否显示边框
toolbar: '#' + options.toolbar, // 指定工作栏
showSearch: options.showSearch, // 是否显示检索信息
showRefresh: options.showRefresh, // 是否显示刷新按钮

Loading…
Cancel
Save