From a7a9ac94297eb066ef560c0afed7f90da6f4c082 Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 31 Oct 2022 10:31:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BI-115201=20fix:=20=E3=80=906.0.3.3?= =?UTF-8?q?=E3=80=91=E4=B8=8B=E6=8B=89=E6=A0=91=E4=B8=8B=E6=8B=89=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E9=80=89=E6=8B=A9=E4=BB=BB=E4=BD=95=E5=86=85=E5=AE=B9?= =?UTF-8?q?=EF=BC=8C=E5=89=8D=E7=AB=AF=E5=A4=9A=E5=8F=91=E4=B8=80=E4=B8=AA?= =?UTF-8?q?data=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/widget/multitree/demo.multi_tree_combo.js | 12 ++++++++++-- src/widget/multitree/multi.tree.combo.js | 10 ++++++++-- src/widget/multitree/multi.tree.insert.combo.js | 11 +++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/demo/js/widget/multitree/demo.multi_tree_combo.js b/demo/js/widget/multitree/demo.multi_tree_combo.js index fcc9107cb..c3e0ffaa4 100644 --- a/demo/js/widget/multitree/demo.multi_tree_combo.js +++ b/demo/js/widget/multitree/demo.multi_tree_combo.js @@ -38,7 +38,15 @@ Demo.MultiTreeCombo = BI.inherit(BI.Widget, { width: 300, value: { "根目录": {} - } + }, + listeners: [ + { + eventName: "EVENT_CONFIRM", + action: function () { + console.log("EVENT_CONFIRM", this.getValue()); + } + } + ] }, { type: "bi.button", text: "getValue", @@ -52,4 +60,4 @@ Demo.MultiTreeCombo = BI.inherit(BI.Widget, { } }); -BI.shortcut("demo.multi_tree_combo", Demo.MultiTreeCombo); \ No newline at end of file +BI.shortcut("demo.multi_tree_combo", Demo.MultiTreeCombo); diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index d48e8d6db..8e1e289c1 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -82,6 +82,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { self.numberCounter.setButtonChecked(val); self.storeValue = { value: self.combo.getValue() }; self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue()); + self._dataChange = true; } }, { eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, @@ -92,6 +93,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, action: function () { clear = true; + self._dataChange = true; self.setValue(); self._defaultState(); } @@ -180,12 +182,16 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); self.numberCounter.setButtonChecked(val); self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue()); + self._dataChange = true; }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { if (isSearching()) { return; } + if (!this.isViewVisible()) { + self._dataChange = false; // 标记数据是否发生变化 + } if (change === true) { self.storeValue = { value: self.combo.getValue() }; change = false; @@ -198,7 +204,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { if (isSearching()) { self._stopEditing(); - self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); } else { if (isPopupView()) { self._stopEditing(); @@ -206,7 +212,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { if (clear === true) { self.storeValue = { value: {} }; } - self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); } } clear = false; diff --git a/src/widget/multitree/multi.tree.insert.combo.js b/src/widget/multitree/multi.tree.insert.combo.js index c9ce5545f..6db34dc61 100644 --- a/src/widget/multitree/multi.tree.insert.combo.js +++ b/src/widget/multitree/multi.tree.insert.combo.js @@ -56,6 +56,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); self._stopEditing(); + self._dataChange = true; } }] } @@ -99,6 +100,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { self.numberCounter.setButtonChecked(val); self.storeValue = { value: self.combo.getValue() }; self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.getValue()); + self._dataChange = true; } }, { eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, @@ -109,6 +111,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, action: function () { clear = true; + self._dataChange = true; self.setValue(); self._defaultState(); } @@ -192,12 +195,16 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); self.numberCounter.setButtonChecked(val); self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.combo.getValue()); + self._dataChange = true; }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { if (isSearching()) { return; } + if (!this.isViewVisible()) { + self._dataChange = false; // 标记数据是否发生变化 + } if (change === true) { self.storeValue = { value: self.combo.getValue() }; change = false; @@ -210,7 +217,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { if (isSearching()) { self._stopEditing(); - self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM); } else { if (isPopupView()) { self._stopEditing(); @@ -218,7 +225,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { if (clear === true) { self.storeValue = { value: {} }; } - self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CONFIRM); } } clear = false; From 479c53da141f84c6016fe41b8b4c1f52bdd64520 Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 31 Oct 2022 11:48:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?BI-115201=20fix:=20=E3=80=906.0.3.3?= =?UTF-8?q?=E3=80=91=E4=B8=8B=E6=8B=89=E6=A0=91=E4=B8=8B=E6=8B=89=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E9=80=89=E6=8B=A9=E4=BB=BB=E4=BD=95=E5=86=85=E5=AE=B9?= =?UTF-8?q?=EF=BC=8C=E5=89=8D=E7=AB=AF=E5=A4=9A=E5=8F=91=E4=B8=80=E4=B8=AA?= =?UTF-8?q?data=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multitree/multi.tree.list.combo.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/widget/multitree/multi.tree.list.combo.js b/src/widget/multitree/multi.tree.list.combo.js index 9b82b8780..a3a016179 100644 --- a/src/widget/multitree/multi.tree.list.combo.js +++ b/src/widget/multitree/multi.tree.list.combo.js @@ -59,6 +59,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); self._stopEditing(); + self._dataChange = true; } }] } @@ -116,6 +117,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { self.numberCounter.setButtonChecked(val); self.storeValue = { value: self.combo.getValue() }; self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.getValue()); + self._dataChange = true; } }, { eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, @@ -126,6 +128,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, action: function () { clear = true; + self._dataChange = true; self.setValue(); self._defaultState(); } @@ -209,12 +212,16 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); self.numberCounter.setButtonChecked(val); self.fireEvent(BI.MultiTreeListCombo.EVENT_CLICK_ITEM, self.combo.getValue()); + self._dataChange = true; }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { if (isSearching()) { return; } + if (!this.isViewVisible()) { + self._dataChange = false; // 标记数据是否发生变化 + } if (change === true) { self.storeValue = { value: self.combo.getValue() }; change = false; @@ -227,7 +234,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { if (isSearching()) { self.trigger.stopEditing(); - self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM); } else { if (isPopupView()) { self._stopEditing(); @@ -235,7 +242,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { if (clear === true) { self.storeValue = { value: [] }; } - self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM); } } clear = false;