1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| 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,
| exclude_inputs: false,
| preserveColors:true
| });
| }
| }
| function loadScript() {
| if (typeof table2excel == 'undefined') {
| $.ajax({ //获取插件
| url: modPath + '/table2excel.js' ,
| dataType: 'script',
| cache: true,
| async: false
| });
| }
| }
| loadScript();
| exports(MOD_NAME, excel);
| });
|
|