From 3b9045f0fca34fdde7681b416a76970528931ea4 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 15 May 2017 19:52:21 +0800 Subject: [PATCH] add --- bi/base.js | 10 +++--- bi/widget.js | 31 +++++++++---------- docs/base.js | 10 +++--- docs/widget.js | 31 +++++++++---------- src/base/table/table.collection.js | 2 +- src/base/table/table.grid.js | 8 +++-- .../allvaluechooser/combo.allvaluechooser.js | 6 ++-- .../combo.treevaluechooser.js | 21 ++++++------- .../valuechooser/combo.valuechooser.js | 4 +-- 9 files changed, 63 insertions(+), 60 deletions(-) diff --git a/bi/base.js b/bi/base.js index 11cd5fd79f..d6f3853080 100644 --- a/bi/base.js +++ b/bi/base.js @@ -28731,7 +28731,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { mounted: function () { var o = this.options; - if (o.items.length > 0 || o.header.length < 0) { + if (o.items.length > 0 || o.header.length > 0) { this._digest(); this._populate(); } @@ -29513,7 +29513,7 @@ BI.GridTable = BI.inherit(BI.Widget, { mounted: function () { var o = this.options; - if (o.items.length > 0) { + if (o.items.length > 0 || o.header.length > 0) { this._populate(); } }, @@ -29524,7 +29524,8 @@ BI.GridTable = BI.inherit(BI.Widget, { _populateScrollbar: function () { var o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { @@ -29609,7 +29610,8 @@ BI.GridTable = BI.inherit(BI.Widget, { _populateTable: function () { var self = this, o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { diff --git a/bi/widget.js b/bi/widget.js index a1c55f5e09..42fb0ced59 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -17009,7 +17009,7 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, { }); BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/** - * 简单的复选下拉框控件, 适用于数据量少的情况 + * 简单的复选下拉框控件, 适用于数据量少的情况, 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值 * 封装了字段处理逻辑 * * Created by GUY on 2015/10/29. @@ -17088,13 +17088,13 @@ BI.AllValueChooserCombo = BI.inherit(BI.Widget, { return !filter[ob.value]; }); } - if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) { callback({ items: items }); return; } - if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { callback({count: items.length}); return; } @@ -17233,24 +17233,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { return; } - doCheck(0, [], selectedValues); + doCheck(0, [], this.tree.getRoot(), selectedValues); callback({ items: result }); - function doCheck(floor, parentValues, selected) { + function doCheck(floor, parentValues, node, selected) { if (floor >= self.floors) { return; } if (selected == null || BI.isEmpty(selected)) { - var children = self._getChildren(parentValues); - BI.each(children, function (i, child) { + BI.each(node.getChildren(), function (i, child) { var newParents = BI.clone(parentValues); newParents.push(child.value); var llen = self._getChildCount(newParents); - createOneJson(child, llen); - doCheck(floor + 1, newParents, {}); + createOneJson(child, node.id, llen); + doCheck(floor + 1, newParents, child, {}); }); return; } @@ -17258,8 +17257,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { var node = self._getNode(k); var newParents = BI.clone(parentValues); newParents.push(node.value); - createOneJson(node, getCount(selected[k], newParents)); - doCheck(floor + 1, newParents, selected[k]); + createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents)); + doCheck(floor + 1, newParents, node, selected[k]); }) } @@ -17274,10 +17273,10 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { return BI.size(jo); } - function createOneJson(node, llen) { + function createOneJson(node, pId, llen) { result.push({ id: node.id, - pId: node.pId, + pId: pId, text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""), value: node.value, open: true @@ -17659,7 +17658,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { if (valueMap[current][0] === 1) { var values = BI.clone(parentValues); values.push(current); - if (hasChild && self._getChildCount(values) != valueMap[current][1]) { + if (hasChild && self._getChildCount(values) !== valueMap[current][1]) { halfCheck = true; } } else if (valueMap[current][0] === 2) { @@ -17815,13 +17814,13 @@ BI.ValueChooserCombo = BI.inherit(BI.Widget, { return !filter[ob.value]; }); } - if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) { callback({ items: items }); return; } - if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { callback({count: items.length}); return; } diff --git a/docs/base.js b/docs/base.js index 11cd5fd79f..d6f3853080 100644 --- a/docs/base.js +++ b/docs/base.js @@ -28731,7 +28731,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { mounted: function () { var o = this.options; - if (o.items.length > 0 || o.header.length < 0) { + if (o.items.length > 0 || o.header.length > 0) { this._digest(); this._populate(); } @@ -29513,7 +29513,7 @@ BI.GridTable = BI.inherit(BI.Widget, { mounted: function () { var o = this.options; - if (o.items.length > 0) { + if (o.items.length > 0 || o.header.length > 0) { this._populate(); } }, @@ -29524,7 +29524,8 @@ BI.GridTable = BI.inherit(BI.Widget, { _populateScrollbar: function () { var o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { @@ -29609,7 +29610,8 @@ BI.GridTable = BI.inherit(BI.Widget, { _populateTable: function () { var self = this, o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { diff --git a/docs/widget.js b/docs/widget.js index a1c55f5e09..42fb0ced59 100644 --- a/docs/widget.js +++ b/docs/widget.js @@ -17009,7 +17009,7 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, { }); BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/** - * 简单的复选下拉框控件, 适用于数据量少的情况 + * 简单的复选下拉框控件, 适用于数据量少的情况, 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值 * 封装了字段处理逻辑 * * Created by GUY on 2015/10/29. @@ -17088,13 +17088,13 @@ BI.AllValueChooserCombo = BI.inherit(BI.Widget, { return !filter[ob.value]; }); } - if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) { callback({ items: items }); return; } - if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { callback({count: items.length}); return; } @@ -17233,24 +17233,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { return; } - doCheck(0, [], selectedValues); + doCheck(0, [], this.tree.getRoot(), selectedValues); callback({ items: result }); - function doCheck(floor, parentValues, selected) { + function doCheck(floor, parentValues, node, selected) { if (floor >= self.floors) { return; } if (selected == null || BI.isEmpty(selected)) { - var children = self._getChildren(parentValues); - BI.each(children, function (i, child) { + BI.each(node.getChildren(), function (i, child) { var newParents = BI.clone(parentValues); newParents.push(child.value); var llen = self._getChildCount(newParents); - createOneJson(child, llen); - doCheck(floor + 1, newParents, {}); + createOneJson(child, node.id, llen); + doCheck(floor + 1, newParents, child, {}); }); return; } @@ -17258,8 +17257,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { var node = self._getNode(k); var newParents = BI.clone(parentValues); newParents.push(node.value); - createOneJson(node, getCount(selected[k], newParents)); - doCheck(floor + 1, newParents, selected[k]); + createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents)); + doCheck(floor + 1, newParents, node, selected[k]); }) } @@ -17274,10 +17273,10 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { return BI.size(jo); } - function createOneJson(node, llen) { + function createOneJson(node, pId, llen) { result.push({ id: node.id, - pId: node.pId, + pId: pId, text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""), value: node.value, open: true @@ -17659,7 +17658,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { if (valueMap[current][0] === 1) { var values = BI.clone(parentValues); values.push(current); - if (hasChild && self._getChildCount(values) != valueMap[current][1]) { + if (hasChild && self._getChildCount(values) !== valueMap[current][1]) { halfCheck = true; } } else if (valueMap[current][0] === 2) { @@ -17815,13 +17814,13 @@ BI.ValueChooserCombo = BI.inherit(BI.Widget, { return !filter[ob.value]; }); } - if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) { callback({ items: items }); return; } - if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { callback({count: items.length}); return; } diff --git a/src/base/table/table.collection.js b/src/base/table/table.collection.js index 7d222750d1..c60b8333a8 100644 --- a/src/base/table/table.collection.js +++ b/src/base/table/table.collection.js @@ -163,7 +163,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { mounted: function () { var o = this.options; - if (o.items.length > 0 || o.header.length < 0) { + if (o.items.length > 0 || o.header.length > 0) { this._digest(); this._populate(); } diff --git a/src/base/table/table.grid.js b/src/base/table/table.grid.js index 8205bf52cd..1ddee09e40 100644 --- a/src/base/table/table.grid.js +++ b/src/base/table/table.grid.js @@ -167,7 +167,7 @@ BI.GridTable = BI.inherit(BI.Widget, { mounted: function () { var o = this.options; - if (o.items.length > 0) { + if (o.items.length > 0 || o.header.length > 0) { this._populate(); } }, @@ -178,7 +178,8 @@ BI.GridTable = BI.inherit(BI.Widget, { _populateScrollbar: function () { var o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { @@ -263,7 +264,8 @@ BI.GridTable = BI.inherit(BI.Widget, { _populateTable: function () { var self = this, o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { diff --git a/src/component/allvaluechooser/combo.allvaluechooser.js b/src/component/allvaluechooser/combo.allvaluechooser.js index 0b1fc30bed..25d797533b 100644 --- a/src/component/allvaluechooser/combo.allvaluechooser.js +++ b/src/component/allvaluechooser/combo.allvaluechooser.js @@ -1,5 +1,5 @@ /** - * 简单的复选下拉框控件, 适用于数据量少的情况 + * 简单的复选下拉框控件, 适用于数据量少的情况, 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值 * 封装了字段处理逻辑 * * Created by GUY on 2015/10/29. @@ -78,13 +78,13 @@ BI.AllValueChooserCombo = BI.inherit(BI.Widget, { return !filter[ob.value]; }); } - if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) { callback({ items: items }); return; } - if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { callback({count: items.length}); return; } diff --git a/src/component/treevaluechooser/combo.treevaluechooser.js b/src/component/treevaluechooser/combo.treevaluechooser.js index c97b6b3e76..1a35109144 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.js @@ -106,24 +106,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { return; } - doCheck(0, [], selectedValues); + doCheck(0, [], this.tree.getRoot(), selectedValues); callback({ items: result }); - function doCheck(floor, parentValues, selected) { + function doCheck(floor, parentValues, node, selected) { if (floor >= self.floors) { return; } if (selected == null || BI.isEmpty(selected)) { - var children = self._getChildren(parentValues); - BI.each(children, function (i, child) { + BI.each(node.getChildren(), function (i, child) { var newParents = BI.clone(parentValues); newParents.push(child.value); var llen = self._getChildCount(newParents); - createOneJson(child, llen); - doCheck(floor + 1, newParents, {}); + createOneJson(child, node.id, llen); + doCheck(floor + 1, newParents, child, {}); }); return; } @@ -131,8 +130,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { var node = self._getNode(k); var newParents = BI.clone(parentValues); newParents.push(node.value); - createOneJson(node, getCount(selected[k], newParents)); - doCheck(floor + 1, newParents, selected[k]); + createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents)); + doCheck(floor + 1, newParents, node, selected[k]); }) } @@ -147,10 +146,10 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { return BI.size(jo); } - function createOneJson(node, llen) { + function createOneJson(node, pId, llen) { result.push({ id: node.id, - pId: node.pId, + pId: pId, text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""), value: node.value, open: true @@ -532,7 +531,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, { if (valueMap[current][0] === 1) { var values = BI.clone(parentValues); values.push(current); - if (hasChild && self._getChildCount(values) != valueMap[current][1]) { + if (hasChild && self._getChildCount(values) !== valueMap[current][1]) { halfCheck = true; } } else if (valueMap[current][0] === 2) { diff --git a/src/component/valuechooser/combo.valuechooser.js b/src/component/valuechooser/combo.valuechooser.js index d09392ec03..778865ffbc 100644 --- a/src/component/valuechooser/combo.valuechooser.js +++ b/src/component/valuechooser/combo.valuechooser.js @@ -90,13 +90,13 @@ BI.ValueChooserCombo = BI.inherit(BI.Widget, { return !filter[ob.value]; }); } - if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) { callback({ items: items }); return; } - if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { callback({count: items.length}); return; }