diff --git a/src/modules/table.js b/src/modules/table.js index 38eb526f..f36ee000 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -1746,6 +1746,9 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ var isCheckMult = layui.type(opts.index) === 'array'; // 是否操作多个 var isCheckAllOrMult = isCheckAll || isCheckMult; // 是否全选或多选 + // treeTable 内部已处理选中,此处不再处理 + if(options.tree && options.tree.view) return; + // 全选或多选时 if (isCheckAllOrMult) { that.layBox.addClass(DISABLED_TRANSITION); // 减少回流 @@ -1839,7 +1842,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ if(isCheckAllOrMult){ setTimeout(function(){ that.layBox.removeClass(DISABLED_TRANSITION); - },100) + }, 100) } }; diff --git a/src/modules/treeTable.js b/src/modules/treeTable.js index 21ff2401..2131507d 100644 --- a/src/modules/treeTable.js +++ b/src/modules/treeTable.js @@ -1762,10 +1762,10 @@ layui.define(['table'], function (exports) { that.setRowCheckedClass(checkboxElem.closest('tr'), checked); // 设置原始复选框 checked 属性值并渲染 - form.render(checkboxElem.prop({ + checkboxElem.prop({ checked: checked, indeterminate: itemP[LAY_CHECKBOX_HALF] - })) + }) }) } @@ -1794,10 +1794,10 @@ layui.define(['table'], function (exports) { } isIndeterminate = isIndeterminate && !isAll; - form.render(tableView.find('input[name="layTableCheckbox"][lay-filter="layTableAllChoose"]').prop({ + tableView.find('input[name="layTableCheckbox"][lay-filter="layTableAllChoose"]').prop({ 'checked': isAll, indeterminate: isIndeterminate - })); + }) return isAll } @@ -1909,7 +1909,7 @@ layui.define(['table'], function (exports) { // 取消当前选中行背景色 that.setRowCheckedClass(radioElem.closest('tr'), false); - form.render(radioElem.prop('checked', false)); + radioElem.prop('checked', false); } }); // 取消其他的选中状态 trData[checkName] = checked; @@ -1917,7 +1917,7 @@ layui.define(['table'], function (exports) { that.setRowCheckedClass(trElem, checked); // 标记当前选中行背景色 that.setRowCheckedClass(trElem.siblings(), false); // 取消其他行背景色 - form.render(trElem.find('input[type="radio"][lay-type="layTableRadio"]').prop('checked', checked)); + trElem.find('input[type="radio"][lay-type="layTableRadio"]').prop('checked', checked); } else { // 切换只能用到单条,全选到这一步的时候应该是一个确定的状态 checked = layui.type(checked) === 'boolean' ? checked : !trData[checkName]; // 状态切换,如果遇到不可操作的节点待处理 todo @@ -1936,7 +1936,7 @@ layui.define(['table'], function (exports) { }).join(',')); that.setRowCheckedClass(checkboxElem.closest('tr'), checked); // 标记当前选中行背景色 - form.render(checkboxElem.prop({checked: checked, indeterminate: false})); + checkboxElem.prop({checked: checked, indeterminate: false}); var trDataP; @@ -1945,7 +1945,7 @@ layui.define(['table'], function (exports) { // 找到父节点,然后判断父节点的子节点是否全部选中 trDataP = that.getNodeDataByIndex(trData[LAY_PARENT_INDEX]); } - + return that.updateCheckStatus(trDataP, checked); } }