From 9d5b9523c2773e85eb5394711671b0c878ff73a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Sat, 30 Apr 2022 16:23:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96Excel=E6=A1=88=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/view/oplog/index_search.html | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/admin/view/oplog/index_search.html b/app/admin/view/oplog/index_search.html index 115cac986..26ecd7ac0 100644 --- a/app/admin/view/oplog/index_search.html +++ b/app/admin/view/oplog/index_search.html @@ -104,19 +104,11 @@ }; layui.excel.setExportCellStyle(data, 'A2:' + lastCol + data.length, { s: style1 - }, function (oldCell, newCell, row, config, currentRow, currentCol, fieldKey) { - // oldCell:原有数据, - // newCell:根据批量设置规则自动生成的样式 - // row:所在行数据 - // config:传入的配置 - // currentRow:当前行索引 - // currentCol:当前列索引 - // fieldKey:当前字段索引 - + }, function (rawCell, newCell, row, config, currentRow, currentCol, fieldKey) { /* 判断并转换单元格数据为对象,以便初始化样式 */ - if (typeof oldCell !== 'object') oldCell = {v: oldCell}; - oldCell.s = style2; - return (currentRow % 2 === 0) ? newCell : oldCell; + typeof rawCell !== 'object' && (rawCell = {v: rawCell}); + rawCell.s = Object.assign(style2, rawCell.s || {}); + return (currentRow % 2 === 0) ? newCell : rawCell; }); // 设置表格行宽高,需要设置最后的行或列宽高,否则部分不生效 ???