|
|
|
@ -598,11 +598,15 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function dealWithSelectedValue(parentValues, selectedValues) { |
|
|
|
|
var valueMap = {}; |
|
|
|
|
var valueMap = {}, parents = BI.deepClone(parentValues); |
|
|
|
|
BI.each(parentValues, function (i, v) { |
|
|
|
|
parents.push(v); |
|
|
|
|
|
|
|
|
|
selectedValues = selectedValues[v] || {}; |
|
|
|
|
}); |
|
|
|
|
BI.each(selectedValues, function (value, obj) { |
|
|
|
|
var currentParents = BI.concat(parents, value); |
|
|
|
|
|
|
|
|
|
if (BI.isNull(obj)) { |
|
|
|
|
valueMap[value] = [0, 0]; |
|
|
|
|
return; |
|
|
|
@ -615,6 +619,8 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
|
|
|
|
|
BI.each(obj, function (t, o) { |
|
|
|
|
if (BI.isNull(o) || BI.isEmpty(o)) { |
|
|
|
|
nextNames[t] = true; |
|
|
|
|
} else { |
|
|
|
|
isAllSelected(o, BI.concat(currentParents, [t])) && (nextNames[t] = true); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// valueMap的数组第一个参数为不选: 0, 半选: 1, 全选:2, 第二个参数为改节点下选中的子节点个数(子节点全选或者不存在)
|
|
|
|
@ -623,6 +629,24 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
|
|
|
|
|
return valueMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function isAllSelected(selected, parents) { |
|
|
|
|
if (BI.isEmpty(selected)) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (self._getChildCount(parents) !== BI.size(selected)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var can = true; |
|
|
|
|
|
|
|
|
|
BI.each(selected, function (value) { |
|
|
|
|
can = can && isAllSelected(selected[value], BI.concat(parents, value)); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return can; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getCheckState(current, parentValues, valueMap, checkState) { |
|
|
|
|
// 节点本身的checked和half优先级最高
|
|
|
|
|
var checked = checkState.checked, half = checkState.half; |
|
|
|
@ -769,7 +793,8 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
|
|
|
|
|
} else { |
|
|
|
|
var parent = this.tree.getRoot(); |
|
|
|
|
} |
|
|
|
|
return parent.getChildren(); |
|
|
|
|
|
|
|
|
|
return parent ? parent.getChildren() : []; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getAllChildren: function(parentValues) { |
|
|
|
|