Commit 5f0a37bd by 张立顺

fix bug

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