jsxls更新
This commit is contained in:
@@ -26,7 +26,7 @@ require.config({
|
||||
paths: {
|
||||
'sent': ['common/js/sent'],
|
||||
'form': ['common/js/require-form'],
|
||||
'xlsx': ['common/js/require-xlsx'],
|
||||
'xlsxs': ['common/js/require-xlsx'],
|
||||
'upload': 'common/js/require-upload',
|
||||
'validator': 'common/js/require-validator',
|
||||
'message': ['plugins/messager/messager'],
|
||||
@@ -70,7 +70,7 @@ require.config({
|
||||
|
||||
// nanoscroller
|
||||
'slimscroll': 'plugins/jquery-slimscroll/jquery.slimscroll',
|
||||
'sheetjs': ['plugins/sheetjs/xlsx.full.min']
|
||||
'xlsx': ['plugins/sheetjs/xlsx.full.min']
|
||||
},
|
||||
shim: {
|
||||
'message': {deps: ['jquery', 'css!'+'plugins/messager/css/style.css']},
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
define(['jquery', 'sent', 'form', 'xlsx', 'sheetjs'], function($, sent, form, xlsx, xlsx2){
|
||||
|
||||
var formModule = {
|
||||
lists: function(){
|
||||
console.log('xlsx2')
|
||||
if($('.btn-out').size() > 0){
|
||||
$('.btn-out').click(function(e){
|
||||
e.preventDefault();
|
||||
var url = $(this).attr('href');
|
||||
console.log(xlsx)
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return formModule;
|
||||
})
|
||||
@@ -1,5 +1,4 @@
|
||||
require(['jquery', 'sheetjs'], function($, XLSX) {
|
||||
|
||||
define(['jquery', 'xlsx'], function($, xlsx) {
|
||||
// var wopts = { bookType: 'csv', bookSST: false, type: 'binary' };//ods格式
|
||||
var wopts = { bookType: 'xlsx', bookSST: false, type: 'binary' };//这里的数据是用来定义导出的格式类型
|
||||
// var wopts = { bookType: 'ods', bookSST: false, type: 'binary' };//ods格式
|
||||
@@ -9,10 +8,9 @@ require(['jquery', 'sheetjs'], function($, XLSX) {
|
||||
|
||||
var xls = {
|
||||
downloadExl: function (data, fileName) {
|
||||
checkFileIn();
|
||||
var wb = { SheetNames: ['Sheet1'], Sheets: {}, Props: {} };
|
||||
wb.Sheets['Sheet1'] = XLSX.utils.json_to_sheet(data);//通过json_to_sheet转成单页(Sheet)数据
|
||||
this.saveAs(new Blob([this.s2ab(XLSX.write(wb, wopts))], { type: "application/octet-stream" }), fileName + '.' + (wopts.bookType=="biff2"?"xls":wopts.bookType));
|
||||
wb.Sheets['Sheet1'] = xlsx.utils.json_to_sheet(data);//通过json_to_sheet转成单页(Sheet)数据
|
||||
this.saveAs(new Blob([this.s2ab(xlsx.write(wb, wopts))], { type: "application/octet-stream" }), fileName + '.' + (wopts.bookType=="biff2"?"xls":wopts.bookType));
|
||||
},
|
||||
|
||||
//如果使用 FileSaver.js 就不要同时使用以下函数
|
||||
@@ -42,18 +40,6 @@ require(['jquery', 'sheetjs'], function($, XLSX) {
|
||||
}
|
||||
};
|
||||
|
||||
checkFileIn = function(){
|
||||
if($("script[src='/static/js/js-xlsx/xlsx.full.min.js']").length > 0){
|
||||
return;
|
||||
}else{
|
||||
var body = $("body");
|
||||
var script = $("<script>");
|
||||
$(script).attr('type','text/javascript');
|
||||
$(script).attr('src','/static/js/js-xlsx/xlsx.full.min.js');
|
||||
$(body).append(script);
|
||||
}
|
||||
}
|
||||
|
||||
window.xls = xls;
|
||||
return xls;
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
/* cpexcel.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/*jshint -W100 */
|
||||
var cptable = {version:"1.14.0"};
|
||||
var cptable = {version:"1.13.0"};
|
||||
cptable[437] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[620] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàąçêëèïîćÄĄĘęłôöĆûùŚÖܢ٥śƒŹŻóÓńŃźż¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
cptable[737] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -1017,11 +1017,9 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
var cca = function cca(x) { return x.charCodeAt(0); };
|
||||
|
||||
var has_buf = (typeof Buffer !== 'undefined');
|
||||
var Buffer_from = function(){};
|
||||
if(has_buf) {
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
// $FlowIgnore
|
||||
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
|
||||
// $FlowIgnore
|
||||
if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); };
|
||||
|
||||
@@ -1294,7 +1292,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
else if((M=magic[cp])) switch(M) {
|
||||
case "utf8":
|
||||
if(has_buf && isstr) { out = Buffer_from(data, M); j = out.length; break; }
|
||||
if(has_buf && isstr) { out = Buffer.from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@@ -1316,7 +1314,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
break;
|
||||
case "ascii":
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i, ++j) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
if(w <= 0x007F) out[j] = w;
|
||||
@@ -1324,7 +1322,7 @@ if (typeof module !== 'undefined' && module.exports && typeof DO_NOT_EXPORT_CODE
|
||||
}
|
||||
break;
|
||||
case "utf16le":
|
||||
if(has_buf && typeof data === "string") { out = Buffer_from(data, M); j = out.length; break; }
|
||||
if(has_buf && typeof data === "string") { out = Buffer.from(data, M); j = out.length; break; }
|
||||
for(i = 0; i < len; ++i) {
|
||||
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
|
||||
out[j++] = w&255;
|
||||
|
||||
@@ -600,16 +600,14 @@ module.exports = function(data, options) {
|
||||
},{"./base64":1,"./zipEntries":22}],11:[function(_dereq_,module,exports){
|
||||
(function (Buffer){
|
||||
'use strict';
|
||||
var Buffer_from = /*::(*/function(){}/*:: :any)*/;
|
||||
if(typeof Buffer !== 'undefined') {
|
||||
var nbfs = !Buffer.from;
|
||||
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
|
||||
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
|
||||
// $FlowIgnore
|
||||
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
|
||||
// $FlowIgnore
|
||||
if(!Buffer.alloc) Buffer.alloc = function(n) { return new Buffer(n); };
|
||||
}
|
||||
module.exports = function(data, encoding){
|
||||
return typeof data == 'number' ? Buffer.alloc(data) : Buffer_from(data, encoding);
|
||||
return typeof data == 'number' ? Buffer.alloc(data) : Buffer.from(data, encoding);
|
||||
};
|
||||
module.exports.test = function(b){
|
||||
return Buffer.isBuffer(b);
|
||||
|
||||
+15
-16
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+17
-17
File diff suppressed because one or more lines are too long
+463
-1716
File diff suppressed because it is too large
Load Diff
+13
-13
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user