@gingkoo/base-server 0.0.2-alpha.3 → 0.0.2-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/static/1.csv +1 -0
- package/static/1.xlsx +0 -0
- package/static/12.xls +0 -0
- package/static/excel/excel.js +8 -6
package/package.json
CHANGED
package/static/1.csv
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1,2
|
package/static/1.xlsx
ADDED
|
Binary file
|
package/static/12.xls
ADDED
|
Binary file
|
package/static/excel/excel.js
CHANGED
|
@@ -135,16 +135,18 @@ var page = {
|
|
|
135
135
|
|
|
136
136
|
function transform(sheet) {
|
|
137
137
|
let finalCellData = [];
|
|
138
|
-
// let sheet = data?.[0] || null;
|
|
139
138
|
let sheetCelldata = sheet?.celldata || [];
|
|
140
|
-
if (!sheetCelldata.length)
|
|
139
|
+
if (!sheetCelldata.length) {
|
|
140
|
+
sheetCelldata = sheet?.data || [];
|
|
141
|
+
}
|
|
142
|
+
if (!sheetCelldata.length) return sheet;
|
|
141
143
|
|
|
142
144
|
let sheetColumn = sheet.column < 60 ? 60 : sheet.column;
|
|
143
145
|
let sheetRow = sheet.row < 84 ? 84 : sheet.row;
|
|
144
146
|
|
|
145
147
|
// 兼容window电脑字体 模糊问题
|
|
146
148
|
finalCellData = sheetCelldata.map((cell) => {
|
|
147
|
-
if (cell.v.fs < 12) {
|
|
149
|
+
if (cell && cell.v && cell.v.fs && cell.v.fs < 12) {
|
|
148
150
|
cell.v.ff = '微软雅黑';
|
|
149
151
|
cell.v.fs = 12;
|
|
150
152
|
cell.v.tb = 2; // tb 为2会卡顿
|
|
@@ -198,7 +200,7 @@ function transform(sheet) {
|
|
|
198
200
|
|
|
199
201
|
var loadLuckySheet = function (exportJson) {
|
|
200
202
|
if (exportJson.sheets == null || exportJson.sheets.length == 0) {
|
|
201
|
-
|
|
203
|
+
console.log('无法读取excel文件的内容');
|
|
202
204
|
return;
|
|
203
205
|
}
|
|
204
206
|
|
|
@@ -206,7 +208,7 @@ var loadLuckySheet = function (exportJson) {
|
|
|
206
208
|
window.luckysheet.create({
|
|
207
209
|
...defaultOptions,
|
|
208
210
|
container: 'luckysheet',
|
|
209
|
-
data: exportJson.sheets.map((v) => transform(v)),
|
|
211
|
+
data: !exportJson.ext ? exportJson.sheets.map((v) => transform(v)) : exportJson.sheets,
|
|
210
212
|
|
|
211
213
|
hook: {
|
|
212
214
|
workbookCreateAfter() {
|
|
@@ -255,5 +257,5 @@ page.getFileInfo(function (file) {
|
|
|
255
257
|
_sheet.data = utils.xlsToLuckySheet(wb.Sheets[name], _sheet);
|
|
256
258
|
sheets.push(_sheet);
|
|
257
259
|
}
|
|
258
|
-
loadLuckySheet({ sheets: sheets });
|
|
260
|
+
loadLuckySheet({ sheets: sheets, ext: file.ext });
|
|
259
261
|
});
|