@@ -16,8 +16,8 @@ let htmlCellElem: any
1616const csvBOM = '\ufeff'
1717const enterSymbol = '\r\n'
1818
19- function defaultFilterExportColumn ( column : any ) {
20- return column . field || [ 'seq' , 'checkbox' , 'radio' ] . indexOf ( column . type ) > - 1
19+ function defaultFilterExportColumn ( column : VxeTableDefines . ColumnInfo ) {
20+ return ! ! column . field || [ 'seq' , 'checkbox' , 'radio' ] . indexOf ( column . type || '' ) > - 1
2121}
2222
2323const getConvertColumns = ( columns : any ) => {
@@ -78,7 +78,7 @@ const convertToRows = (originColumns: any): any[][] => {
7878 return rows
7979}
8080
81- function toTableBorder ( border : any ) {
81+ function toTableBorder ( border : VxeTablePropTypes . Border | undefined ) {
8282 if ( border === true ) {
8383 return 'full'
8484 }
@@ -1012,7 +1012,7 @@ hooks.add('tableExportModule', {
10121012 }
10131013 return false
10141014 }
1015- return exportOpts . original ? column . field : defaultFilterExportColumn ( column )
1015+ return exportOpts . original ? ! ! column . field : defaultFilterExportColumn ( column )
10161016 }
10171017
10181018 const handleExportAndPrint = ( options : VxeTablePropTypes . ExportOpts | VxeTablePropTypes . ExportConfig , isPrint ?: boolean ) => {
@@ -1063,7 +1063,7 @@ hooks.add('tableExportModule', {
10631063 } )
10641064 // 默认选中
10651065 XEUtils . eachTree ( exportColumns , ( column , index , items , path , parent ) => {
1066- const isColGroup = column . children && column . children . length
1066+ const isColGroup = column . children && column . children . length > 0
10671067 let isChecked = false
10681068 if ( columns && columns . length ) {
10691069 isChecked = handleFilterColumns ( defOpts , column , columns )
@@ -1181,7 +1181,7 @@ hooks.add('tableExportModule', {
11811181 const customCols = columns && columns . length
11821182 ? columns
11831183 : XEUtils . searchTree ( collectColumn , column => {
1184- const isColGroup = column . children && column . children . length
1184+ const isColGroup = column . children && column . children . length > 0
11851185 let isChecked = false
11861186 if ( columns && columns . length ) {
11871187 isChecked = handleFilterColumns ( opts , column , columns )
@@ -1195,7 +1195,7 @@ hooks.add('tableExportModule', {
11951195 const handleOptions : VxeTablePropTypes . ExportHandleOptions = Object . assign ( { } as { data : any [ ] , colgroups : any [ ] , columns : any [ ] } , opts , { filename : '' , sheetName : '' } )
11961196 // 如果设置源数据,则默认导出设置了字段的列
11971197 if ( ! customCols && ! columnFilterMethod ) {
1198- handleOptions . columnFilterMethod = ( { column } ) => {
1198+ columnFilterMethod = ( { column } ) => {
11991199 if ( excludeFields ) {
12001200 if ( XEUtils . includes ( excludeFields , column . field ) ) {
12011201 return false
@@ -1207,8 +1207,9 @@ hooks.add('tableExportModule', {
12071207 }
12081208 return false
12091209 }
1210- return original ? column . field : defaultFilterExportColumn ( column )
1210+ return original ? ! ! column . field : defaultFilterExportColumn ( column )
12111211 }
1212+ handleOptions . columnFilterMethod = columnFilterMethod
12121213 }
12131214 if ( customCols ) {
12141215 handleOptions . _isCustomColumn = true
@@ -1294,10 +1295,8 @@ hooks.add('tableExportModule', {
12941295 // 检查类型,如果为自定义导出,则不需要校验类型
12951296 if ( ! handleOptions . exportMethod && ! XEUtils . includes ( XEUtils . keys ( exportOpts . _typeMaps ) , type ) ) {
12961297 errLog ( 'vxe.error.notType' , [ type ] )
1297- if ( process . env . VUE_APP_VXE_ENV === 'development' ) {
1298- if ( [ 'xlsx' , 'pdf' ] . includes ( type ) ) {
1299- warnLog ( 'vxe.error.reqPlugin' , [ 4 , 'plugin-export-xlsx' ] )
1300- }
1298+ if ( [ 'xlsx' , 'pdf' ] . includes ( type ) ) {
1299+ warnLog ( 'vxe.error.reqPlugin' , [ 4 , 'plugin-export-xlsx' ] )
13011300 }
13021301 const params = { status : false }
13031302 return Promise . reject ( params )
@@ -1317,10 +1316,8 @@ hooks.add('tableExportModule', {
13171316 handleOptions . data = selectRecords
13181317 }
13191318 } else if ( mode === 'all' ) {
1320- if ( process . env . VUE_APP_VXE_ENV === 'development' ) {
1321- if ( ! $xeGrid ) {
1322- warnLog ( 'vxe.error.errProp' , [ 'all' , 'mode=current,selected' ] )
1323- }
1319+ if ( ! $xeGrid ) {
1320+ errLog ( 'vxe.error.errProp' , [ 'all' , 'mode=current,selected' ] )
13241321 }
13251322
13261323 if ( $xeGrid && ! handleOptions . remote ) {
@@ -1334,10 +1331,8 @@ hooks.add('tableExportModule', {
13341331 const queryAllSuccessMethods = ajax . queryAllSuccess
13351332 const queryAllErrorMethods = ajax . queryAllError
13361333
1337- if ( process . env . VUE_APP_VXE_ENV === 'development' ) {
1338- if ( ! ajaxMethods ) {
1339- warnLog ( 'vxe.error.notFunc' , [ 'proxy-config.ajax.queryAll' ] )
1340- }
1334+ if ( ! ajaxMethods ) {
1335+ errLog ( 'vxe.error.notFunc' , [ 'proxy-config.ajax.queryAll' ] )
13411336 }
13421337
13431338 if ( ajaxMethods ) {
@@ -1578,7 +1573,7 @@ hooks.add('tableExportModule', {
15781573 if ( ! props . exportConfig ) {
15791574 errLog ( 'vxe.error.reqProp' , [ 'export-config' ] )
15801575 }
1581- handleExportAndPrint ( defOpts )
1576+ return handleExportAndPrint ( defOpts )
15821577 } ,
15831578 closePrint : handleCloseExport ,
15841579 openPrint ( options ) {
@@ -1589,7 +1584,7 @@ hooks.add('tableExportModule', {
15891584 if ( ! props . printConfig ) {
15901585 errLog ( 'vxe.error.reqProp' , [ 'print-config' ] )
15911586 }
1592- handleExportAndPrint ( defOpts , true )
1587+ return handleExportAndPrint ( defOpts , true )
15931588 }
15941589 }
15951590
0 commit comments