From b1f363923fd64f527561755faf5192947037b7e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Mon, 6 Nov 2023 15:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BD=BF=E7=94=A8=E7=99=BE?= =?UTF-8?q?=E5=88=86=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/exportExcel/index.vue | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/PC/UI.WinIn.FasterZ.AgGridReport/src/components/exportExcel/index.vue b/PC/UI.WinIn.FasterZ.AgGridReport/src/components/exportExcel/index.vue index ab9f355..895b3c8 100644 --- a/PC/UI.WinIn.FasterZ.AgGridReport/src/components/exportExcel/index.vue +++ b/PC/UI.WinIn.FasterZ.AgGridReport/src/components/exportExcel/index.vue @@ -39,7 +39,8 @@ export default { data () { return { excelDataList:null,//导出数据(格式化后) - excelNumberHeader:null,//带数字表头暂存 + excelKiloNumberHeader:null,//带数字表头暂存 + excelPercentHeader:null,//带百分比表头暂存 }; }, watch:{ @@ -59,19 +60,28 @@ export default { this.excelData.forEach((item,key)=>{ let _item = JSON.parse(JSON.stringify(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) } + if(this.excelPercentHeader.indexOf(field) >= 0){ + _item[field] = util.numberPercentFormatter(item[field]) + } } this.excelDataList.push(_item) }) }, - // 数字表头暂存(目的:转千位符) + // 表头类型暂存(目的:转千位符/百分比) initExcelHeader(){ - this.excelNumberHeader = [] + this.excelKiloNumberHeader = [] + this.excelPercentHeader = [] this.columnList.forEach(item=>{ + // 千位符暂存 if(item.type == 'kiloNumber'){ - this.excelNumberHeader.push(item.field) + this.excelKiloNumberHeader.push(item.field) + } + // 百分比暂存 + if(item.type == 'percentNumber'){ + this.excelPercentHeader.push(item.field) } }) },