修改引入方案

This commit is contained in:
邹景立 2021-01-26 18:21:02 +08:00
parent 964719ac62
commit f768073b07
2 changed files with 3 additions and 12 deletions

View File

@ -74,19 +74,13 @@ require.config({
'jquery.autocompleter': ['plugs/jquery/autocompleter.min'],
},
shim: {
'excel': {deps: [baseRoot + 'plugs/layui_exts/excel.js']},
'websocket': {deps: [baseRoot + 'plugs/socket/swfobject.min.js']},
'jquery.ztree': {deps: ['jquery', 'css!' + baseRoot + 'plugs/ztree/zTreeStyle/zTreeStyle.css']},
'jquery.autocompleter': {deps: ['jquery', 'css!' + baseRoot + 'plugs/jquery/autocompleter.css']},
}
});
/*! 注册 layui 组件 */
layui.config({
base: baseRoot + 'plugs/layui_exts/',
}).extend({
excel: 'excel',
});
/*! 注册 jquery 组件 */
define('jquery', [], function () {
return layui.$;

View File

@ -5,9 +5,7 @@ define(function () {
if (name.substr(-5).toLowerCase() !== '.xlsx') {
name += '.xlsx';
}
layui.use('excel', function () {
layui.excel.exportExcel(data, name, 'xlsx')
});
layui.excel.exportExcel(data, name, 'xlsx')
}
/*! 绑定导出的事件 */
@ -160,8 +158,7 @@ define(function () {
/*! 表格单元内容转换 */
excel.read.CellToValue = function (v) {
if (typeof v !== 'undefined' && /^\d+\.\d{12}$/.test(v)) {
var time = XLSX.SSF.parse_date_code(v);
return time.y + '-' + time.m + '-' + time.d + ' ' + time.H + ':' + time.M + ':' + time.S;
return LAY_EXCEL.dateCodeFormat(v, 'YYYY-MM-DD HH:ii:ss');
} else {
return typeof v !== 'undefined' ? v : '';
}