From c084d570a1d64f12efce04973f41eb3512525c8f Mon Sep 17 00:00:00 2001 From: MorningSun05 <5558816+morningsun05@user.noreply.gitee.com> Date: Sat, 11 Apr 2020 18:20:43 +0800 Subject: [PATCH] =?UTF-8?q?update=202.x/treeTable/treeTable.js.=20?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=A4=8D=E9=80=89=E6=A1=86=EF=BC=8C=E7=88=B6?= =?UTF-8?q?=E7=BA=A7=E9=80=89=E4=B8=AD=E8=87=AA=E5=8A=A8=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E4=B8=8B=E7=BA=A7=E8=8A=82=E7=82=B9=EF=BC=8C=E5=AD=90=E7=BA=A7?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E8=87=AA=E5=8A=A8=E9=80=89=E4=B8=AD=E7=88=B6?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=9A=84=E8=AE=BE=E7=BD=AE=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=EF=BC=8CLinkCheckChild:=E8=87=AA=E5=8A=A8=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E5=AD=90=E8=8A=82=E7=82=B9=EF=BC=8CLinkCheckParent=EF=BC=9A?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=80=89=E4=B8=AD=E7=88=B6=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2.x/treeTable/treeTable.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/2.x/treeTable/treeTable.js b/2.x/treeTable/treeTable.js index 7a72080..08950a2 100644 --- a/2.x/treeTable/treeTable.js +++ b/2.x/treeTable/treeTable.js @@ -46,7 +46,9 @@ layui.define(['layer', 'laytpl', 'form'], function (exports) { return getTbWidth(this); }, tree: {}, - text: {} + text: {}, + LinkCheckChild: false,//复选框联动选择子级,MorningSun扩展 + LinkCheckParent: false//复选框联动选择父级,MorningSun扩展 }; // 默认tree参数 var treeDefaultOption = { @@ -328,13 +330,13 @@ layui.define(['layer', 'laytpl', 'form'], function (exports) { d.LAY_CHECKED = checked; // 同时更新数据 // 联动操作 var $tr = $cb.parentsUntil('tr').last().parent(); - if (d[options.tree.childName] && d[options.tree.childName].length > 0) { + if (d[options.tree.childName] && d[options.tree.childName].length > 0 && options.LinkCheckChild) {//MorningSun,扩展自动选择子节点,默认false that.checkSubCB($tr, checked); // 联动子级 } var indent = parseInt($tr.data('indent')); $tr.prevAll('tr').each(function () { var tInd = parseInt($(this).data('indent')); - if (tInd < indent) { + if (tInd < indent && options.LinkCheckParent) {//MorningSun,扩展自动选择父节点,默认false that.checkParentCB($(this)); // 联动父级 indent = tInd; } -- Gitee