mirror of
https://gitee.com/x-extends/vxe-table-plugin-export-xlsx.git
synced 2026-01-21 05:21:33 +08:00
fix
This commit is contained in:
4
index.ts
4
index.ts
@@ -390,12 +390,12 @@ function importXLSX (params: VxeGlobalInterceptorHandles.InterceptorImportParams
|
|||||||
workbook.xlsx.load(readerTarget.result as ArrayBuffer).then(wb => {
|
workbook.xlsx.load(readerTarget.result as ArrayBuffer).then(wb => {
|
||||||
const firstSheet = wb.worksheets[0]
|
const firstSheet = wb.worksheets[0]
|
||||||
if (firstSheet) {
|
if (firstSheet) {
|
||||||
const sheetValues = firstSheet.getSheetValues() as string[][]
|
const sheetValues = Array.from(firstSheet.getSheetValues()) as string[][]
|
||||||
const fieldIndex = XEUtils.findIndexOf(sheetValues, (list) => list && list.length > 0)
|
const fieldIndex = XEUtils.findIndexOf(sheetValues, (list) => list && list.length > 0)
|
||||||
const fields = sheetValues[fieldIndex] as string[]
|
const fields = sheetValues[fieldIndex] as string[]
|
||||||
const status = checkImportData(tableFields, fields)
|
const status = checkImportData(tableFields, fields)
|
||||||
if (status) {
|
if (status) {
|
||||||
const records = sheetValues.slice(fieldIndex).map(list => {
|
const records = sheetValues.slice(fieldIndex + 1).map(list => {
|
||||||
const item : any = {}
|
const item : any = {}
|
||||||
list.forEach((cellValue, cIndex) => {
|
list.forEach((cellValue, cIndex) => {
|
||||||
item[fields[cIndex]] = cellValue
|
item[fields[cIndex]] = cellValue
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vxe-table-plugin-export-xlsx",
|
"name": "vxe-table-plugin-export-xlsx",
|
||||||
"version": "4.0.6",
|
"version": "4.0.7",
|
||||||
"description": "基于 vxe-table 表格的扩展插件,支持导出 xlsx 格式",
|
"description": "基于 vxe-table 表格的扩展插件,支持导出 xlsx 格式",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lib": "gulp build"
|
"lib": "gulp build"
|
||||||
|
|||||||
Reference in New Issue
Block a user