|
|
@ -17297,7 +17297,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree |
|
|
|
|
|
|
|
|
|
|
|
_reqSelectedTreeNode: function (op, callback) { |
|
|
|
_reqSelectedTreeNode: function (op, callback) { |
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
var selectedValues = op.selectedValues; |
|
|
|
var selectedValues = BI.deepClone(op.selectedValues); |
|
|
|
var notSelectedValue = op.notSelectedValue || {}; |
|
|
|
var notSelectedValue = op.notSelectedValue || {}; |
|
|
|
var keyword = op.keyword || ""; |
|
|
|
var keyword = op.keyword || ""; |
|
|
|
var parentValues = op.parentValues || []; |
|
|
|
var parentValues = op.parentValues || []; |
|
|
@ -17312,12 +17312,38 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function dealWithSelectedValues(selectedValues) { |
|
|
|
function dealWithSelectedValues(selectedValues) { |
|
|
|
var p = BI.clone(parentValues); |
|
|
|
//存储的值中存在这个值就把它删掉
|
|
|
|
p.push(notSelectedValue); |
|
|
|
if (canFindKey(selectedValues, parentValues.concat(notSelectedValue))) { |
|
|
|
|
|
|
|
//如果搜索的值在父亲链中
|
|
|
|
|
|
|
|
if (isSearchValueInParent(parentValues.concat(notSelectedValue))) { |
|
|
|
|
|
|
|
var name = notSelectedValue; |
|
|
|
|
|
|
|
var p = parentValues; |
|
|
|
|
|
|
|
var pNode = getNode(selectedValues, parentValues); |
|
|
|
|
|
|
|
if (pNode[name]) { |
|
|
|
|
|
|
|
delete pNode[name]; |
|
|
|
|
|
|
|
//递归删掉空父节点
|
|
|
|
|
|
|
|
while (p.length > 0 && BI.isEmpty(pNode)) { |
|
|
|
|
|
|
|
name = p[p.length - 1]; |
|
|
|
|
|
|
|
p = p.slice(0, p.length - 1); |
|
|
|
|
|
|
|
pNode = getNode(selectedValues, p); |
|
|
|
|
|
|
|
delete pNode[name]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isChild(selectedValues, p)) { |
|
|
|
//存储的值中不存在这个值,但父亲节点是全选的情况
|
|
|
|
var result = []; |
|
|
|
if (isChild(selectedValues, parentValues.concat(notSelectedValue))) { |
|
|
|
var finded = search(parentValues.length + 1, parentValues, notSelectedValue, result); |
|
|
|
var result = [], finded = false; |
|
|
|
|
|
|
|
var p = parentValues; |
|
|
|
|
|
|
|
//如果parentValues中有匹配的值,说明搜索结果不在当前值下
|
|
|
|
|
|
|
|
if (isSearchValueInParent(parentValues.concat(notSelectedValue))) { |
|
|
|
|
|
|
|
finded = true; |
|
|
|
|
|
|
|
p = parentValues.concat(notSelectedValue); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//从当前值开始搜
|
|
|
|
|
|
|
|
finded = search(parentValues, notSelectedValue, result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (finded === true) { |
|
|
|
if (finded === true) { |
|
|
|
var next = selectedValues; |
|
|
|
var next = selectedValues; |
|
|
@ -17353,7 +17379,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function search(deep, parents, current, result) { |
|
|
|
function search(parents, current, result) { |
|
|
|
var newParents = BI.clone(parents); |
|
|
|
var newParents = BI.clone(parents); |
|
|
|
newParents.push(current); |
|
|
|
newParents.push(current); |
|
|
|
if (self._isMatch(current, keyword)) { |
|
|
|
if (self._isMatch(current, keyword)) { |
|
|
@ -17366,7 +17392,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree |
|
|
|
var can = false; |
|
|
|
var can = false; |
|
|
|
|
|
|
|
|
|
|
|
BI.each(children, function (i, child) { |
|
|
|
BI.each(children, function (i, child) { |
|
|
|
if (search(deep + 1, newParents, child.value, result)) { |
|
|
|
if (search(newParents, child.value, result)) { |
|
|
|
can = true; |
|
|
|
can = true; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
notSearch.push(child.value); |
|
|
|
notSearch.push(child.value); |
|
|
@ -17382,6 +17408,38 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree |
|
|
|
return can; |
|
|
|
return can; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isSearchValueInParent(parentValues) { |
|
|
|
|
|
|
|
for (var i = 0, len = parentValues.length; i < len; i++) { |
|
|
|
|
|
|
|
if (self._isMatch(parentValues[i], keyword)) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getNode(selectedValues, parentValues) { |
|
|
|
|
|
|
|
var pNode = selectedValues; |
|
|
|
|
|
|
|
for (var i = 0, len = parentValues.length; i < len; i++) { |
|
|
|
|
|
|
|
if (pNode == null) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
pNode = pNode[parentValues[i]]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return pNode; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function canFindKey(selectedValues, parents) { |
|
|
|
|
|
|
|
var t = selectedValues; |
|
|
|
|
|
|
|
for (var i = 0; i < parents.length; i++) { |
|
|
|
|
|
|
|
var v = parents[i]; |
|
|
|
|
|
|
|
t = t[v]; |
|
|
|
|
|
|
|
if (t == null) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function isChild(selectedValues, parents) { |
|
|
|
function isChild(selectedValues, parents) { |
|
|
|
var t = selectedValues; |
|
|
|
var t = selectedValues; |
|
|
|
for (var i = 0; i < parents.length; i++) { |
|
|
|
for (var i = 0; i < parents.length; i++) { |
|
|
@ -17390,11 +17448,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
t = t[v]; |
|
|
|
t = t[v]; |
|
|
|
if (t == null || BI.isEmpty(t)) { |
|
|
|
if (BI.isEmpty(t)) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -17598,7 +17656,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree |
|
|
|
var selectedValues = op.selectedValues || {}; |
|
|
|
var selectedValues = op.selectedValues || {}; |
|
|
|
var valueMap = {}; |
|
|
|
var valueMap = {}; |
|
|
|
// if (judgeState(parentValues, selectedValues, checkState)) {
|
|
|
|
// if (judgeState(parentValues, selectedValues, checkState)) {
|
|
|
|
valueMap = dealWidthSelectedValue(parentValues, selectedValues); |
|
|
|
valueMap = dealWidthSelectedValue(parentValues, selectedValues); |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
var nodes = this._getChildren(parentValues); |
|
|
|
var nodes = this._getChildren(parentValues); |
|
|
|
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { |
|
|
|
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { |
|
|
|