36 lines
824 B
JavaScript
Raw Normal View History

2023-02-14 14:32:55 +08:00
layui.define([], function (exports) {
var MOD_NAME = 'excel';
var modFile = layui.cache.modules['excel'];
var modPath = modFile.substr(0, modFile.lastIndexOf('.'));
var settings = {
name: '表格'
};
var excel = {
init: function (tableId, options) {
loadScript();
var opts = $.extend({}, settings, options);
$('#'+tableId).table2excel({
name: opts.name,
filename: opts.name + new Date().getTime() + ".xls",
exclude: ".noExl",
exclude_img: false,
exclude_links: false,
2023-02-16 23:54:21 +08:00
exclude_inputs: false,
preserveColors:true
2023-02-14 14:32:55 +08:00
});
}
}
function loadScript() {
if (typeof table2excel == 'undefined') {
$.ajax({ //获取插件
url: modPath + '/table2excel.js' ,
dataType: 'script',
cache: true,
2023-02-16 23:54:21 +08:00
async: false
2023-02-14 14:32:55 +08:00
});
}
}
2023-02-16 23:54:21 +08:00
loadScript();
2023-02-14 14:32:55 +08:00
exports(MOD_NAME, excel);
});