|
|
|
@ -76,6 +76,7 @@ export class AbstractListTreeValueChooser extends AbstractTreeValueChooser {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_reqInitTreeNode(op, callback) { |
|
|
|
|
const self = this; |
|
|
|
|
let result = []; |
|
|
|
|
const keyword = op.keyword || ""; |
|
|
|
|
const selectedValues = op.selectedValues; |
|
|
|
@ -89,8 +90,8 @@ export class AbstractListTreeValueChooser extends AbstractTreeValueChooser {
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const search = () => { |
|
|
|
|
const children = this._getChildren([]); |
|
|
|
|
function search() { |
|
|
|
|
const children = self._getChildren([]); |
|
|
|
|
let start = children.length; |
|
|
|
|
if (lastSearchValue !== "") { |
|
|
|
|
for (let j = 0, len = start; j < len; j++) { |
|
|
|
@ -105,22 +106,22 @@ export class AbstractListTreeValueChooser extends AbstractTreeValueChooser {
|
|
|
|
|
const output = []; |
|
|
|
|
let find; |
|
|
|
|
for (let i = start, len = children.length; i < len; i++) { |
|
|
|
|
if (output.length < this._const.perPage) { |
|
|
|
|
if (output.length < self._const.perPage) { |
|
|
|
|
find = nodeSearch(1, [], children[i].value, result); |
|
|
|
|
} else if (output.length === this._const.perPage) { |
|
|
|
|
} else if (output.length === self._const.perPage) { |
|
|
|
|
find = nodeSearch(1, [], children[i].value, []); |
|
|
|
|
} |
|
|
|
|
if (find[0] === true) { |
|
|
|
|
output.push(children[i].value); |
|
|
|
|
} |
|
|
|
|
if (output.length > this._const.perPage) { |
|
|
|
|
if (output.length > self._const.perPage) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 深层嵌套的比较麻烦,这边先实现的是在根节点添加
|
|
|
|
|
if (op.times === 1) { |
|
|
|
|
const nodes = this._getAddedValueNode([], selectedValues); |
|
|
|
|
const nodes = self._getAddedValueNode([], selectedValues); |
|
|
|
|
result = concat( |
|
|
|
|
filter(nodes, (idx, node) => { |
|
|
|
|
const find = Func.getSearchResult([node.text || node.value], keyword); |
|
|
|
@ -134,8 +135,8 @@ export class AbstractListTreeValueChooser extends AbstractTreeValueChooser {
|
|
|
|
|
return output; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const createOneJson = (parentValues, value, isOpen, checked, flag, result) => { |
|
|
|
|
const node = this._getTreeNode(parentValues, value); |
|
|
|
|
function createOneJson(parentValues, value, isOpen, checked, flag, result) { |
|
|
|
|
const node = self._getTreeNode(parentValues, value); |
|
|
|
|
result.push({ |
|
|
|
|
id: node.id, |
|
|
|
|
pId: node.pId, |
|
|
|
@ -151,9 +152,9 @@ export class AbstractListTreeValueChooser extends AbstractTreeValueChooser {
|
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const nodeSearch = (deep, parentValues, current, result) => { |
|
|
|
|
function nodeSearch(deep, parentValues, current, result) { |
|
|
|
|
let checked; |
|
|
|
|
if (this._isMatch(parentValues, current, keyword)) { |
|
|
|
|
if (self._isMatch(parentValues, current, keyword)) { |
|
|
|
|
checked = isSelected(parentValues, current); |
|
|
|
|
createOneJson(parentValues, current, false, checked, true, result); |
|
|
|
|
|
|
|
|
@ -161,7 +162,7 @@ export class AbstractListTreeValueChooser extends AbstractTreeValueChooser {
|
|
|
|
|
} |
|
|
|
|
const newParents = clone(parentValues); |
|
|
|
|
newParents.push(current); |
|
|
|
|
const children = this._getChildren(newParents); |
|
|
|
|
const children = self._getChildren(newParents); |
|
|
|
|
|
|
|
|
|
let can = false; |
|
|
|
|
checked = false; |
|
|
|
|