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