xy 1 year ago
parent ba8ed9ad45
commit 6e9147e212

@ -137,17 +137,17 @@ export default {
color: '#188df0', color: '#188df0',
position: 'top', position: 'top',
formatter: (params) => { formatter: (params) => {
const m2 = this.list[params.dataIndex]?.money_total_2 || 0 const m2 = isNaN(Number(this.list[params.dataIndex]?.money_total_2)) ? 0 : Number(this.list[params.dataIndex]?.money_total_2)
const m1 = this.list[params.dataIndex]?.money_total_1 || 0 const m1 = isNaN(Number(this.list[params.dataIndex]?.money_total_1)) ? 0 : Number(this.list[params.dataIndex]?.money_total_1)
const m3 = this.list[params.dataIndex]?.use_money_total || 0 const m3 = isNaN(Number(this.list[params.dataIndex]?.use_money_total)) ? 0 : Number(this.list[params.dataIndex]?.use_money_total)
let per = 0 let per = 0
if (m2 !== 0) { if (m2 !== 0) {
per = m2 === 0 ? ((m3 / m2) * 100) : 0 per = (m3 / m2) * 100
} else if (m1 !== 0) { } else if (m1 !== 0) {
per = m1 === 0 ? ((m3 / m1) * 100) : 0 per = (m3 / m1) * 100
} }
return Number(per) + '%' return Number(per).toFixed(2) + '%'
} }
}, },
itemStyle: { itemStyle: {

Loading…
Cancel
Save