<template slot-scope="scope">
<span>{{w[item.prop],w,item.prop)}}</span>
</template>
</el-table-column>
</template>
</el-table>
</div>
</transition>
</template>
<script>
import FileSaver from 'file-saver'
import XLSX from 'xlsx'
export default {
props: {
exportExcelInfo: {
type: Object,
default: {}
},
exportExcelArry: {
type: Array,
default: []
},
tableData: {
type: Array,
default: []
js控制滚动条},
},
methods: {
//excel导出
exportExcel () {
var xlsxParam = { raw: true } // 导出的内容只做解析,不进⾏格式转换
var wb = XLSX.utils.table_to_book(document.querySelector('#'+lId),xlsxParam)        var wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
try {
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), lName)        } catch (e) {
if (typeof console !== 'undefined') console.log(e, wbout)
}
return wbout
},
//表格formatter数据格式化
formatter (value,item,row,prop) {
//针对table中item多层对象层级的情况
if(prop.indexOf('.') > 0){
let temp = prop.split('.')
//item中嵌套两层
if(temp.length == 2){
let temp = prop.split('.')
if(item.formatterType == 'common-type'){  //通⽤类型转换
let arry = item.formatterInfo
for(let i in arry){
if(arry[i].value == row[temp[0]][temp[1]]){
return arry[i].label
}
}
} else if(item.formatterType == 'time-type'){ //时间标准格式化
if(!global.isNull(row[temp[0]][temp[1]])){
return row[temp[0]][temp[1]].substring(0,row[temp[0]][temp[1]].length - 2)
}
} else if(item.formatterType == 'amount-type'){ //⾦额转换
return (row[temp[0]][temp[1]] / 100).toFixed(2)
}
}
} else{ //item中⽆嵌套对象
let temp = prop.split('.')
if(item.formatterType == 'common-type'){  //通⽤类型转换
let arry = item.formatterInfo
for(let i in arry){
if(arry[i].value == value){
return arry[i].label
}
}
} else if(item.formatterType == 'time-type'){ //时间标准格式化

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。