From 52c98fa24ba7c532237cd303a1e653fc29b75beb Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 30 Mar 2017 11:58:54 +0800 Subject: [PATCH 1/2] update --- bi/core.js | 80 +++++++++---------- bi/widget.css | 4 +- bi/widget.js | 3 +- dist/core.js | 80 +++++++++---------- dist/widget.css | 4 +- dist/widget.js | 3 +- src/core/proto/date.js | 80 +++++++++---------- .../finetuning.number.editor.css | 4 +- .../finetuning.number.editor.less | 4 +- src/widget/date/trigger.date.js | 3 +- 10 files changed, 135 insertions(+), 130 deletions(-) diff --git a/bi/core.js b/bi/core.js index b8335b378..29b81c77f 100644 --- a/bi/core.js +++ b/bi/core.js @@ -6301,56 +6301,56 @@ BI.Cache = { document.cookie = cookieString; } };// full day names -Date._DN = [BI.i18nText("BI-Sunday"), - BI.i18nText("BI-Monday"), - BI.i18nText("BI-Tuesday"), - BI.i18nText("BI-Wednesday"), - BI.i18nText("BI-Thursday"), - BI.i18nText("BI-Friday"), - BI.i18nText("BI-Saturday"), - BI.i18nText("BI-Sunday")]; +Date._DN = [BI.i18nText("BI-Basic_Sunday"), + BI.i18nText("BI-Basic_Monday"), + BI.i18nText("BI-Basic_Tuesday"), + BI.i18nText("BI-Basic_Wednesday"), + BI.i18nText("BI-Basic_Thursday"), + BI.i18nText("BI-Basic_Friday"), + BI.i18nText("BI-Basic_Saturday"), + BI.i18nText("BI-Basic_Sunday")]; // short day names -Date._SDN = ['', - '', - '', - '', - '', - '', - '', - '']; +Date._SDN = [BI.i18nText("BI-Day_Ri"), + BI.i18nText("BI-Basic_One"), + BI.i18nText("BI-Basic_Two"), + BI.i18nText("BI-Basic_Three"), + BI.i18nText("BI-Basic_Four"), + BI.i18nText("BI-Basic_Five"), + BI.i18nText("BI-Basic_Six"), + BI.i18nText("BI-Day_Ri")]; // Monday first, etc. Date._FD = 1; // full month names Date._MN = [ - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '']; + BI.i18nText("BI-Basic_January"), + BI.i18nText("BI-Basic_February"), + BI.i18nText("BI-Basic_March"), + BI.i18nText("BI-Basic_April"), + BI.i18nText("BI-Basic_May"), + BI.i18nText("BI-Basic_June"), + BI.i18nText("BI-Basic_July"), + BI.i18nText("BI-Basic_August"), + BI.i18nText("BI-Basic_September"), + BI.i18nText("BI-Basic_October"), + BI.i18nText("BI-Basic_November"), + BI.i18nText("BI-Basic_December")]; // short month names -Date._SMN = ['', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '']; +Date._SMN = [0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11]; Date._QN = ["", BI.i18nText("BI-Quarter_1"), BI.i18nText("BI-Quarter_2"), diff --git a/bi/widget.css b/bi/widget.css index 51d075000..a048dd5bc 100644 --- a/bi/widget.css +++ b/bi/widget.css @@ -233,11 +233,13 @@ } .bi-fine-tuning-number-editor .top-button { border-left: 1px solid #d4dadd; - border-bottom: 1px solid #d4dadd; } .bi-fine-tuning-number-editor .bottom-button { border-left: 1px solid #d4dadd; } +.bi-fine-tuning-number-editor .split-line { + background-color: #d4dadd; +} /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ diff --git a/bi/widget.js b/bi/widget.js index fec31d1b5..75b27e101 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -4857,7 +4857,6 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge hgap: 4, vgap: 2, triggerWidth: 30, - watermark: BI.i18nText("BI-Unrestricted"), yearLength: 4, yearMonthLength: 7 }, @@ -4891,7 +4890,7 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge hgap: c.hgap, vgap: c.vgap, allowBlank: true, - watermark: c.watermark, + watermark: BI.i18nText("BI-Unrestricted"), errorText: function () { if (self.editor.isEditing()) { return BI.i18nText("BI-Date_Trigger_Error_Text"); diff --git a/dist/core.js b/dist/core.js index f426c41a0..870551ae6 100644 --- a/dist/core.js +++ b/dist/core.js @@ -23672,56 +23672,56 @@ BI.Cache = { document.cookie = cookieString; } };// full day names -Date._DN = [BI.i18nText("BI-Sunday"), - BI.i18nText("BI-Monday"), - BI.i18nText("BI-Tuesday"), - BI.i18nText("BI-Wednesday"), - BI.i18nText("BI-Thursday"), - BI.i18nText("BI-Friday"), - BI.i18nText("BI-Saturday"), - BI.i18nText("BI-Sunday")]; +Date._DN = [BI.i18nText("BI-Basic_Sunday"), + BI.i18nText("BI-Basic_Monday"), + BI.i18nText("BI-Basic_Tuesday"), + BI.i18nText("BI-Basic_Wednesday"), + BI.i18nText("BI-Basic_Thursday"), + BI.i18nText("BI-Basic_Friday"), + BI.i18nText("BI-Basic_Saturday"), + BI.i18nText("BI-Basic_Sunday")]; // short day names -Date._SDN = ['', - '', - '', - '', - '', - '', - '', - '']; +Date._SDN = [BI.i18nText("BI-Day_Ri"), + BI.i18nText("BI-Basic_One"), + BI.i18nText("BI-Basic_Two"), + BI.i18nText("BI-Basic_Three"), + BI.i18nText("BI-Basic_Four"), + BI.i18nText("BI-Basic_Five"), + BI.i18nText("BI-Basic_Six"), + BI.i18nText("BI-Day_Ri")]; // Monday first, etc. Date._FD = 1; // full month names Date._MN = [ - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '']; + BI.i18nText("BI-Basic_January"), + BI.i18nText("BI-Basic_February"), + BI.i18nText("BI-Basic_March"), + BI.i18nText("BI-Basic_April"), + BI.i18nText("BI-Basic_May"), + BI.i18nText("BI-Basic_June"), + BI.i18nText("BI-Basic_July"), + BI.i18nText("BI-Basic_August"), + BI.i18nText("BI-Basic_September"), + BI.i18nText("BI-Basic_October"), + BI.i18nText("BI-Basic_November"), + BI.i18nText("BI-Basic_December")]; // short month names -Date._SMN = ['', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '']; +Date._SMN = [0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11]; Date._QN = ["", BI.i18nText("BI-Quarter_1"), BI.i18nText("BI-Quarter_2"), diff --git a/dist/widget.css b/dist/widget.css index 51d075000..a048dd5bc 100644 --- a/dist/widget.css +++ b/dist/widget.css @@ -233,11 +233,13 @@ } .bi-fine-tuning-number-editor .top-button { border-left: 1px solid #d4dadd; - border-bottom: 1px solid #d4dadd; } .bi-fine-tuning-number-editor .bottom-button { border-left: 1px solid #d4dadd; } +.bi-fine-tuning-number-editor .split-line { + background-color: #d4dadd; +} /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ diff --git a/dist/widget.js b/dist/widget.js index fec31d1b5..75b27e101 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -4857,7 +4857,6 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge hgap: 4, vgap: 2, triggerWidth: 30, - watermark: BI.i18nText("BI-Unrestricted"), yearLength: 4, yearMonthLength: 7 }, @@ -4891,7 +4890,7 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge hgap: c.hgap, vgap: c.vgap, allowBlank: true, - watermark: c.watermark, + watermark: BI.i18nText("BI-Unrestricted"), errorText: function () { if (self.editor.isEditing()) { return BI.i18nText("BI-Date_Trigger_Error_Text"); diff --git a/src/core/proto/date.js b/src/core/proto/date.js index 636fafdc7..d1c240377 100644 --- a/src/core/proto/date.js +++ b/src/core/proto/date.js @@ -1,54 +1,54 @@ // full day names -Date._DN = [BI.i18nText("BI-Sunday"), - BI.i18nText("BI-Monday"), - BI.i18nText("BI-Tuesday"), - BI.i18nText("BI-Wednesday"), - BI.i18nText("BI-Thursday"), - BI.i18nText("BI-Friday"), - BI.i18nText("BI-Saturday"), - BI.i18nText("BI-Sunday")]; +Date._DN = [BI.i18nText("BI-Basic_Sunday"), + BI.i18nText("BI-Basic_Monday"), + BI.i18nText("BI-Basic_Tuesday"), + BI.i18nText("BI-Basic_Wednesday"), + BI.i18nText("BI-Basic_Thursday"), + BI.i18nText("BI-Basic_Friday"), + BI.i18nText("BI-Basic_Saturday"), + BI.i18nText("BI-Basic_Sunday")]; // short day names -Date._SDN = ['', - '', - '', - '', - '', - '', - '', - '']; +Date._SDN = [BI.i18nText("BI-Day_Ri"), + BI.i18nText("BI-Basic_One"), + BI.i18nText("BI-Basic_Two"), + BI.i18nText("BI-Basic_Three"), + BI.i18nText("BI-Basic_Four"), + BI.i18nText("BI-Basic_Five"), + BI.i18nText("BI-Basic_Six"), + BI.i18nText("BI-Day_Ri")]; // Monday first, etc. Date._FD = 1; // full month names Date._MN = [ - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '']; + BI.i18nText("BI-Basic_January"), + BI.i18nText("BI-Basic_February"), + BI.i18nText("BI-Basic_March"), + BI.i18nText("BI-Basic_April"), + BI.i18nText("BI-Basic_May"), + BI.i18nText("BI-Basic_June"), + BI.i18nText("BI-Basic_July"), + BI.i18nText("BI-Basic_August"), + BI.i18nText("BI-Basic_September"), + BI.i18nText("BI-Basic_October"), + BI.i18nText("BI-Basic_November"), + BI.i18nText("BI-Basic_December")]; // short month names -Date._SMN = ['', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '']; +Date._SMN = [0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11]; Date._QN = ["", BI.i18nText("BI-Quarter_1"), BI.i18nText("BI-Quarter_2"), diff --git a/src/css/widget/finetuningnumbereditor/finetuning.number.editor.css b/src/css/widget/finetuningnumbereditor/finetuning.number.editor.css index d8afcf239..69e34450a 100644 --- a/src/css/widget/finetuningnumbereditor/finetuning.number.editor.css +++ b/src/css/widget/finetuningnumbereditor/finetuning.number.editor.css @@ -9,8 +9,10 @@ } .bi-fine-tuning-number-editor .top-button { border-left: 1px solid #d4dadd; - border-bottom: 1px solid #d4dadd; } .bi-fine-tuning-number-editor .bottom-button { border-left: 1px solid #d4dadd; } +.bi-fine-tuning-number-editor .split-line { + background-color: #d4dadd; +} diff --git a/src/less/widget/finetuningnumbereditor/finetuning.number.editor.less b/src/less/widget/finetuningnumbereditor/finetuning.number.editor.less index 2f7905f81..3074def16 100644 --- a/src/less/widget/finetuningnumbereditor/finetuning.number.editor.less +++ b/src/less/widget/finetuningnumbereditor/finetuning.number.editor.less @@ -5,9 +5,11 @@ .border-radius(2px); & .top-button { border-left: 1px solid @border-color-normal; - border-bottom: 1px solid @border-color-normal; } & .bottom-button { border-left: 1px solid @border-color-normal; } + & .split-line{ + background-color: @border-color-normal; + } } \ No newline at end of file diff --git a/src/widget/date/trigger.date.js b/src/widget/date/trigger.date.js index a425ce6f8..75f51a86a 100644 --- a/src/widget/date/trigger.date.js +++ b/src/widget/date/trigger.date.js @@ -3,7 +3,6 @@ BI.DateTrigger = BI.inherit(BI.Trigger, { hgap: 4, vgap: 2, triggerWidth: 30, - watermark: BI.i18nText("BI-Unrestricted"), yearLength: 4, yearMonthLength: 7 }, @@ -37,7 +36,7 @@ BI.DateTrigger = BI.inherit(BI.Trigger, { hgap: c.hgap, vgap: c.vgap, allowBlank: true, - watermark: c.watermark, + watermark: BI.i18nText("BI-Unrestricted"), errorText: function () { if (self.editor.isEditing()) { return BI.i18nText("BI-Date_Trigger_Error_Text"); From 3ebf571467d03d6162f7b81bb9bc4b668f0d0e3d Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 30 Mar 2017 15:48:31 +0800 Subject: [PATCH 2/2] ajax --- demo/version.js | 6 +- src/base/base.js | 6 +- src/core/base.js | 176 +---------------------------------------------- 3 files changed, 9 insertions(+), 179 deletions(-) diff --git a/demo/version.js b/demo/version.js index 51c96d178..5e16777ec 100644 --- a/demo/version.js +++ b/demo/version.js @@ -4,4 +4,8 @@ Demo = { BI.i18n = { "BI-Basic_OK": "确定" -}; \ No newline at end of file +}; + +BI.servletURL = "dist/"; +BI.resourceURL = "dist/resource/"; +BI.i18n = {}; \ No newline at end of file diff --git a/src/base/base.js b/src/base/base.js index 1198a5d52..49c5b2109 100644 --- a/src/base/base.js +++ b/src/base/base.js @@ -5,8 +5,4 @@ BI.Bubbles = new BI.BubblesController(); BI.Tooltips = new BI.TooltipsController(); BI.Popovers = new BI.FloatBoxController(); BI.Broadcasts = new BI.BroadcastController(); -BI.StyleLoaders = new BI.StyleLoaderManager(); - -BI.servletURL = "dist/"; -BI.resourceURL = "dist/resource/"; -BI.i18n = {}; \ No newline at end of file +BI.StyleLoaders = new BI.StyleLoaderManager(); \ No newline at end of file diff --git a/src/core/base.js b/src/core/base.js index e91ddc164..cdee5f2d5 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -1076,28 +1076,7 @@ if (!window.BI) { //encode encodeBIParam(option.data); - var async = true; - if (BI.isNotNull(option.async)) { - async = option.async; - } - - if (BI.isNull(loading)) { - loading = BI.createWidget({ - type: "bi.request_loading" - }); - } - - if (BI.isNull(timeoutToast)) { - timeoutToast = BI.createWidget({ - type: "bi.timeout_toast" - }); - timeoutToast.setCallback(function (op) { - decodeBIParam(op.data); - BI.ajax(op); - }); - } - timeoutToast.addReq(option); - + var async = option.async; option.data = BI.cjkEncodeDO(option.data); @@ -1107,68 +1086,14 @@ if (!window.BI) { type: "POST", data: option.data, async: async, - error: function () { - if (!timeoutToast.hasReq(option)) { - return; - } - timeoutToast.removeReq(option); - //失败 取消、重新加载 - loading.setCallback(function () { - decodeBIParam(option.data); - BI.ajax(option); - }); - loading.showError(); - }, + error: option.error, complete: function (res, status) { - if (!timeoutToast.hasReq(option)) { - return; - } - timeoutToast.removeReq(option); - //登录超时 - if (BI.isNotNull(res.responseText) && - res.responseText.indexOf("fs-login-content") > -1 && - res.responseText.indexOf("fs-login-input-password-confirm") === -1) { - if (BI.Popovers.isVisible(BI.LoginTimeOut.POPOVER_ID)) { - return; - } - if (BI.isNotNull(BI.Popovers.get(BI.LoginTimeOut.POPOVER_ID))) { - BI.Popovers.open(BI.LoginTimeOut.POPOVER_ID); - return; - } - var loginTimeout = BI.createWidget({ - type: "bi.login_timeout" - }); - loginTimeout.on(BI.LoginTimeOut.EVENT_LOGIN, function () { - decodeBIParam(option.data); - BI.ajax(option); - BI.Popovers.remove(BI.LoginTimeOut.POPOVER_ID); - }); - BI.Popovers.create(BI.LoginTimeOut.POPOVER_ID, loginTimeout, { - width: 600, - height: 400 - }).open(BI.LoginTimeOut.POPOVER_ID); - } else if (BI.isNotNull(res.responseText) && - res.responseText.indexOf("script") > -1 && - res.responseText.indexOf("Session Timeout...") > -1) { - //登录失效 - loading.setCallback(function () { - location.reload(); - }); - loading.showError(); - - } else if (status === "success" && BI.isFunction(option.success)) { - option.success(BI.jsonDecode(res.responseText)); - } if (BI.isFunction(option.complete)) { option.complete(BI.jsonDecode(res.responseText), status); } } }); - return function cancel() { - timeoutToast.removeReq(option); - }; - function encodeBIParam(data) { for (var key in data) { if (_.isObject(data[key])) { @@ -1188,101 +1113,6 @@ if (!window.BI) { } } } - })(), - - /** - * 异步ajax请求 - * @param {String} op op参数 - * @param {String} cmd cmd参数 - * @param {JSON} data ajax请求的参数 - * @param {Function} callback 回调函数 - * @param {Function} complete 回调 - */ - requestAsync: function (op, cmd, data, callback, complete) { - data = data || {}; - if (!BI.isKey(op)) { - op = 'fr_bi_dezi'; - } - if (op === "fr_bi_dezi" || op === "fr_bi_configure") { - data.sessionID = Data.SharingPool.get("sessionID"); - } - var url = BI.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); - return (BI.ajax)({ - url: url, - type: 'POST', - data: data, - error: function () { - // BI.Msg.toast(BI.i18nText("BI-Ajax_Error")); - }, - success: function (res) { - if (BI.isFunction(callback)) { - callback(res); - } - }, - complete: function (res, status) { - if (BI.isFunction(complete)) { - complete(res); - } - } - }); - }, - - /** - * 同步ajax请求 - * @param {String} op op参数 - * @param {String} cmd cmd参数 - * @param {JSON} data ajax请求的参�? - * @returns {Object} ajax同步请求返回的JSON对象 - */ - requestSync: function (op, cmd, data) { - data = data || {}; - if (!BI.isKey(op)) { - op = 'fr_bi_dezi'; - } - if (op === "fr_bi_dezi") { - data.sessionID = Data.SharingPool.get("sessionID"); - } - var url = BI.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); - var result = {}; - (BI.ajax)({ - url: url, - type: 'POST', - async: false, - data: data, - error: function () { - BI.Msg.toast(BI.i18nText("BI-Ajax_Error")); - }, - complete: function (res, status) { - if (status === 'success') { - result = res; - } - } - }); - return result; - }, - - /** - * 请求方法 - * @param cmd 命令 - * @param data 数据 - * @param extend 参数 - * @returns {*} - */ - request: function (cmd, data, extend) { - extend = extend || {}; - data = data || {}; - var op = extend.op; - if (!BI.isKey(op)) { - op = 'fr_bi_dezi'; - } - if (op === "fr_bi_dezi") { - data.sessionID = Data.SharingPool.get("sessionID"); - } - if (extend.async === true) { - BI.requestAsync(op, cmd, data, extend.complete || extend.success); - } else { - return BI.requestSync(op, cmd, data); - } - } + })() }); })(jQuery); \ No newline at end of file