From d5ff46052ea5ab091c7ce4cde22bbb6ea6b989be Mon Sep 17 00:00:00 2001 From: Diyar-IT <136627746+Diyar-IT@users.noreply.github.com> Date: Mon, 21 Aug 2023 19:23:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8A=82=E7=82=B9=E7=A6=81=E6=AD=A2=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=97=B6=E5=8D=8A=E9=80=89=E5=85=A8=E9=80=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/treeTable.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/modules/treeTable.js b/src/modules/treeTable.js index a599b553..66d98736 100644 --- a/src/modules/treeTable.js +++ b/src/modules/treeTable.js @@ -345,16 +345,14 @@ layui.define(['table'], function (exports) { var tableId = options.id; var customName = treeOptions.customName; - var treeNode = { + // 带上一些常用的方法 + return { data: data, dataIndex: data[LAY_DATA_INDEX], getParentNode: function () { return that.getNodeByIndex(data[LAY_PARENT_INDEX]) }, - } - // 带上一些常用的方法 - - return treeNode; + }; } // 通过 index 返回节点信息 @@ -1568,7 +1566,11 @@ layui.define(['table'], function (exports) { // 更新全选的状态 var isAll = true; var isIndeterminate = false; - layui.each(treeOptions.data.cascade === 'all' ? table.cache[tableId] : treeTable.getData(tableId, true), function (i1, item1) { + var data = treeOptions.data.cascade === 'all' ? table.cache[tableId] : treeTable.getData(tableId, true); + data = data.filter(function (item) { + return !item[options.disabledName]; + }); + layui.each(data, function (i1, item1) { if (item1[checkName] || item1[LAY_CHECKBOX_HALF]) { isIndeterminate = true; }