From 5ab1da9614bd450ef54f83948945ea0b0e1d75e9 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 1 Jul 2019 14:41:11 +0800 Subject: [PATCH] =?UTF-8?q?BI-46499=20refactor:=20=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E4=B8=8B=E6=8B=89=E7=9A=84=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselect/multiselect.combo.js | 4 +++- src/widget/multiselect/multiselect.insert.combo.js | 4 +++- src/widget/multiselect/multiselect.insert.combo.nobar.js | 4 +++- src/widget/multiselect/trigger/switcher.checkselected.js | 8 ++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index af2f24585..a3afda789 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -123,7 +123,9 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { self.fireEvent(BI.MultiSelectCombo.EVENT_CLICK_ITEM); }); this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { - this.getCounter().setValue(self.storeValue); + // counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数) + // 只需要更新查看面板的selectedValue用以请求已选数据 + this.getCounter().updateSelectedValue(self.storeValue); }); this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { if (!self.combo.isViewVisible()) { diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index 1a6671c5b..291e3935a 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -116,7 +116,9 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CLICK_ITEM); }); this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { - this.getCounter().setValue(self.storeValue); + // counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数) + // 只需要更新查看面板的selectedValue用以请求已选数据 + this.getCounter().updateSelectedValue(self.storeValue); }); this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK, function () { if (!self.combo.isViewVisible()) { diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js index f0b61ebb2..dede350d3 100644 --- a/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -113,7 +113,9 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { } }); this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { - this.getCounter().setValue(self.storeValue); + // counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数) + // 只需要更新查看面板的selectedValue用以请求已选数据 + this.getCounter().updateSelectedValue(self.storeValue); }); this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK, function () { if (!self.combo.isViewVisible()) { diff --git a/src/widget/multiselect/trigger/switcher.checkselected.js b/src/widget/multiselect/trigger/switcher.checkselected.js index 4737bd0ac..c9b000ba7 100644 --- a/src/widget/multiselect/trigger/switcher.checkselected.js +++ b/src/widget/multiselect/trigger/switcher.checkselected.js @@ -42,6 +42,9 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { onClickContinueSelect: function () { self.switcher.hideView(); }, + ref: function (_ref) { + self.checkPane = _ref; + }, value: o.value }, o.popup), adapter: o.adapter, @@ -82,6 +85,11 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { this.switcher.setValue(v); }, + // 与setValue的区别是只更新查看已选面板的的selectedValue, 不会更新按钮的计数 + updateSelectedValue: function (v) { + this.checkPane.setValue(v); + }, + setButtonChecked: function (v) { this.button.setValue(v); },