From 22156f2c780b93d9f6bda54bff073df287e877e9 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 29 Apr 2020 16:41:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-30722=20=E4=B8=8B=E6=8B=89=E6=A0=91?= =?UTF-8?q?=E6=8F=90=E4=BE=9Bbefore=5Fpopup=5Fview=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + .../treevaluechooser/combo.listtreevaluechooser.js | 6 ++++++ .../treevaluechooser/combo.treevaluechooser.insert.js | 6 ++++++ src/component/treevaluechooser/combo.treevaluechooser.js | 6 ++++++ .../multilayerselecttree/multilayerselecttree.combo.js | 9 ++++++++- .../multilayersingletree/multilayersingletree.combo.js | 9 ++++++++- src/widget/multitree/multi.tree.combo.js | 3 ++- src/widget/multitree/multi.tree.insert.combo.js | 3 ++- src/widget/multitree/multi.tree.list.combo.js | 3 ++- 9 files changed, 41 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index eff83fc03..ca684ef0e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-04) +- 下拉树系列添加下拉popup弹出前事件 - 修复了复选下拉勾选值和搜索结果中含有父子串关系时提示不正确的问题 - searcher提供可配是否支持搜索空格的allSearchBlank - 修复了复选下拉全选状态下使用空格添加值trigger显示更新不对的问题 diff --git a/src/component/treevaluechooser/combo.listtreevaluechooser.js b/src/component/treevaluechooser/combo.listtreevaluechooser.js index af58a9394..076849dcb 100644 --- a/src/component/treevaluechooser/combo.listtreevaluechooser.js +++ b/src/component/treevaluechooser/combo.listtreevaluechooser.js @@ -65,6 +65,11 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, action: function () { self.fireEvent(BI.ListTreeValueChooserInsertCombo.EVENT_CONFIRM); } + }, { + eventName: BI.MultiTreeCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.fireEvent(BI.TreeValueChooserInsertCombo.EVENT_BEFORE_POPUPVIEW); + } }] }); }, @@ -89,4 +94,5 @@ BI.ListTreeValueChooserInsertCombo.EVENT_STOP = "EVENT_STOP"; BI.ListTreeValueChooserInsertCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; BI.ListTreeValueChooserInsertCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.ListTreeValueChooserInsertCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.ListTreeValueChooserInsertCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.shortcut("bi.list_tree_value_chooser_insert_combo", BI.ListTreeValueChooserInsertCombo); \ No newline at end of file diff --git a/src/component/treevaluechooser/combo.treevaluechooser.insert.js b/src/component/treevaluechooser/combo.treevaluechooser.insert.js index 8a95f2e36..f89032c92 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.insert.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.insert.js @@ -64,6 +64,11 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { action: function () { self.fireEvent(BI.TreeValueChooserInsertCombo.EVENT_CONFIRM); } + }, { + eventName: BI.MultiTreeCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.fireEvent(BI.TreeValueChooserInsertCombo.EVENT_BEFORE_POPUPVIEW); + } }] }); }, @@ -88,4 +93,5 @@ BI.TreeValueChooserInsertCombo.EVENT_STOP = "EVENT_STOP"; BI.TreeValueChooserInsertCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; BI.TreeValueChooserInsertCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.TreeValueChooserInsertCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.TreeValueChooserInsertCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.shortcut("bi.tree_value_chooser_insert_combo", BI.TreeValueChooserInsertCombo); \ No newline at end of file diff --git a/src/component/treevaluechooser/combo.treevaluechooser.js b/src/component/treevaluechooser/combo.treevaluechooser.js index fbf813247..32e8fac3e 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.js @@ -64,6 +64,11 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { action: function () { self.fireEvent(BI.TreeValueChooserCombo.EVENT_CONFIRM); } + }, { + eventName: BI.MultiTreeCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.fireEvent(BI.TreeValueChooserCombo.EVENT_BEFORE_POPUPVIEW); + } }] }); }, @@ -82,6 +87,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { } }); +BI.TreeValueChooserCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.TreeValueChooserCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.TreeValueChooserCombo.EVENT_FOCUS = "EVENT_FOCUS"; BI.TreeValueChooserCombo.EVENT_BLUR = "EVENT_BLUR"; diff --git a/src/widget/multilayerselecttree/multilayerselecttree.combo.js b/src/widget/multilayerselecttree/multilayerselecttree.combo.js index f844cb2f1..fb6490468 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.combo.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.combo.js @@ -96,7 +96,13 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { value: o.value, maxHeight: 400, minHeight: 240 - } + }, + listeners: [{ + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_BEFORE_POPUPVIEW); + } + }] }; }, @@ -209,4 +215,5 @@ BI.MultiLayerSelectTreeCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.MultiLayerSelectTreeCombo.EVENT_BLUR = "EVENT_BLUR"; BI.MultiLayerSelectTreeCombo.EVENT_FOCUS = "EVENT_FOCUS"; BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiLayerSelectTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo); \ No newline at end of file diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index 319b9e5bf..7446ff5f5 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -99,7 +99,13 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { value: o.value, maxHeight: 400, minHeight: 240 - } + }, + listeners: [{ + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_BEFORE_POPUPVIEW); + } + }] }; }, @@ -211,4 +217,5 @@ BI.MultiLayerSingleTreeCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.MultiLayerSingleTreeCombo.EVENT_BLUR = "EVENT_BLUR"; BI.MultiLayerSingleTreeCombo.EVENT_FOCUS = "EVENT_FOCUS"; BI.MultiLayerSingleTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiLayerSingleTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo); \ No newline at end of file diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index e12d4fa2a..e62da553c 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -195,7 +195,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); self.populate(); - + self.fireEvent(BI.MultiTreeCombo.EVENT_BEFORE_POPUPVIEW); }); this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { if (isSearching()) { @@ -333,5 +333,6 @@ BI.MultiTreeCombo.EVENT_STOP = "EVENT_STOP"; BI.MultiTreeCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.MultiTreeCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; BI.MultiTreeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.MultiTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.shortcut("bi.multi_tree_combo", BI.MultiTreeCombo); \ No newline at end of file diff --git a/src/widget/multitree/multi.tree.insert.combo.js b/src/widget/multitree/multi.tree.insert.combo.js index 77f4c9636..e005b8097 100644 --- a/src/widget/multitree/multi.tree.insert.combo.js +++ b/src/widget/multitree/multi.tree.insert.combo.js @@ -205,7 +205,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); self.populate(); - + self.fireEvent(BI.MultiTreeInsertCombo.EVENT_BEFORE_POPUPVIEW); }); this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { if (isSearching()) { @@ -348,5 +348,6 @@ BI.MultiTreeInsertCombo.EVENT_STOP = "EVENT_STOP"; BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; BI.MultiTreeInsertCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.MultiTreeInsertCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.MultiTreeInsertCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.shortcut("bi.multi_tree_insert_combo", BI.MultiTreeInsertCombo); \ No newline at end of file diff --git a/src/widget/multitree/multi.tree.list.combo.js b/src/widget/multitree/multi.tree.list.combo.js index 6750b8192..31fb9893d 100644 --- a/src/widget/multitree/multi.tree.list.combo.js +++ b/src/widget/multitree/multi.tree.list.combo.js @@ -224,7 +224,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); self.populate(); - + self.fireEvent(BI.MultiTreeListCombo.EVENT_BEFORE_POPUPVIEW); }); this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { if (isSearching()) { @@ -372,5 +372,6 @@ BI.MultiTreeListCombo.EVENT_STOP = "EVENT_STOP"; BI.MultiTreeListCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; BI.MultiTreeListCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.MultiTreeListCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.MultiTreeListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.shortcut("bi.multi_tree_list_combo", BI.MultiTreeListCombo); \ No newline at end of file From 821d8fb5f2c653055dcf0ef37897740f89ad45cb Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 29 Apr 2020 18:00:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?BI-64703=20fix:=20=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=8F=96=E6=9C=80=E5=A4=A7=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/tree/ztree/parttree.js | 37 ++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/base/tree/ztree/parttree.js b/src/base/tree/ztree/parttree.js index b9770c0d4..771217108 100644 --- a/src/base/tree/ztree/parttree.js +++ b/src/base/tree/ztree/parttree.js @@ -42,7 +42,7 @@ BI.PartTree = BI.inherit(BI.AsyncTree, { var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode)); var name = this._getNodeValue(treeNode); if (treeNode.checked === true) { - this.options.paras.selectedValues = this._getJoinValue(); + this.options.paras.selectedValues = this._getUnionValue(); // this._buildTree(self.options.paras.selectedValues, BI.concat(parentValues, name)); o.itemsCreator(BI.extend({}, o.paras, { type: BI.TreeView.REQ_TYPE_ADJUST_DATA, @@ -155,6 +155,41 @@ BI.PartTree = BI.inherit(BI.AsyncTree, { return BI.deepClone(this.options.paras.selectedValues || {}); }, + _getUnionValue: function () { + if (!this.nodes) { + return {}; + } + var checkedValues = this._getSelectedValues(); + if (BI.isEmpty(checkedValues)) { + return BI.deepClone(this.options.paras.selectedValues); + } + if (BI.isEmpty(this.options.paras.selectedValues)) { + return checkedValues; + } + return this._union(checkedValues, this.options.paras.selectedValues); + }, + + _union: function (valueA, valueB) { + var self = this; + var map = {}; + track([], valueA, valueB); + track([], valueB, valueA); + + function track (parent, node, compare) { + BI.each(node, function (n, item) { + if (BI.isNull(compare[n])) { + self._addTreeNode(map, parent, n, item); + } else if (BI.isEmpty(compare[n])) { + self._addTreeNode(map, parent, n, {}); + } else { + track(parent.concat([n]), node[n], compare[n]); + } + }); + } + + return map; + }, + // 生成树方法 stroke: function (config) { var o = this.options;