From 8d965e584b9be28a81d3f9fa587f6d0b18cd8dff Mon Sep 17 00:00:00 2001
From: yaozc <yaozc@yhzhg.cn>
Date: Mon, 10 Jul 2023 00:54:45 +0000
Subject: [PATCH] toMongo init
---
eladmin-web-master/src/components/UploadExcel/index.vue | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/eladmin-web-master/src/components/UploadExcel/index.vue b/eladmin-web-master/src/components/UploadExcel/index.vue
index a78f966..d11e7fa 100644
--- a/eladmin-web-master/src/components/UploadExcel/index.vue
+++ b/eladmin-web-master/src/components/UploadExcel/index.vue
@@ -88,7 +88,7 @@
const firstSheetName = workbook.SheetNames[0]
const worksheet = workbook.Sheets[firstSheetName]
const header = this.getHeaderRow(worksheet)
- const results = XLSX.utils.sheet_to_json(worksheet)
+ const results = XLSX.utils.sheet_to_json(worksheet, { range: 1 })
this.generateData({ header, results })
this.loading = false
resolve()
@@ -101,12 +101,16 @@
const range = XLSX.utils.decode_range(sheet['!ref'])
let C
const R = range.s.r
+ console.log('111111111111111111111 : ', R)
/* start in the first row */
for (C = range.s.c; C <= range.e.c; ++C) { /* walk every column in the range */
+ console.log('XLSX.utils.encode_cell({ c: C, r: R }) : ', XLSX.utils.encode_cell({ c: C, r: R }))
const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]
+ const cell2 = sheet[XLSX.utils.encode_cell({ c: C, r: R + 1 })]
/* find the cell in the first row */
- let hdr = 'UNKNOWN ' + C // <-- replace with your desired default
- if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
+ const hdr = { id: 'UNKNOWN ' + C, name: 'UNKNOWN ' + C } // <-- replace with your desired default
+ if (cell && cell.t) hdr.name = XLSX.utils.format_cell(cell)
+ if (cell2 && cell2.t) hdr.id = XLSX.utils.format_cell(cell2)
headers.push(hdr)
}
return headers
--
Gitblit v1.9.3