Browse Source

BI-118262 fix: 树过滤组件搜索过滤不生效

搜索面板点击node,会发请求去adjust数据,回调之后才发change事件,如果在这之前点确定,_datachange还没有发生呢
当然即使这样,外部getValue的数据也可能是没adjust的数据,这就是另外的问题了
master
zsmj 2 years ago
parent
commit
8fce13ef69
  1. 2
      src/case/ztree/parttree.js
  2. 22
      src/widget/multitree/multi.tree.combo.js
  3. 23
      src/widget/multitree/multi.tree.insert.combo.js
  4. 18
      src/widget/multitree/trigger/multi.tree.search.insert.pane.js
  5. 12
      src/widget/multitree/trigger/multi.tree.search.pane.js
  6. 15
      src/widget/multitree/trigger/searcher.multi.tree.js

2
src/case/ztree/parttree.js

@ -37,6 +37,7 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode)); var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode); var name = this._getNodeValue(treeNode);
this.fireEvent(BI.PartTree.EVENT_CLICK_TREE_NODE);
if (treeNode.checked === true) { if (treeNode.checked === true) {
this.options.paras.selectedValues = this._getUnionValue(); this.options.paras.selectedValues = this._getUnionValue();
// this._buildTree(self.options.paras.selectedValues, BI.concat(parentValues, name)); // this._buildTree(self.options.paras.selectedValues, BI.concat(parentValues, name));
@ -197,4 +198,5 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
} }
}); });
BI.PartTree.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.part_tree", BI.PartTree); BI.shortcut("bi.part_tree", BI.PartTree);

22
src/widget/multitree/multi.tree.combo.js

@ -42,7 +42,15 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}, },
searcher: { searcher: {
type: "bi.multi_tree_searcher", type: "bi.multi_tree_searcher",
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator,
listeners: [
{
eventName: BI.MultiTreeSearcher.EVENT_CLICK_TREE_NODE,
action: function () {
self._dataChange = true;
}
}
],
}, },
value: { value: o.value || {} } value: { value: o.value || {} }
}); });
@ -61,7 +69,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this); self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this); self.numberCounter.setAdapter(this);
}, },
listeners: [{ listeners: [
{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT, eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () { action: function () {
self.numberCounter.adjustView(); self.numberCounter.adjustView();
@ -97,7 +106,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
self.setValue(); self.setValue();
self._defaultState(); self._defaultState();
} }
}], }
],
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
onLoaded: function () { onLoaded: function () {
BI.nextTick(function () { BI.nextTick(function () {
@ -293,7 +303,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
{
el: this.combo, el: this.combo,
left: 0, left: 0,
right: 0, right: 0,
@ -312,7 +323,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
right: o.height, right: o.height,
top: 0, top: 0,
bottom: 0 bottom: 0
}] }
]
}); });
}, },

23
src/widget/multitree/multi.tree.insert.combo.js

@ -47,7 +47,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
popup: { popup: {
type: "bi.multi_tree_search_insert_pane", type: "bi.multi_tree_search_insert_pane",
listeners: [{ listeners: [
{
eventName: BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM, eventName: BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM,
action: function () { action: function () {
self.storeValue.value[self.trigger.getSearcher().getKeyword()] = {}; self.storeValue.value[self.trigger.getSearcher().getKeyword()] = {};
@ -58,7 +59,13 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
self._stopEditing(); self._stopEditing();
self._dataChange = true; self._dataChange = true;
} }
}] }, {
eventName: BI.MultiTreeSearchInsertPane.EVENT_CLICK_TREE_NODE,
action: function () {
self._dataChange = true;
}
}
]
} }
}, },
value: { value: o.value || {} } value: { value: o.value || {} }
@ -79,7 +86,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this); self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this); self.numberCounter.setAdapter(this);
}, },
listeners: [{ listeners: [
{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT, eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () { action: function () {
self.numberCounter.adjustView(); self.numberCounter.adjustView();
@ -115,7 +123,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
self.setValue(); self.setValue();
self._defaultState(); self._defaultState();
} }
}], }
],
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
onLoaded: function () { onLoaded: function () {
BI.nextTick(function () { BI.nextTick(function () {
@ -303,7 +312,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
{
el: this.combo, el: this.combo,
left: 0, left: 0,
right: 0, right: 0,
@ -322,7 +332,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
right: o.height, right: o.height,
top: 0, top: 0,
height: o.height, height: o.height,
}] }
]
}); });
}, },

18
src/widget/multitree/trigger/multi.tree.search.insert.pane.js

@ -25,7 +25,8 @@ BI.MultiTreeSearchInsertPane = BI.inherit(BI.Widget, {
return { return {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [
{
el: { el: {
type: "bi.text_button", type: "bi.text_button",
invisible: true, invisible: true,
@ -57,7 +58,8 @@ BI.MultiTreeSearchInsertPane = BI.inherit(BI.Widget, {
self.partTree = _ref; self.partTree = _ref;
}, },
value: opts.value, value: opts.value,
listeners: [{ listeners: [
{
eventName: BI.Controller.EVENT_CHANGE, eventName: BI.Controller.EVENT_CHANGE,
action: function () { action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -67,13 +69,20 @@ BI.MultiTreeSearchInsertPane = BI.inherit(BI.Widget, {
action: function () { action: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_CHANGE); self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_CHANGE);
} }
}] }, {
eventName: BI.PartTree.EVENT_CLICK_TREE_NODE,
action: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_CLICK_TREE_NODE);
}
}
]
}, opts.el), }, opts.el),
left: 0, left: 0,
top: 0, top: 0,
bottom: 0, bottom: 0,
right: 0 right: 0
}] }
]
}; };
}, },
@ -115,5 +124,6 @@ BI.MultiTreeSearchInsertPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearchInsertPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; BI.MultiTreeSearchInsertPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM";
BI.MultiTreeSearchInsertPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; BI.MultiTreeSearchInsertPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR";
BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.MultiTreeSearchInsertPane.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.multi_tree_search_insert_pane", BI.MultiTreeSearchInsertPane); BI.shortcut("bi.multi_tree_search_insert_pane", BI.MultiTreeSearchInsertPane);

12
src/widget/multitree/trigger/multi.tree.search.pane.js

@ -25,7 +25,8 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
opts.itemsCreator(op, callback); opts.itemsCreator(op, callback);
}, },
value: opts.value, value: opts.value,
listeners: [{ listeners: [
{
eventName: BI.Controller.EVENT_CHANGE, eventName: BI.Controller.EVENT_CHANGE,
action: function () { action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -35,7 +36,13 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
action: function () { action: function () {
self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE); self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE);
} }
}], }, {
eventName: BI.PartTree.EVENT_CLICK_TREE_NODE,
action: function () {
self.fireEvent(BI.MultiTreeSearchPane.EVENT_CLICK_TREE_NODE);
}
}
],
ref: function (_ref) { ref: function (_ref) {
self.partTree = _ref; self.partTree = _ref;
} }
@ -72,5 +79,6 @@ BI.MultiTreeSearchPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearchPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; BI.MultiTreeSearchPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM";
BI.MultiTreeSearchPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; BI.MultiTreeSearchPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR";
BI.MultiTreeSearchPane.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.multi_tree_search_pane", BI.MultiTreeSearchPane); BI.shortcut("bi.multi_tree_search_pane", BI.MultiTreeSearchPane);

15
src/widget/multitree/trigger/searcher.multi.tree.js

@ -33,7 +33,8 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
defaultText: o.defaultText, defaultText: o.defaultText,
height: o.height height: o.height
}, },
listeners: [{ listeners: [
{
eventName: BI.MultiSelectEditor.EVENT_FOCUS, eventName: BI.MultiSelectEditor.EVENT_FOCUS,
action: function () { action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS); self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS);
@ -43,7 +44,8 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
action: function () { action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR); self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR);
} }
}] }
]
}); });
this.searcher = BI.createWidget({ this.searcher = BI.createWidget({
@ -67,6 +69,14 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
op.keyword = self.editor.getValue(); op.keyword = self.editor.getValue();
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
}, },
listeners: [
{
eventName: BI.MultiTreeSearchPane.EVENT_CLICK_TREE_NODE,
action: function () {
self.fireEvent(BI.MultiTreeSearcher.EVENT_CLICK_TREE_NODE, arguments);
}
}
],
value: o.value value: o.value
}, o.popup), }, o.popup),
@ -206,4 +216,5 @@ BI.MultiTreeSearcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearcher.EVENT_START = "EVENT_START"; BI.MultiTreeSearcher.EVENT_START = "EVENT_START";
BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP"; BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP";
BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE"; BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiTreeSearcher.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.multi_tree_searcher", BI.MultiTreeSearcher); BI.shortcut("bi.multi_tree_searcher", BI.MultiTreeSearcher);

Loading…
Cancel
Save