Browse Source

Pull request #244069: REPORT-102409 fix:FR11样式-下拉树控件-不勾选“异步展开树节点”,模糊搜索异常

Merge in DEC/fineui from ~KEVIN.KING/fineui:final/11.0 to final/11.0

* commit 'a6a06d5fd5d1cf145c960a5f3af0f7ae18ef4640':
  REPORT-102409 fix:FR11样式-下拉树控件-不勾选“异步展开树节点”,模糊搜索异常
research/test
parent
commit
587ed18882
  1. 2
      packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js
  2. 23
      packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.list.js

2
packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js

@ -429,7 +429,7 @@ export class AbstractTreeValueChooser extends Widget {
}); });
}); });
function search(){ function search() {
const children = self._getChildren([]); const children = self._getChildren([]);
let start = children.length; let start = children.length;
if (lastSearchValue !== "") { if (lastSearchValue !== "") {

23
packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.list.js

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

Loading…
Cancel
Save