From 9511dd415dc2caa2e5057d1edb2c16981c664244 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 5 Mar 2020 12:12:35 +0800 Subject: [PATCH] =?UTF-8?q?DEC-12318=20fix:=20halfCheck=E4=B8=BB=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/tree/ztree/asynctree.js | 14 ++++++++++---- src/base/tree/ztree/treerender.service.js | 4 +++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/base/tree/ztree/asynctree.js b/src/base/tree/ztree/asynctree.js index 67f9f7a01..2abbd121a 100644 --- a/src/base/tree/ztree/asynctree.js +++ b/src/base/tree/ztree/asynctree.js @@ -165,21 +165,27 @@ BI.AsyncTree = BI.inherit(BI.TreeView, { } - function getNodes(times) { + function getNodes(options) { // console.log(times); + options = options || {}; var parentValues = treeNode.parentValues || self._getParentValues(treeNode); var op = BI.extend({}, o.paras, { id: treeNode.id, - times: times, + times: options.times, parentValues: parentValues.concat(self._getNodeValue(treeNode)), checkState: treeNode.getCheckStatus() - }); + }, options); o.itemsCreator(op, complete); } + // 展开节点会将halfCheck置为false以开启自动计算半选, 所以第一次展开节点的时候需要在置为false之前获取配置 + var checkState = treeNode.getCheckStatus(); if (!treeNode.children) { setTimeout(function () { - getNodes(1); + getNodes({ + times: 1, + checkState: checkState + }); }, 17); } }, diff --git a/src/base/tree/ztree/treerender.service.js b/src/base/tree/ztree/treerender.service.js index d953c6568..37ef035b9 100644 --- a/src/base/tree/ztree/treerender.service.js +++ b/src/base/tree/ztree/treerender.service.js @@ -96,7 +96,9 @@ var nodeList = this.nodeLists[tId]; nodeList.options.times++; nodeList.locked = true; - nodeList.populate(nodeList.options.times); + nodeList.populate({ + times: nodeList.options.times + }); } },