From f1eedcab19f58eb585204bb1c8dfa46830e005a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=2EKing-=E7=8E=8B=E5=87=AF=E5=A3=AE?= Date: Mon, 7 Aug 2023 12:28:20 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-102409=20fix:FR11=E6=A0=B7=E5=BC=8F-?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A0=91=E6=8E=A7=E4=BB=B6-=E4=B8=8D?= =?UTF-8?q?=E5=8B=BE=E9=80=89=E2=80=9C=E5=BC=82=E6=AD=A5=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E6=A0=91=E8=8A=82=E7=82=B9=E2=80=9D=EF=BC=8C=E6=A8=A1=E7=B3=8A?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../abstract.treevaluechooser.js | 2 +- .../abstract.treevaluechooser.list.js | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js b/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js index 90bf612d4..651ce58e1 100644 --- a/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.js +++ b/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 !== "") { diff --git a/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.list.js b/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.list.js index d3afdae79..fa72c777a 100644 --- a/packages/fineui/src/component/treevaluechooser/abstract.treevaluechooser.list.js +++ b/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;