Browse Source

导出使用百分比

faster_AG_grid
安虹睿 1 year ago
parent
commit
b1f363923f
  1. 20
      PC/UI.WinIn.FasterZ.AgGridReport/src/components/exportExcel/index.vue

20
PC/UI.WinIn.FasterZ.AgGridReport/src/components/exportExcel/index.vue

@ -39,7 +39,8 @@ export default {
data () { data () {
return { return {
excelDataList:null,// excelDataList:null,//
excelNumberHeader:null,// excelKiloNumberHeader:null,//
excelPercentHeader:null,//
}; };
}, },
watch:{ watch:{
@ -59,19 +60,28 @@ export default {
this.excelData.forEach((item,key)=>{ this.excelData.forEach((item,key)=>{
let _item = JSON.parse(JSON.stringify(item)) let _item = JSON.parse(JSON.stringify(item))
for(let field in item){ for(let field in item){
if(this.excelNumberHeader.indexOf(field) >= 0){ if(this.excelKiloNumberHeader.indexOf(field) >= 0){
_item[field] = util.numberFixedFormatter(item[field],true) _item[field] = util.numberFixedFormatter(item[field],true)
} }
if(this.excelPercentHeader.indexOf(field) >= 0){
_item[field] = util.numberPercentFormatter(item[field])
}
} }
this.excelDataList.push(_item) this.excelDataList.push(_item)
}) })
}, },
// // /
initExcelHeader(){ initExcelHeader(){
this.excelNumberHeader = [] this.excelKiloNumberHeader = []
this.excelPercentHeader = []
this.columnList.forEach(item=>{ this.columnList.forEach(item=>{
//
if(item.type == 'kiloNumber'){ if(item.type == 'kiloNumber'){
this.excelNumberHeader.push(item.field) this.excelKiloNumberHeader.push(item.field)
}
//
if(item.type == 'percentNumber'){
this.excelPercentHeader.push(item.field)
} }
}) })
}, },

Loading…
Cancel
Save