From 26abb14c9dd4605a27119f61da2bdab2f5aa4681 Mon Sep 17 00:00:00 2001 From: morning-star <26325820+Sight-wcg@users.noreply.github.com> Date: Sun, 7 Apr 2024 09:10:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(treeTable):=20=E8=A1=A8=E6=A0=BC=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=89=80=E6=9C=89=E8=A1=8C=E4=B9=8B=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E5=85=A8=E9=80=89=E6=8C=89=E9=92=AE=E9=80=89=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#1759)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/treeTable.js | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/modules/treeTable.js b/src/modules/treeTable.js index ff73713c..e3adec76 100644 --- a/src/modules/treeTable.js +++ b/src/modules/treeTable.js @@ -1622,17 +1622,23 @@ layui.define(['table'], function (exports) { data = data.filter(function (item) { return !item[options.disabledName]; }); - layui.each(data, function (i1, item1) { - if (item1[checkName] || item1[LAY_CHECKBOX_HALF]) { - isIndeterminate = true; - } - if (!item1[checkName]) { - isAll = false; - } - if (isIndeterminate && !isAll) { - return true; - } - }) + + if(data.length > 0){ + layui.each(data, function (i1, item1) { + if (item1[checkName] || item1[LAY_CHECKBOX_HALF]) { + isIndeterminate = true; + } + if (!item1[checkName]) { + isAll = false; + } + if (isIndeterminate && !isAll) { + return true; + } + }) + }else{ + isAll = false; + } + isIndeterminate = isIndeterminate && !isAll; form.render(tableView.find('input[name="layTableCheckbox"][lay-filter="layTableAllChoose"]').prop({ 'checked': isAll,