Commit 374b8230 by 杨明

fixed

1 parent c3b13da8
......@@ -56,16 +56,35 @@ export default {
handler(val) {
this.dateArray = this.totalData.map(item => item.dateTime) //日期
this.customerCount = this.totalData.map(item => item.newCustomerCount)
this.customerRatio = this.totalData.map(item => item.customerRatio * 100)
this.customerRatio = this.totalData.map(item => this.Solution(item.customerRatio, 100))
this.entmicroCount = this.totalData.map(item => item.newEntmicroCount)
this.entmicroRatio = this.totalData.map(item => item.entmicroRatio * 100)
this.entmicroRatio = this.totalData.map(item => this.Solution(item.entmicroRatio, 100))
this.initChart()
}
}
},
methods: {
Solution(a, b) {
if (a === 0 || b === 0) return 0 //
let m = 0 //精度
let s1 = a.toString()
let s2 = b.toString()
if (s1.indexOf('.') == -1 && s2.indexOf('.') == -1) {
return a * b
} else {
//计算s1小数点后的位数
m = m + (s1.indexOf('.') >= 0 ? s1.split('.')[1].length : 0)
//计算s2小数点后的位数
m = m + (s2.indexOf('.') >= 0 ? s2.split('.')[1].length : 0)
//除小数点后的所有位数相乘/精度
return (Number(s1.replace('.', '')) * Number(s2.replace('.', ''))) / Math.pow(10, m)
}
},
initChart() {
// 基于准备好的dom,初始化echarts实例
let myChart = this.$echarts.init(this.$refs.myChart)
......@@ -100,7 +119,7 @@ export default {
circleColor = '#FEBE6B'
res += `<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${circleColor};"></span>` + datas[i].seriesName + ':' + datas[i].data + '人' + '<br/>'
}
if (datas[i].seriesName == '企微客户环比') {
if (datas[i].seriesName == '企微客户环比') {
circleColor = '#FE9C1C'
res += `<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${circleColor};"></span>` + datas[i].seriesName + ':' + datas[i].data + '%' + '<br/>'
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!