|
|
|
@ -110,7 +110,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
}; |
|
|
|
|
var className = "dark", perTime = 100; |
|
|
|
|
|
|
|
|
|
function onClick (event, treeId, treeNode) { |
|
|
|
|
function onClick(event, treeId, treeNode) { |
|
|
|
|
// 当前点击节点的状态是半选,且为true_part, 则将其改为false_part,使得点击半选后切换到的是全选
|
|
|
|
|
var checked = treeNode.checked; |
|
|
|
|
var status = treeNode.getCheckStatus(); |
|
|
|
@ -121,7 +121,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
self.nodes.checkNode(treeNode, !checked, true, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getUrl (treeId, treeNode) { |
|
|
|
|
function getUrl(treeId, treeNode) { |
|
|
|
|
var parentNode = self._getParentValues(treeNode); |
|
|
|
|
treeNode.times = treeNode.times || 1; |
|
|
|
|
var param = "id=" + treeNode.id |
|
|
|
@ -132,7 +132,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
return "&" + param; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function beforeExpand (treeId, treeNode) { |
|
|
|
|
function beforeExpand(treeId, treeNode) { |
|
|
|
|
if (!treeNode.isAjaxing) { |
|
|
|
|
if (!treeNode.children) { |
|
|
|
|
treeNode.times = 1; |
|
|
|
@ -147,7 +147,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function onAsyncSuccess (event, treeId, treeNode, msg) { |
|
|
|
|
function onAsyncSuccess(event, treeId, treeNode, msg) { |
|
|
|
|
treeNode.halfCheck = false; |
|
|
|
|
if (!msg || msg.length === 0 || /^<html>[\s,\S]*<\/html>$/gi.test(msg) || self._stop) { |
|
|
|
|
return; |
|
|
|
@ -170,14 +170,14 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function onAsyncError (event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) { |
|
|
|
|
function onAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) { |
|
|
|
|
var zTree = self.nodes; |
|
|
|
|
BI.Msg.toast("Error!", "warning"); |
|
|
|
|
// treeNode.icon = "";
|
|
|
|
|
// zTree.updateNode(treeNode);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function ajaxGetNodes (treeNode, reloadType) { |
|
|
|
|
function ajaxGetNodes(treeNode, reloadType) { |
|
|
|
|
var zTree = self.nodes; |
|
|
|
|
if (reloadType == "refresh") { |
|
|
|
|
zTree.updateNode(treeNode); // 刷新一下当前节点,如果treeNode.xxx被改了的话
|
|
|
|
@ -185,7 +185,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
zTree.reAsyncChildNodes(treeNode, reloadType, true); // 强制加载子节点,reloadType === refresh为先清空再加载,否则为追加到现有子节点之后
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function beforeCheck (treeId, treeNode) { |
|
|
|
|
function beforeCheck(treeId, treeNode) { |
|
|
|
|
if (treeNode.disabled) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -195,7 +195,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
if (treeNode.checked === true) { |
|
|
|
|
// 将展开的节点halfCheck设为false,解决展开节点存在halfCheck=true的情况 guy
|
|
|
|
|
// 所有的半选状态都需要取消halfCheck=true的情况
|
|
|
|
|
function track (children) { |
|
|
|
|
function track(children) { |
|
|
|
|
BI.each(children, function (i, ch) { |
|
|
|
|
if (ch.halfCheck === true) { |
|
|
|
|
ch.halfCheck = false; |
|
|
|
@ -217,24 +217,18 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function onCheck (event, treeId, treeNode) { |
|
|
|
|
function onCheck(event, treeId, treeNode) { |
|
|
|
|
if (treeNode.disabled) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
self._selectTreeNode(treeId, treeNode); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function onExpand (event, treeId, treeNode) { |
|
|
|
|
if (treeNode.disabled) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
function onExpand(event, treeId, treeNode) { |
|
|
|
|
treeNode.halfCheck = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function onCollapse (event, treeId, treeNode) { |
|
|
|
|
if (treeNode.disabled) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
function onCollapse(event, treeId, treeNode) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return setting; |
|
|
|
@ -325,7 +319,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
var hashMap = {}; |
|
|
|
|
var rootNoots = this.nodes.getNodes(); |
|
|
|
|
track(rootNoots); // 可以看到这个方法没有递归调用,所以在_getHalfSelectedValues中需要关心全选的节点
|
|
|
|
|
function track (nodes) { |
|
|
|
|
function track(nodes) { |
|
|
|
|
BI.each(nodes, function (i, node) { |
|
|
|
|
var checkState = node.getCheckStatus(); |
|
|
|
|
if (checkState.checked === true || checkState.half === true) { |
|
|
|
@ -503,7 +497,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
checkAll: function (checked) { |
|
|
|
|
function setNode (children) { |
|
|
|
|
function setNode(children) { |
|
|
|
|
BI.each(children, function (i, child) { |
|
|
|
|
child.halfCheck = false; |
|
|
|
|
setNode(child.children); |
|
|
|
@ -545,7 +539,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
|
|
|
|
|
BI.each(values, function (v, op) { |
|
|
|
|
var nodes = treeObj.getNodesByParam(param, v, null); |
|
|
|
|
BI.each(nodes, function (j, node) { |
|
|
|
|
BI.extend(node, {checked: true}, op); |
|
|
|
|
BI.extend(node, { checked: true }, op); |
|
|
|
|
treeObj.updateNode(node); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|