【修改】增加完成百分比 总数
This commit is contained in:
@@ -119,7 +119,7 @@ export default {
|
||||
let dataIndex = 'key' + index
|
||||
tableData[0][dataIndex] = item.allMoney
|
||||
tableData[1][dataIndex] = item.confirmAmount
|
||||
tableData[2][dataIndex] = this.calcPercent(item.confirmAmount,item.allMoney)
|
||||
tableData[2][dataIndex] = item.value + '%'
|
||||
})
|
||||
this.dataSource = tableData
|
||||
}
|
||||
@@ -139,7 +139,7 @@ export default {
|
||||
{
|
||||
title: '',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
width: 140,
|
||||
dataIndex: 'indexName',
|
||||
scopedSlots: {customRender: 'text'}
|
||||
},
|
||||
@@ -148,7 +148,7 @@ export default {
|
||||
this.columns.push({
|
||||
title: item.name,
|
||||
align: 'center',
|
||||
width: 160,
|
||||
width: index < 7 ? 190 : 120,
|
||||
dataIndex: 'key' + index,
|
||||
scopedSlots: {customRender: 'allMoney'}
|
||||
},)
|
||||
@@ -159,10 +159,13 @@ export default {
|
||||
let xData = data.reduce((pre, val) => {
|
||||
return pre.concat(val.name)
|
||||
}, [])
|
||||
xData = xData.slice(0,7)
|
||||
// 处理y轴数据
|
||||
data.map(item => {
|
||||
this.echartsData.allMoney.push(item.allMoney)
|
||||
this.echartsData.confirmAmount.push(item.confirmAmount)
|
||||
data.map((item,index) => {
|
||||
if(index < 7){
|
||||
this.echartsData.allMoney.push({value:item.allMoney,percent:item.value})
|
||||
this.echartsData.confirmAmount.push({value:item.confirmAmount,percent:item.value})
|
||||
}
|
||||
})
|
||||
|
||||
let chartDom = document.getElementById('departmentTotal')
|
||||
@@ -173,7 +176,7 @@ export default {
|
||||
color: ['#069F99', '#FFA17A'],
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '0%',
|
||||
right: '7%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
@@ -183,7 +186,7 @@ export default {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
formatter: params => {
|
||||
let percent = this.calcPercent(params[1].data,params[0].data)
|
||||
let percent = params[0].data.percent + '%'
|
||||
// 获取xAxis data中的数据
|
||||
let dataStr = ''
|
||||
params.forEach(item => {
|
||||
@@ -193,7 +196,7 @@ export default {
|
||||
<span style="display:inline-block;margin-right:5px;width:15px;height:10px;background-color:${item.color};border-radius: 3px"></span>
|
||||
<span style="color:#666">${item.seriesName}</span>
|
||||
</div>
|
||||
<div style="color:#333;">${this.formatMoney(item.data)}</div>
|
||||
<div style="color:#333;">${this.formatMoney(item.value)}</div>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
@@ -303,7 +306,7 @@ export default {
|
||||
* */
|
||||
calcPercent(num1,num2){
|
||||
let pointNo = Number(num1) / Number(num2) * 100
|
||||
return pointNo.toFixed(2) + '%'
|
||||
return pointNo.toFixed(1) + '%'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user