From 9b7668108a979e9f489924acf19a9f50531b11f7 Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 25 Dec 2018 11:44:19 +0800 Subject: [PATCH] BI-35203 --- .../node/node.first.plus.js | 55 ++++++++++-------- .../node/node.last.plus.js | 53 ++++++++++------- .../node/node.mid.plus.js | 53 ++++++++++------- .../multilayersingletree/node/node.plus.js | 58 ++++++++++--------- 4 files changed, 126 insertions(+), 93 deletions(-) diff --git a/src/widget/multilayersingletree/node/node.first.plus.js b/src/widget/multilayersingletree/node/node.first.plus.js index a5d053a59c..f72f49ed2a 100644 --- a/src/widget/multilayersingletree/node/node.first.plus.js +++ b/src/widget/multilayersingletree/node/node.first.plus.js @@ -20,29 +20,7 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { _init: function () { BI.MultiLayerSingleTreeFirstPlusGroupNode.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.node = BI.createWidget({ - type: "bi.first_plus_group_node", - cls: "bi-list-item-none", - logic: { - dynamic: true - }, - id: o.id, - pId: o.pId, - open: o.open, - isLastNode: o.isLastNode, - height: o.height, - hgap: o.hgap, - text: o.text, - value: o.value, - py: o.py, - keyword: o.keyword - }); - this.node.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) {// 本身实现click功能 - return; - } - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); + this.node = this._createNode(); var needBlankLayers = []; var pNode = o.pNode; @@ -89,6 +67,37 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { if (BI.isNotNull(this.node)) { this.node.setOpened(v); } + }, + + _createNode: function () { + var self = this, o = this.options; + + return BI.createWidget({ + type: "bi.first_plus_group_node", + cls: "bi-list-item-none", + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + isLastNode: o.isLastNode, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py, + keyword: o.keyword, + listeners: [{ + eventName: BI.Controller.EVENT_CHANGE, + action: function (type) { + if (type === BI.Events.CLICK) {// 本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + } + }] + }); } }); diff --git a/src/widget/multilayersingletree/node/node.last.plus.js b/src/widget/multilayersingletree/node/node.last.plus.js index ffdb62ddaa..02a8a26e08 100644 --- a/src/widget/multilayersingletree/node/node.last.plus.js +++ b/src/widget/multilayersingletree/node/node.last.plus.js @@ -20,28 +20,7 @@ BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { _init: function () { BI.MultiLayerSingleTreeLastPlusGroupNode.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.node = BI.createWidget({ - type: "bi.last_plus_group_node", - cls: "bi-list-item-none", - logic: { - dynamic: true - }, - id: o.id, - pId: o.pId, - open: o.open, - height: o.height, - hgap: o.hgap, - text: o.text, - value: o.value, - py: o.py, - keyword: o.keyword - }); - this.node.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) {// 本身实现click功能 - return; - } - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); + this.node = this._createNode(); var needBlankLayers = []; var pNode = o.pNode; @@ -88,6 +67,36 @@ BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { if (BI.isNotNull(this.node)) { this.node.setOpened(v); } + }, + + _createNode: function () { + var self = this, o = this.options; + + return BI.createWidget({ + type: "bi.last_plus_group_node", + cls: "bi-list-item-none", + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py, + keyword: o.keyword, + listeners: [{ + eventName: BI.Controller.EVENT_CHANGE, + action: function (type) { + if (type === BI.Events.CLICK) {// 本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + } + }] + }); } }); diff --git a/src/widget/multilayersingletree/node/node.mid.plus.js b/src/widget/multilayersingletree/node/node.mid.plus.js index 482917befd..64612ca048 100644 --- a/src/widget/multilayersingletree/node/node.mid.plus.js +++ b/src/widget/multilayersingletree/node/node.mid.plus.js @@ -20,28 +20,7 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { _init: function () { BI.MultiLayerSingleTreeMidPlusGroupNode.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.node = BI.createWidget({ - type: "bi.mid_plus_group_node", - cls: "bi-list-item-none", - logic: { - dynamic: true - }, - id: o.id, - pId: o.pId, - open: o.open, - height: o.height, - hgap: o.hgap, - text: o.text, - value: o.value, - py: o.py, - keyword: o.keyword - }); - this.node.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) {// 本身实现click功能 - return; - } - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); + this.node = this._createNode(); var needBlankLayers = []; var pNode = o.pNode; @@ -88,6 +67,36 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { if (BI.isNotNull(this.node)) { this.node.setOpened(v); } + }, + + _createNode: function () { + var self = this, o = this.options; + + return BI.createWidget({ + type: "bi.mid_plus_group_node", + cls: "bi-list-item-none", + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py, + keyword: o.keyword, + listeners: [{ + eventName: BI.Controller.EVENT_CHANGE, + action: function (type) { + if (type === BI.Events.CLICK) {// 本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + } + }] + }); } }); diff --git a/src/widget/multilayersingletree/node/node.plus.js b/src/widget/multilayersingletree/node/node.plus.js index 93d60c58cf..b2fbd37e61 100644 --- a/src/widget/multilayersingletree/node/node.plus.js +++ b/src/widget/multilayersingletree/node/node.plus.js @@ -18,32 +18,7 @@ BI.MultiLayerSingleTreePlusGroupNode = BI.inherit(BI.NodeButton, { _init: function () { BI.MultiLayerSingleTreePlusGroupNode.superclass._init.apply(this, arguments); var self = this, o = this.options; - if (o.isLastNode && !o.pNode) { - - } - this.node = BI.createWidget({ - type: "bi.plus_group_node", - cls: "bi-list-item-none", - logic: { - dynamic: true - }, - id: o.id, - pId: o.pId, - open: o.open, - isLastNode: o.isLastNode, - height: o.height, - hgap: o.hgap, - text: o.text, - value: o.value, - py: o.py, - keyword: o.keyword - }); - this.node.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) {// 本身实现click功能 - return; - } - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); + this.node = this._createNode(); var needBlankLayers = []; var pNode = o.pNode; @@ -90,6 +65,37 @@ BI.MultiLayerSingleTreePlusGroupNode = BI.inherit(BI.NodeButton, { if (BI.isNotNull(this.node)) { this.node.setOpened(v); } + }, + + _createNode: function () { + var self = this, o = this.options; + + return BI.createWidget({ + type: "bi.plus_group_node", + cls: "bi-list-item-none", + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + isLastNode: o.isLastNode, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py, + keyword: o.keyword, + listeners: [{ + eventName: BI.Controller.EVENT_CHANGE, + action: function (type) { + if (type === BI.Events.CLICK) {// 本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + } + }] + }); } });