Browse Source

Pull request #2031: BI-90461 fix:优化全选逻辑

Merge in VISUAL/fineui from ~JIMMY.CHAI/fineui:master to master

* commit 'c7f463589927ea6b98c5af552f003ccde64dbcb5':
  BI-90461 fix:优化全选逻辑
  BI-90461 fix:优化全选逻辑
es6
Jimmy.Chai 3 years ago
parent
commit
784ccdb2aa
  1. 25
      src/widget/multiselect/multiselect.combo.js
  2. 22
      src/widget/multiselect/multiselect.combo.nobar.js
  3. 22
      src/widget/multiselect/multiselect.insert.combo.js
  4. 22
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  5. 20
      src/widget/multiselectlist/multiselectlist.insert.js
  6. 20
      src/widget/multiselectlist/multiselectlist.insert.nobar.js
  7. 22
      src/widget/multiselectlist/multiselectlist.js

25
src/widget/multiselect/multiselect.combo.js

@ -336,26 +336,27 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
var self = this; var o = this.options; var self = this; var o = this.options;
this._assertValue(res); this._assertValue(res);
this.requesting = true; this.requesting = true;
o.itemsCreator({ if (this.storeValue.type === res.type) {
type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey());
keywords: [this.trigger.getKey()],
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false; var change = false;
var map = self._makeMap(self.storeValue.value); var map = this._makeMap(this.storeValue.value);
BI.each(items, function (i, v) { BI.each(BI.concat(result.match, result.find), function (i, v) {
if (BI.isNotNull(map[v])) { if (BI.isNotNull(map[v])) {
change = true; change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]); self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v]; delete map[v];
} }
}); });
change && (self.storeValue.value = BI.values(map)); change && (this.storeValue.value = BI.values(map));
self._adjust(callback); this._adjust(callback);
return;
return;
} }
o.itemsCreator({
type: BI.MultiSelectCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()],
selectedValues: this.storeValue.value,
}, function (ob) {
var items = BI.map(ob.items, "value");
var selectedMap = self._makeMap(self.storeValue.value); var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value); var notSelectedMap = self._makeMap(res.value);
var newItems = []; var newItems = [];

22
src/widget/multiselect/multiselect.combo.nobar.js

@ -363,25 +363,27 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
this._assertValue(res); this._assertValue(res);
this.requesting = true; this.requesting = true;
o.itemsCreator({ if (this.storeValue.type === res.type) {
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA, var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey());
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false; var change = false;
var map = self._makeMap(self.storeValue.value); var map = self._makeMap(this.storeValue.value);
BI.each(items, function (i, v) { BI.each(BI.concat(result.match, result.find), function (i, v) {
if (BI.isNotNull(map[v])) { if (BI.isNotNull(map[v])) {
change = true; change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]); self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v]; delete map[v];
} }
}); });
change && (self.storeValue.value = BI.values(map)); change && (this.storeValue.value = BI.values(map));
self._adjust(callback); this._adjust(callback);
return; return;
} }
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()],
selectedValues: this.storeValue.value,
}, function (ob) {
var items = BI.map(ob.items, "value");
var selectedMap = self._makeMap(self.storeValue.value); var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value); var notSelectedMap = self._makeMap(res.value);
var newItems = []; var newItems = [];

22
src/widget/multiselect/multiselect.insert.combo.js

@ -350,25 +350,27 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
this._assertValue(res); this._assertValue(res);
this.requesting = true; this.requesting = true;
o.itemsCreator({ if (this.storeValue.type === res.type) {
type: BI.MultiSelectInsertCombo.REQ_GET_ALL_DATA, var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey());
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false; var change = false;
var map = self._makeMap(self.storeValue.value); var map = this._makeMap(this.storeValue.value);
BI.each(items, function (i, v) { BI.each(BI.concat(result.match, result.find), function (i, v) {
if (BI.isNotNull(map[v])) { if (BI.isNotNull(map[v])) {
change = true; change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]); self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v]; delete map[v];
} }
}); });
change && (self.storeValue.value = BI.values(map)); change && (this.storeValue.value = BI.values(map));
self._adjust(callback); this._adjust(callback);
return; return;
} }
o.itemsCreator({
type: BI.MultiSelectInsertCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()],
selectedValues: this.storeValue.value,
}, function (ob) {
var items = BI.map(ob.items, "value");
var selectedMap = self._makeMap(self.storeValue.value); var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value); var notSelectedMap = self._makeMap(res.value);
var newItems = []; var newItems = [];

22
src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -348,25 +348,27 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
this._assertValue(res); this._assertValue(res);
this.requesting = true; this.requesting = true;
o.itemsCreator({ if (this.storeValue.type === res.type) {
type: BI.MultiSelectInsertNoBarCombo.REQ_GET_ALL_DATA, var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey());
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false; var change = false;
var map = self._makeMap(self.storeValue.value); var map = this._makeMap(this.storeValue.value);
BI.each(items, function (i, v) { BI.each(BI.concat(result.match, result.find), function (i, v) {
if (BI.isNotNull(map[v])) { if (BI.isNotNull(map[v])) {
change = true; change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]); self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v]; delete map[v];
} }
}); });
change && (self.storeValue.value = BI.values(map)); change && (this.storeValue.value = BI.values(map));
self._adjust(callback); this._adjust(callback);
return; return;
} }
o.itemsCreator({
type: BI.MultiSelectInsertNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()],
selectedValues: this.storeValue.value,
}, function (ob) {
var items = BI.map(ob.items, "value");
var selectedMap = self._makeMap(self.storeValue.value); var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value); var notSelectedMap = self._makeMap(res.value);
var newItems = []; var newItems = [];

20
src/widget/multiselectlist/multiselectlist.insert.js

@ -239,24 +239,26 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
_joinAll: function (res, callback) { _joinAll: function (res, callback) {
var self = this, o = this.options; var self = this, o = this.options;
this._assertValue(res); this._assertValue(res);
o.itemsCreator({ if (this.storeValue.type === res.type) {
type: BI.MultiSelectInsertList.REQ_GET_ALL_DATA, var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey());
keywords: [self.trigger.getKeyword()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false; var change = false;
var map = self._makeMap(self.storeValue.value); var map = this._makeMap(this.storeValue.value);
BI.each(items, function (i, v) { BI.each(BI.concat(result.match, result.find), function (i, v) {
if (BI.isNotNull(map[v])) { if (BI.isNotNull(map[v])) {
change = true; change = true;
delete map[v]; delete map[v];
} }
}); });
change && (self.storeValue.value = BI.values(map)); change && (this.storeValue.value = BI.values(map));
callback(); callback();
return; return;
} }
o.itemsCreator({
type: BI.MultiSelectInsertList.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKeyword()],
selectedValues: this.storeValue.value,
}, function (ob) {
var items = BI.map(ob.items, "value");
var selectedMap = self._makeMap(self.storeValue.value); var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value); var notSelectedMap = self._makeMap(res.value);
var newItems = []; var newItems = [];

20
src/widget/multiselectlist/multiselectlist.insert.nobar.js

@ -243,24 +243,26 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
_joinAll: function (res, callback) { _joinAll: function (res, callback) {
var self = this, o = this.options; var self = this, o = this.options;
this._assertValue(res); this._assertValue(res);
o.itemsCreator({ if (this.storeValue.type === res.type) {
type: BI.MultiSelectInsertNoBarList.REQ_GET_ALL_DATA, var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey());
keywords: [self.trigger.getKeyword()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false; var change = false;
var map = self._makeMap(self.storeValue.value); var map = this._makeMap(this.storeValue.value);
BI.each(items, function (i, v) { BI.each(BI.concat(result.match, result.find), function (i, v) {
if (BI.isNotNull(map[v])) { if (BI.isNotNull(map[v])) {
change = true; change = true;
delete map[v]; delete map[v];
} }
}); });
change && (self.storeValue.value = BI.values(map)); change && (this.storeValue.value = BI.values(map));
callback(); callback();
return; return;
} }
o.itemsCreator({
type: BI.MultiSelectInsertNoBarList.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKeyword()],
selectedValues: this.storeValue.value,
}, function (ob) {
var items = BI.map(ob.items, "value");
var selectedMap = self._makeMap(self.storeValue.value); var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value); var notSelectedMap = self._makeMap(res.value);
var newItems = []; var newItems = [];

22
src/widget/multiselectlist/multiselectlist.js

@ -229,24 +229,26 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
_joinAll: function (res, callback) { _joinAll: function (res, callback) {
var self = this, o = this.options; var self = this, o = this.options;
this._assertValue(res); this._assertValue(res);
o.itemsCreator({ if (this.storeValue.type === res.type) {
type: BI.MultiSelectList.REQ_GET_ALL_DATA, var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey());
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false; var change = false;
var map = self._makeMap(self.storeValue.value); var map = this._makeMap(this.storeValue.value);
BI.each(items, function (i, v) { BI.each(BI.concat(result.match, result.find), function (i, v) {
if (BI.isNotNull(map[v])) { if (BI.isNotNull(map[v])) {
change = true; change = true;
delete map[v]; delete map[v];
} }
}); });
change && (self.storeValue.value = BI.values(map)); change && (this.storeValue.value = BI.values(map));
self._adjust(callback); this._adjust(callback);
return; return;
} }
o.itemsCreator({
type: BI.MultiSelectList.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()],
selectedValues: this.storeValue.value,
}, function (ob) {
var items = BI.map(ob.items, "value");
var selectedMap = self._makeMap(self.storeValue.value); var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value); var notSelectedMap = self._makeMap(res.value);
var newItems = []; var newItems = [];

Loading…
Cancel
Save