vxe-table-plugin-export-xlsx-xhx 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.common.js +3 -3
- package/dist/index.js +12 -12
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
@@ -175,10 +175,10 @@ function importXLSX(params) {
|
|
175
175
|
var _importResolve = $table._importResolve;
|
176
176
|
var fileReader = new FileReader();
|
177
177
|
fileReader.onload = function (e) {
|
178
|
-
var workbook = _xlsx
|
178
|
+
var workbook = _xlsx.read(e.target.result, {
|
179
179
|
type: 'binary'
|
180
180
|
});
|
181
|
-
var csvData = _xlsx
|
181
|
+
var csvData = _xlsx.utils.sheet_to_csv(workbook.Sheets.Sheet1);
|
182
182
|
var _parseCsv = parseCsv(columns, csvData),
|
183
183
|
fields = _parseCsv.fields,
|
184
184
|
rows = _parseCsv.rows;
|
@@ -193,7 +193,7 @@ function importXLSX(params) {
|
|
193
193
|
});
|
194
194
|
if (options.message !== false) {
|
195
195
|
_vxetable.modal.message({
|
196
|
-
message: _xeUtils
|
196
|
+
message: _xeUtils.template(_vxetable.t('vxe.table.impSuccess'), [rows.length]),
|
197
197
|
status: 'success'
|
198
198
|
});
|
199
199
|
}
|
package/dist/index.js
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
Object.defineProperty(_exports, "__esModule", {
|
17
17
|
value: true
|
18
18
|
});
|
19
|
-
_exports
|
19
|
+
_exports = _exports.VXETablePluginExportXLSX = void 0;
|
20
20
|
_xeUtils = _interopRequireDefault(_xeUtils);
|
21
21
|
_xlsx = _interopRequireDefault(_xlsx);
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
@@ -28,7 +28,7 @@
|
|
28
28
|
if (cellValue) {
|
29
29
|
switch (column.cellType) {
|
30
30
|
case 'string':
|
31
|
-
return _xeUtils
|
31
|
+
return _xeUtils.toValueString(cellValue);
|
32
32
|
case 'number':
|
33
33
|
if (!isNaN(cellValue)) {
|
34
34
|
return Number(cellValue);
|
@@ -44,7 +44,7 @@
|
|
44
44
|
return cellValue;
|
45
45
|
}
|
46
46
|
function getFooterCellValue($table, opts, rows, column) {
|
47
|
-
var cellValue = _xeUtils
|
47
|
+
var cellValue = _xeUtils.toString(rows[$table.$getColumnIndex(column)]);
|
48
48
|
return cellValue;
|
49
49
|
}
|
50
50
|
function toBuffer(wbout) {
|
@@ -73,7 +73,7 @@
|
|
73
73
|
if (isHeader) {
|
74
74
|
columns.forEach(function (column) {
|
75
75
|
// colHead[column.id] = XEUtils.toString(original ? column.property : column.getTitle())
|
76
|
-
colHead[column.id] = _xeUtils
|
76
|
+
colHead[column.id] = _xeUtils.toString(original ? column.property : column.getTitle());
|
77
77
|
});
|
78
78
|
}
|
79
79
|
// 新增部分
|
@@ -96,13 +96,13 @@
|
|
96
96
|
footList.push(item);
|
97
97
|
});
|
98
98
|
}
|
99
|
-
var book = _xlsx
|
100
|
-
var sheet = _xlsx
|
99
|
+
var book = _xlsx.utils.book_new();
|
100
|
+
var sheet = _xlsx.utils.json_to_sheet((isHeader ? [colHead] : []).concat(rowList).concat(footList), {
|
101
101
|
skipHeader: true
|
102
102
|
});
|
103
103
|
// 转换数据
|
104
|
-
_xlsx
|
105
|
-
var wbout = _xlsx
|
104
|
+
_xlsx.utils.book_append_sheet(book, sheet, sheetName);
|
105
|
+
var wbout = _xlsx.write(book, {
|
106
106
|
bookType: type,
|
107
107
|
bookSST: false,
|
108
108
|
type: 'binary'
|
@@ -185,10 +185,10 @@
|
|
185
185
|
var _importResolve = $table._importResolve;
|
186
186
|
var fileReader = new FileReader();
|
187
187
|
fileReader.onload = function (e) {
|
188
|
-
var workbook = _xlsx
|
188
|
+
var workbook = _xlsx.read(e.target.result, {
|
189
189
|
type: 'binary'
|
190
190
|
});
|
191
|
-
var csvData = _xlsx
|
191
|
+
var csvData = _xlsx.utils.sheet_to_csv(workbook.Sheets.Sheet1);
|
192
192
|
var _parseCsv = parseCsv(columns, csvData),
|
193
193
|
fields = _parseCsv.fields,
|
194
194
|
rows = _parseCsv.rows;
|
@@ -203,7 +203,7 @@
|
|
203
203
|
});
|
204
204
|
if (options.message !== false) {
|
205
205
|
_vxetable.modal.message({
|
206
|
-
message: _xeUtils
|
206
|
+
message: _xeUtils.template(_vxetable.t('vxe.table.impSuccess'), [rows.length]),
|
207
207
|
status: 'success'
|
208
208
|
});
|
209
209
|
}
|
@@ -253,5 +253,5 @@
|
|
253
253
|
window.VXETable.use(VXETablePluginExportXLSX);
|
254
254
|
}
|
255
255
|
var _default = VXETablePluginExportXLSX;
|
256
|
-
_exports
|
256
|
+
_exports = _default;
|
257
257
|
});
|