Commit 5f0a37bd by 张立顺

fix bug

1 parent 2752ba9e
......@@ -85,18 +85,16 @@ Component({
{
name: '已完成',
key: 'completed',
width: 'var(--fontSize150)',
beforeUnit: '¥'
width: 'var(--fontSize150)'
},
{
name: '当月目标',
key: 'target',
width: 'var(--fontSize150)',
beforeUnit: '¥'
width: 'var(--fontSize150)'
},
{
name: '完成率',
key: 'CustomerRate',
key: 'completionRate',
width: 'var(--fontSize150)',
unit: '%'
}
......
......@@ -77,14 +77,14 @@ Component({
formatTable(table, tableObj) {
// 通用格式化:为空返回"0.00",数值保留两位小数,并加千分位逗号
// 特例:当 headerConfig.key 为 'staffName' 时不处理数值格式化
if (
this.data.headerConfig &&
(this.data.headerConfig.key === 'staffName' ||
this.data.headerConfig.key === 'personnelName')
) {
this.setData({ formattedTable: table })
return
}
// if (
// this.data.headerConfig &&
// (this.data.headerConfig.key === 'staffName' ||
// this.data.headerConfig.key === 'personnelName')
// ) {
// this.setData({ formattedTable: table })
// return
// }
const formatNumber = val => {
if (val === null || val === undefined || val === '') return '0.00'
......@@ -97,7 +97,10 @@ Component({
return parts.join('.')
}
const keys = (tableObj || []).map(i => i && i.key).filter(Boolean)
const keys = (tableObj || [])
.filter(i => i && (i.unit || i.beforeUnit))
.map(i => i.key)
.filter(Boolean)
const src = Array.isArray(table) ? table : []
const formatted = src.map(row => {
const copy = { ...row }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!