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:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
.history
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
/dist
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ const uglify = require('gulp-uglify')
|
|||||||
const babel = require('gulp-babel')
|
const babel = require('gulp-babel')
|
||||||
const rename = require('gulp-rename')
|
const rename = require('gulp-rename')
|
||||||
const replace = require('gulp-replace')
|
const replace = require('gulp-replace')
|
||||||
|
const dartSass = require('sass')
|
||||||
|
const gulpSass = require('gulp-sass')
|
||||||
|
const sass = gulpSass(dartSass)
|
||||||
|
const cleanCSS = require('gulp-clean-css')
|
||||||
|
const prefixer = require('gulp-autoprefixer')
|
||||||
const sourcemaps = require('gulp-sourcemaps')
|
const sourcemaps = require('gulp-sourcemaps')
|
||||||
const ts = require('gulp-typescript')
|
const ts = require('gulp-typescript')
|
||||||
const pack = require('./package.json')
|
const pack = require('./package.json')
|
||||||
|
|||||||
60
index.ts
60
index.ts
@@ -128,8 +128,8 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
|
|||||||
let beforeRowCount = 0
|
let beforeRowCount = 0
|
||||||
const colHead: any = {}
|
const colHead: any = {}
|
||||||
columns.forEach((column) => {
|
columns.forEach((column) => {
|
||||||
const { id, property, renderWidth } = column
|
const { id, field, renderWidth } = column
|
||||||
colHead[id] = original ? property : column.getTitle()
|
colHead[id] = original ? field : column.getTitle()
|
||||||
sheetCols.push({
|
sheetCols.push({
|
||||||
key: id,
|
key: id,
|
||||||
width: XEUtils.ceil(renderWidth / 8, 1)
|
width: XEUtils.ceil(renderWidth / 8, 1)
|
||||||
@@ -148,7 +148,7 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
|
|||||||
const { _colSpan, _rowSpan } = column
|
const { _colSpan, _rowSpan } = column
|
||||||
const validColumn = getValidColumn(column)
|
const validColumn = getValidColumn(column)
|
||||||
const columnIndex = columns.indexOf(validColumn)
|
const columnIndex = columns.indexOf(validColumn)
|
||||||
groupHead[validColumn.id] = original ? validColumn.property : column.getTitle()
|
groupHead[validColumn.id] = original ? validColumn.field : column.getTitle()
|
||||||
if (_colSpan > 1 || _rowSpan > 1) {
|
if (_colSpan > 1 || _rowSpan > 1) {
|
||||||
sheetMerges.push({
|
sheetMerges.push({
|
||||||
s: { r: rIndex, c: columnIndex },
|
s: { r: rIndex, c: columnIndex },
|
||||||
@@ -246,18 +246,20 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
|
|||||||
}
|
}
|
||||||
excelRow.eachCell(excelCell => {
|
excelRow.eachCell(excelCell => {
|
||||||
const excelCol = sheet.getColumn(excelCell.col)
|
const excelCol = sheet.getColumn(excelCell.col)
|
||||||
const column: any = $table.getColumnById(excelCol.key as string)
|
const column = $table.getColumnById(excelCol.key as string)
|
||||||
const { align } = column
|
if (column) {
|
||||||
setExcelCellStyle(excelCell, align || allAlign)
|
const { align } = column
|
||||||
if (useStyle) {
|
setExcelCellStyle(excelCell, align || allAlign)
|
||||||
Object.assign(excelCell, {
|
if (useStyle) {
|
||||||
font: {
|
Object.assign(excelCell, {
|
||||||
color: {
|
font: {
|
||||||
argb: defaultCellFontColor
|
color: {
|
||||||
}
|
argb: defaultCellFontColor
|
||||||
},
|
}
|
||||||
border: getDefaultBorderStyle()
|
},
|
||||||
})
|
border: getDefaultBorderStyle()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -268,18 +270,20 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
|
|||||||
}
|
}
|
||||||
excelRow.eachCell(excelCell => {
|
excelRow.eachCell(excelCell => {
|
||||||
const excelCol = sheet.getColumn(excelCell.col)
|
const excelCol = sheet.getColumn(excelCell.col)
|
||||||
const column: any = $table.getColumnById(excelCol.key as string)
|
const column = $table.getColumnById(excelCol.key as string)
|
||||||
const { footerAlign, align } = column
|
if (column) {
|
||||||
setExcelCellStyle(excelCell, footerAlign || align || allFooterAlign || allAlign)
|
const { footerAlign, align } = column
|
||||||
if (useStyle) {
|
setExcelCellStyle(excelCell, footerAlign || align || allFooterAlign || allAlign)
|
||||||
Object.assign(excelCell, {
|
if (useStyle) {
|
||||||
font: {
|
Object.assign(excelCell, {
|
||||||
color: {
|
font: {
|
||||||
argb: defaultCellFontColor
|
color: {
|
||||||
}
|
argb: defaultCellFontColor
|
||||||
},
|
}
|
||||||
border: getDefaultBorderStyle()
|
},
|
||||||
})
|
border: getDefaultBorderStyle()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -362,7 +366,7 @@ function importXLSX (params: VxeGlobalInterceptorHandles.InterceptorImportParams
|
|||||||
fileReader.onload = (evnt) => {
|
fileReader.onload = (evnt) => {
|
||||||
const tableFields: string[] = []
|
const tableFields: string[] = []
|
||||||
columns.forEach((column) => {
|
columns.forEach((column) => {
|
||||||
const field = column.property
|
const field = column.field
|
||||||
if (field) {
|
if (field) {
|
||||||
tableFields.push(field)
|
tableFields.push(field)
|
||||||
}
|
}
|
||||||
|
|||||||
21
package.json
21
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vxe-table-plugin-export-xlsx",
|
"name": "vxe-table-plugin-export-xlsx",
|
||||||
"version": "3.0.3",
|
"version": "3.0.4",
|
||||||
"description": "基于 vxe-table 的表格插件,支持导出 xlsx 格式",
|
"description": "基于 vxe-table 的表格插件,支持导出 xlsx 格式",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lib": "gulp build"
|
"lib": "gulp build"
|
||||||
@@ -33,24 +33,25 @@
|
|||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
"eslint-plugin-standard": "^4.0.2",
|
"eslint-plugin-standard": "^4.0.2",
|
||||||
"eslint-plugin-typescript": "^0.14.0",
|
"eslint-plugin-typescript": "^0.14.0",
|
||||||
"exceljs": "^4.2.0",
|
"exceljs": "^4.3.0",
|
||||||
"gulp": "^4.0.2",
|
"gulp": "^4.0.2",
|
||||||
"gulp-autoprefixer": "^7.0.1",
|
"gulp-autoprefixer": "^8.0.0",
|
||||||
"gulp-babel": "^8.0.0",
|
"gulp-babel": "^8.0.0",
|
||||||
"gulp-clean-css": "^4.3.0",
|
"gulp-clean-css": "^4.3.0",
|
||||||
"gulp-concat": "^2.6.1",
|
"gulp-concat": "^2.6.1",
|
||||||
"gulp-rename": "^2.0.0",
|
"gulp-rename": "^2.0.0",
|
||||||
"gulp-replace": "^1.0.0",
|
"gulp-replace": "^1.1.3",
|
||||||
"gulp-sass": "^4.1.0",
|
"gulp-sass": "^5.1.0",
|
||||||
"gulp-sourcemaps": "^2.6.5",
|
"gulp-sourcemaps": "^3.0.0",
|
||||||
"gulp-typescript": "^5.0.1",
|
"gulp-typescript": "^5.0.1",
|
||||||
"gulp-uglify": "^3.0.2",
|
"gulp-uglify": "^3.0.2",
|
||||||
"markdown-doctest": "^1.1.0",
|
"markdown-doctest": "^1.1.0",
|
||||||
"prettier": "^2.1.2",
|
"prettier": "^2.1.2",
|
||||||
"typescript": "^4.0.5",
|
"sass": "^1.55.0",
|
||||||
"vue": "^3.2.14",
|
"typescript": "^4.6.4",
|
||||||
"vxe-table": "^4.0.28",
|
"vue": "^3.2.39",
|
||||||
"xe-utils": "^3.4.0"
|
"vxe-table": "^4.3.5",
|
||||||
|
"xe-utils": "^3.5.6"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"vxe-table": "^4.0.27"
|
"vxe-table": "^4.0.27"
|
||||||
|
|||||||
Reference in New Issue
Block a user