Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/qualityMonitoringView.js =================================================================== diff -u -r30916 -r30931 --- ssts-web/src/main/webapp/disinfectsystem/reportforms/qualityMonitoringView.js (.../qualityMonitoringView.js) (revision 30916) +++ ssts-web/src/main/webapp/disinfectsystem/reportforms/qualityMonitoringView.js (.../qualityMonitoringView.js) (revision 30931) @@ -1,5 +1,6 @@ var entityName = "质量监测报表"; var grid; +var exportMask; var rd = new Ext.data.JsonReader({ fields: [ @@ -387,116 +388,6 @@ } } -(function (root, factory) { - if (typeof define === "function" && define.amd) { - define([], factory); - } else if (typeof module === "object" && module.exports) { - module.exports = factory(); - } else { - root.Base64 = factory(); - } -}(this, function () { - 'use strict'; - - function Base64() { - // private property - this._keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - } - //public method for encoding - Base64.prototype.encode = function (input) { - var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0; - input = this._utf8_encode(input); - while (i < input.length) { - chr1 = input.charCodeAt(i++); - chr2 = input.charCodeAt(i++); - chr3 = input.charCodeAt(i++); - enc1 = chr1 >> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); - enc4 = chr3 & 63; - if (isNaN(chr2)) { - enc3 = enc4 = 64; - } else if (isNaN(chr3)) { - enc4 = 64; - } - output = output + - this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + - this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); - } - return output; - } - - // public method for decoding - Base64.prototype.decode = function (input) { - var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0; - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - while (i < input.length) { - enc1 = this._keyStr.indexOf(input.charAt(i++)); - enc2 = this._keyStr.indexOf(input.charAt(i++)); - enc3 = this._keyStr.indexOf(input.charAt(i++)); - enc4 = this._keyStr.indexOf(input.charAt(i++)); - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - output = output + String.fromCharCode(chr1); - if (enc3 != 64) { - output = output + String.fromCharCode(chr2); - } - if (enc4 != 64) { - output = output + String.fromCharCode(chr3); - } - } - output = this._utf8_decode(output); - return output; - } - // private method for UTF-8 encoding - Base64.prototype._utf8_encode = function (string) { - string = string.replace(/\r\n/g, "\n"); - var utftext = ""; - for (var n = 0; n < string.length; n++) { - var c = string.charCodeAt(n); - if (c < 128) { - utftext += String.fromCharCode(c); - } else if ((c > 127) && (c < 2048)) { - utftext += String.fromCharCode((c >> 6) | 192); - utftext += String.fromCharCode((c & 63) | 128); - } else { - utftext += String.fromCharCode((c >> 12) | 224); - utftext += String.fromCharCode(((c >> 6) & 63) | 128); - utftext += String.fromCharCode((c & 63) | 128); - } - - } - return utftext; - } - - // private method for UTF-8 decoding - Base64.prototype._utf8_decode = function (utftext) { - var string = "", i = 0, c = 0, c1 = 0, c2 = 0, c3 = 0; - while (i < utftext.length) { - c = utftext.charCodeAt(i); - if (c < 128) { - string += String.fromCharCode(c); - i++; - } else if ((c > 191) && (c < 224)) { - c2 = utftext.charCodeAt(i + 1); - string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = utftext.charCodeAt(i + 1); - c3 = utftext.charCodeAt(i + 2); - string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - } - return string; - } - - var Base64 = new Base64(); - - return Base64; -})); - function exportExcel(data,thisID) { var fileName = data.fileName + data.fileType; if (isIE()) { @@ -506,24 +397,29 @@ tableHtml += ''; tableHtml = Base64.encode(tableHtml); var params = { - htmlTable: tableHtml + htmlTable: LZString.compressToEncodedURIComponent(tableHtml) } + var jsFileName = "\\disinfectsystem\\reportforms\\js\\LZString.js"; + sessionStorage.setItem('htmlFileName', fileName); + sessionStorage.setItem('jsFileName', jsFileName); Ext.Ajax.request({ url: url, async: false, params: params, success: function (response) { - sessionStorage.setItem('htmlFileName', fileName); + exportMask.hide(); window.open(WWWROOT + '/homepage/exportMonitorData.jsp', "_blank"); }, failure: function (response, options) { + exportMask.hide(); showResult(response.responseText); } }); } else { var elt = thisID; var wb = XLSX.utils.table_to_book(elt, { sheet: data.fileName }); XLSX.writeFile(wb, fileName); + exportMask.hide(); } } @@ -995,7 +891,14 @@ fileType: ".xls",//文档类型 经测试 可以doc xls html 其他的自己去试 html: html } - exportExcel(data,document.getElementById('thisIframe').contentWindow.document.getElementById('frameTable')); + exportMask = new Ext.LoadMask(Ext.getBody(), { + msg: '正在导出文件,请稍候!', + removeMask: true + }); + exportMask.show(); + setTimeout(function(){ + exportExcel(data,document.getElementById('thisIframe').contentWindow.document.getElementById('frameTable')); + }, 1000); } } }], Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/qualityMonitoringView.jsp =================================================================== diff -u -r30916 -r30931 --- ssts-web/src/main/webapp/disinfectsystem/reportforms/qualityMonitoringView.jsp (.../qualityMonitoringView.jsp) (revision 30916) +++ ssts-web/src/main/webapp/disinfectsystem/reportforms/qualityMonitoringView.jsp (.../qualityMonitoringView.jsp) (revision 30931) @@ -17,6 +17,8 @@ + + <% SupplyRoomConfigManager supplyRoomConfigManager = (SupplyRoomConfigManager)SpringBeanManger.getBean("supplyRoomConfigManager"); Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/js/LZString.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/reportforms/js/LZString.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/reportforms/js/LZString.js (revision 30931) @@ -0,0 +1,261 @@ + +//数据压缩 +var LZString = function () { + function f(h, e) { + if (!b[h]) { + b[h] = {}; + for (var i = 0; i < h.length; i++) { + b[h][h.charAt(i)] = i + } + } + return b[h][e] + } + + var c = String.fromCharCode, + g = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", + d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$", + b = {}, + a = { + compressToEncodedURIComponent: function (e) { + return null == e ? "" : a._compress(e, 6, + function (h) { + return d.charAt(h) + }) + }, + decompressFromEncodedURIComponent: function (e) { + return null == e ? "" : "" == e ? null : (e = e.replace(/ /g, "+"), a._decompress(e.length, 32, + function (h) { + return f(d, e.charAt(h)) + })) + }, + compress: function (e) { + return a._compress(e, 16, + function (h) { + return c(h) + }) + }, + _compress: function (q, j, w) { + if (null == q) { + return "" + } + var C, I, z, J = {}, + k = {}, + H = "", + E = "", + F = "", + y = 2, + B = 3, + A = 2, + D = [], + x = 0, + G = 0; + for (z = 0; z < q.length; z += 1) { + if (H = q.charAt(z), Object.prototype.hasOwnProperty.call(J, H) || (J[H] = B++, k[H] = !0), E = F + H, Object.prototype.hasOwnProperty.call(J, E)) { + F = E + } else { + if (Object.prototype.hasOwnProperty.call(k, F)) { + if (F.charCodeAt(0) < 256) { + for (C = 0; A > C; C++) { + x <<= 1, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++ + } + for (I = F.charCodeAt(0), C = 0; 8 > C; C++) { + x = x << 1 | 1 & I, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++, + I >>= 1 + } + } else { + for (I = 1, C = 0; A > C; C++) { + x = x << 1 | I, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++, + I = 0 + } + for (I = F.charCodeAt(0), C = 0; 16 > C; C++) { + x = x << 1 | 1 & I, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++, + I >>= 1 + } + } + y--, + 0 == y && (y = Math.pow(2, A), A++), + delete k[F] + } else { + for (I = J[F], C = 0; A > C; C++) { + x = x << 1 | 1 & I, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++, + I >>= 1 + } + } + y--, + 0 == y && (y = Math.pow(2, A), A++), + J[E] = B++, + F = String(H) + } + } + if ("" !== F) { + if (Object.prototype.hasOwnProperty.call(k, F)) { + if (F.charCodeAt(0) < 256) { + for (C = 0; A > C; C++) { + x <<= 1, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++ + } + for (I = F.charCodeAt(0), C = 0; 8 > C; C++) { + x = x << 1 | 1 & I, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++, + I >>= 1 + } + } else { + for (I = 1, C = 0; A > C; C++) { + x = x << 1 | I, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++, + I = 0 + } + for (I = F.charCodeAt(0), C = 0; 16 > C; C++) { + x = x << 1 | 1 & I, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++, + I >>= 1 + } + } + y--, + 0 == y && (y = Math.pow(2, A), A++), + delete k[F] + } else { + for (I = J[F], C = 0; A > C; C++) { + x = x << 1 | 1 & I, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++, + I >>= 1 + } + } + y--, + 0 == y && (y = Math.pow(2, A), A++) + } + for (I = 2, C = 0; A > C; C++) { + x = x << 1 | 1 & I, + G == j - 1 ? (G = 0, D.push(w(x)), x = 0) : G++, + I >>= 1 + } + for (; ;) { + if (x <<= 1, G == j - 1) { + D.push(w(x)); + break + } + G++ + } + return D.join("") + }, + decompress: function (e) { + return null == e ? "" : "" == e ? null : a._decompress(e.length, 32768, + function (h) { + return e.charCodeAt(h) + }) + }, + _decompress: function (B, C, I) { + var r, F, x, z, q, K, L, E, H = [], + G = 4, + J = 4, + D = 3, + k = "", + j = [], + y = { + val: I(0), + position: C, + index: 1 + }; + for (F = 0; 3 > F; F += 1) { + H[F] = F + } + for (z = 0, K = Math.pow(2, 2), L = 1; L != K;) { + q = y.val & y.position, + y.position >>= 1, + 0 == y.position && (y.position = C, y.val = I(y.index++)), + z |= (q > 0 ? 1 : 0) * L, + L <<= 1 + } + switch (r = z) { + case 0: + for (z = 0, K = Math.pow(2, 8), L = 1; L != K;) { + q = y.val & y.position, + y.position >>= 1, + 0 == y.position && (y.position = C, y.val = I(y.index++)), + z |= (q > 0 ? 1 : 0) * L, + L <<= 1 + } + E = c(z); + break; + case 1: + for (z = 0, K = Math.pow(2, 16), L = 1; L != K;) { + q = y.val & y.position, + y.position >>= 1, + 0 == y.position && (y.position = C, y.val = I(y.index++)), + z |= (q > 0 ? 1 : 0) * L, + L <<= 1 + } + E = c(z); + break; + case 2: + return "" + } + for (H[3] = E, x = E, j.push(E); ;) { + if (y.index > B) { + return "" + } + for (z = 0, K = Math.pow(2, D), L = 1; L != K;) { + q = y.val & y.position, + y.position >>= 1, + 0 == y.position && (y.position = C, y.val = I(y.index++)), + z |= (q > 0 ? 1 : 0) * L, + L <<= 1 + } + switch (E = z) { + case 0: + for (z = 0, K = Math.pow(2, 8), L = 1; L != K;) { + q = y.val & y.position, + y.position >>= 1, + 0 == y.position && (y.position = C, y.val = I(y.index++)), + z |= (q > 0 ? 1 : 0) * L, + L <<= 1 + } + H[J++] = c(z), + E = J - 1, + G--; + break; + case 1: + for (z = 0, K = Math.pow(2, 16), L = 1; L != K;) { + q = y.val & y.position, + y.position >>= 1, + 0 == y.position && (y.position = C, y.val = I(y.index++)), + z |= (q > 0 ? 1 : 0) * L, + L <<= 1 + } + H[J++] = c(z), + E = J - 1, + G--; + break; + case 2: + return j.join("") + } + if (0 == G && (G = Math.pow(2, D), D++), H[E]) { + k = H[E] + } else { + if (E !== J) { + return null + } + k = x + x.charAt(0) + } + j.push(k), + H[J++] = x + k.charAt(0), + G--, + x = k, + 0 == G && (G = Math.pow(2, D), D++) + } + } + }; + return a +}(); +var tableHtmlResult = ''; +function setTable(html){ + tableHtmlResult = html +} +function getTable(){ + return tableHtmlResult +} \ No newline at end of file Index: ssts-web/src/main/webapp/homepage/exportMonitorData.jsp =================================================================== diff -u -r30904 -r30931 --- ssts-web/src/main/webapp/homepage/exportMonitorData.jsp (.../exportMonitorData.jsp) (revision 30904) +++ ssts-web/src/main/webapp/homepage/exportMonitorData.jsp (.../exportMonitorData.jsp) (revision 30931) @@ -9,15 +9,15 @@
- +