Browse Source

优化异步树表格折叠同步子状态

pull/521/head
RuoYi 3 months ago
parent
commit
13fffa0ba8
  1. 41
      ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/tree/bootstrap-table-tree.js
  2. 2
      ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/tree/bootstrap-table-tree.min.js

41
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/tree/bootstrap-table-tree.js vendored

@ -689,6 +689,7 @@
if (_isExpanded || _isCollapsed) {
var tr = $(this).parent().parent();
var row_id = tr.attr("id");
var row_pid = tr.attr("pid");
var _id = tr.attr("data-id");
var _ls = target.find("tbody").find("tr[id^='" + row_id + "_']");
if (!options.pagination) {
@ -717,18 +718,36 @@
var _ls = target.find("tbody").find("tr[id^='" + row_id + "_']");
if (_ls && _ls.length > 0) {
if (_isExpanded) {
$.each(_ls, function(index, item) {
$(item).css("display", "none");
});
if (row_pid == "row_root") {
$('table tr[id^="' + row_id + '_"]').css("display", "none");
$('table tr[id^="' + row_id + '_"]').each(function(i,n) {
var _isExpanded = $(n).find(".treetable-expander").hasClass(options.expanderExpandedClass);
if (_isExpanded) {
$(n).find(".treetable-expander").trigger("click");
}
})
} else {
$.each(_ls, function(index, item) {
$(item).css("display", "none");
var _isExpanded = $(item).find(".treetable-expander").hasClass(options.expanderExpandedClass);
if (_isExpanded) {
$(item).find(".treetable-expander").trigger("click");
}
});
}
} else {
$.each(_ls, function(index, item) {
var _icon = $(item).eq(options.expandColumn).find(".treetable-expander");
if (_icon && _icon.hasClass(options.expanderExpandedClass)) {
$(item).css("display", "table");
} else {
$(item).css("display", "table");
}
});
if (row_pid == "row_root") {
$('table tr[pid="' + row_id + '"]').css("display", "table");
} else {
$.each(_ls, function(index, item) {
var _p_icon = $("#" + $(item).attr("pid")).children().eq(options.expandColumn).find(".treetable-expander");
var _isExpanded = _p_icon.hasClass(options.expanderExpandedClass);
var _isCollapsed = _p_icon.hasClass(options.expanderCollapsedClass);
if (row_id == $(item).attr("pid")) {
$(item).css("display", "table");
}
});
}
}
} else {
if (options.pagination) {

2
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/tree/bootstrap-table-tree.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save