Browse Source

Merge pull request #3641 in VISUAL/fineui from DEC/fineui:release/11.0 to master

* commit 'f271e4d13aaeecca1658be59f5cd07e6860108b6':
  REPORT-102409 fix:FR11样式-下拉树控件-不勾选“异步展开树节点”,模糊搜索异常
research/test
Aeolus.Zhang-张敬峥 1 year ago
parent
commit
1b1754edf6
  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([]);
let start = children.length;
if (lastSearchValue !== "") {

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

@ -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;

Loading…
Cancel
Save