From 6a3e1174279ff061495f8dbe53ee0ac85cbee43a Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 8 Apr 2017 16:07:59 +0800 Subject: [PATCH] add --- bi/core.js | 60 +++++++++++++----------------------------------- docs/case.js | 23 +++++++++++++++---- docs/core.js | 60 +++++++++++++----------------------------------- src/core/base.js | 60 +++++++++++++----------------------------------- 4 files changed, 66 insertions(+), 137 deletions(-) diff --git a/bi/core.js b/bi/core.js index d9b383c5d..c111edbd8 100644 --- a/bi/core.js +++ b/bi/core.js @@ -2960,52 +2960,24 @@ if (!window.BI) { //BI请求 _.extend(BI, { - ajax: (function () { - var loading, timeoutToast; - return function (option) { - option || (option = {}); - option.data = BI.extend({}, Data.SharingPool.cat("urlParameters"), option.data); - //encode - encodeBIParam(option.data); - - var async = option.async; - - option.data = BI.cjkEncodeDO(option.data); - - - $.ajax({ - url: option.url, - type: "POST", - data: option.data, - async: async, - error: option.error, - complete: function (res, status) { - if (BI.isFunction(option.complete)) { - option.complete(BI.jsonDecode(res.responseText), status); - } - } - }); - - function encodeBIParam(data) { - for (var key in data) { - if (_.isObject(data[key])) { - data[key] = window.encodeURIComponent(BI.jsonEncode(data[key])); - } else { - data[key] = window.encodeURIComponent(data[key]); - } - } - } - - function decodeBIParam(data) { - for (var key in data) { - data[key] = window.decodeURIComponent(data[key]); - if (_.isObject(data[key])) { - data[key] = BI.jsonDecode(data[key]); - } + ajax: function (option) { + option || (option = {}); + var async = option.async; + option.data = BI.cjkEncodeDO(option.data || {}); + + $.ajax({ + url: option.url, + type: "POST", + data: option.data, + async: async, + error: option.error, + complete: function (res, status) { + if (BI.isFunction(option.complete)) { + option.complete(BI.jsonDecode(res.responseText), status); } } - } - })() + }); + } }); })(jQuery);;(function () { function isEmpty(value) { diff --git a/docs/case.js b/docs/case.js index 7ce7b74c8..1ec01058d 100644 --- a/docs/case.js +++ b/docs/case.js @@ -9749,12 +9749,18 @@ BI.DynamicSummaryTreeTable = BI.inherit(BI.Widget, { }); this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { o.regionColumnSize = this.getRegionColumnSize(); - o.columnSize = this.getColumnSize(); + var columnSize = this.getColumnSize(); + var length = o.columnSize.length - columnSize.length; + o.columnSize = columnSize.slice(); + o.columnSize.splice(columnSize.length, length, ""); self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); }); this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { o.regionColumnSize = this.getRegionColumnSize(); - o.columnSize = this.getColumnSize(); + var columnSize = this.getColumnSize(); + var length = o.columnSize.length - columnSize.length; + o.columnSize = columnSize.slice(); + o.columnSize.splice(columnSize.length, length, ""); self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); }); }, @@ -9796,7 +9802,7 @@ BI.DynamicSummaryTreeTable = BI.inherit(BI.Widget, { }, getColumnSize: function () { - return this.table.getColumnSize(); + return this.options.columnSize; }, setRegionColumnSize: function (columnSize) { @@ -9991,12 +9997,19 @@ BI.extend(BI.DynamicSummaryTreeTable, { }); if (cols.length > 0) { + var nHeader = [], nItems = []; BI.each(header, function (i, node) { - BI.removeAt(node, cols); + var nNode = node.slice(); + BI.removeAt(nNode, cols); + nHeader.push(nNode); }); BI.each(items, function (i, node) { - BI.removeAt(node, cols); + var nNode = node.slice(); + BI.removeAt(nNode, cols); + nItems.push(nNode);; }); + header = nHeader; + items = nItems; } return {items: items, header: header, deletedCols: cols}; } diff --git a/docs/core.js b/docs/core.js index 1e2ea5867..774818b34 100644 --- a/docs/core.js +++ b/docs/core.js @@ -14102,52 +14102,24 @@ if (!window.BI) { //BI请求 _.extend(BI, { - ajax: (function () { - var loading, timeoutToast; - return function (option) { - option || (option = {}); - option.data = BI.extend({}, Data.SharingPool.cat("urlParameters"), option.data); - //encode - encodeBIParam(option.data); - - var async = option.async; - - option.data = BI.cjkEncodeDO(option.data); - - - $.ajax({ - url: option.url, - type: "POST", - data: option.data, - async: async, - error: option.error, - complete: function (res, status) { - if (BI.isFunction(option.complete)) { - option.complete(BI.jsonDecode(res.responseText), status); - } - } - }); - - function encodeBIParam(data) { - for (var key in data) { - if (_.isObject(data[key])) { - data[key] = window.encodeURIComponent(BI.jsonEncode(data[key])); - } else { - data[key] = window.encodeURIComponent(data[key]); - } - } - } - - function decodeBIParam(data) { - for (var key in data) { - data[key] = window.decodeURIComponent(data[key]); - if (_.isObject(data[key])) { - data[key] = BI.jsonDecode(data[key]); - } + ajax: function (option) { + option || (option = {}); + var async = option.async; + option.data = BI.cjkEncodeDO(option.data || {}); + + $.ajax({ + url: option.url, + type: "POST", + data: option.data, + async: async, + error: option.error, + complete: function (res, status) { + if (BI.isFunction(option.complete)) { + option.complete(BI.jsonDecode(res.responseText), status); } } - } - })() + }); + } }); })(jQuery);/** * 客户端观察者,主要处理事件的添加、删除、执行等 diff --git a/src/core/base.js b/src/core/base.js index 9a39342cf..93da905a3 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -1065,51 +1065,23 @@ if (!window.BI) { //BI请求 _.extend(BI, { - ajax: (function () { - var loading, timeoutToast; - return function (option) { - option || (option = {}); - option.data = BI.extend({}, Data.SharingPool.cat("urlParameters"), option.data); - //encode - encodeBIParam(option.data); - - var async = option.async; - - option.data = BI.cjkEncodeDO(option.data); - - - $.ajax({ - url: option.url, - type: "POST", - data: option.data, - async: async, - error: option.error, - complete: function (res, status) { - if (BI.isFunction(option.complete)) { - option.complete(BI.jsonDecode(res.responseText), status); - } - } - }); - - function encodeBIParam(data) { - for (var key in data) { - if (_.isObject(data[key])) { - data[key] = window.encodeURIComponent(BI.jsonEncode(data[key])); - } else { - data[key] = window.encodeURIComponent(data[key]); - } - } - } - - function decodeBIParam(data) { - for (var key in data) { - data[key] = window.decodeURIComponent(data[key]); - if (_.isObject(data[key])) { - data[key] = BI.jsonDecode(data[key]); - } + ajax: function (option) { + option || (option = {}); + var async = option.async; + option.data = BI.cjkEncodeDO(option.data || {}); + + $.ajax({ + url: option.url, + type: "POST", + data: option.data, + async: async, + error: option.error, + complete: function (res, status) { + if (BI.isFunction(option.complete)) { + option.complete(BI.jsonDecode(res.responseText), status); } } - } - })() + }); + } }); })(jQuery); \ No newline at end of file