把合计变成千位分割符,两位小数


formatterThousandNews(cellValue) {
      return cellValue && cellValue.toLocaleString('en-US', {
        minimumFractionDigits: 0,
        maximumFractionDigits: 4
      })
    },
{{ formatterThousandNews(scope.row[item.fieldname]) }}
合计:{{ choiceTotal }}
computed: {
    choiceTotal() {
      const sum = this.multipleSelection.reduce((acc, cur) => { acc += cur.dblamount; return acc }, 0)
      return parseFloat(sum.toFixed(2)).toLocaleString()
    }
  }

//
千分位小数formatter export function formatterThousandDecimal(row, column, cellValue) {   if ((cellValue !== null && cellValue) || cellValue === 0) {     cellValue = Number(cellValue).toFixed(2)     cellValue += ''     if (!cellValue.includes('.')) cellValue += '.'     return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function($0, $1) {       return $1 + ','     }).replace(/\.$/, '')   } } <el-table-column             v-if="bodyIntpreset.dblpriceIsview===0"             key="dblprice"             prop="dblprice"             :label="bodyIntpreset.dblpriceshowname"             min-width="140"             align="right"             :width="headWidth.dblprice"             :formatter="formatterThousandDecimal"           /> <span v-if="pageType==='detail'">                 {{ formatterThousandDecimal(null,null,scope.row.dblpayprice) }} {{dblamount |currency}}               </span> <div v-if="pageType === 'detail' && !isEdit('dblamount')">{{ scope.row.dblamount| currency }}</div> import XEUtils from 'xe-utils' export function formatterCommafyFixed(row, column, cellValue) {   return cellValue && XEUtils.commafy(XEUtils.toFixed(cellValue, 2)) } this.allDblamount = XEUtils.commafy(XEUtils.toFixed(allDblamount, 2))

 

posted @ 2024-12-03 11:51  hello芳芳  阅读(8)  评论(0)    收藏  举报