Commit 22e4040f by 匡雅琴

修改饼图

1 parent f922bc54
......@@ -86,7 +86,8 @@ export default {
list.forEach(item => {
this.viewData.push({
name: item[keys[0]],
value: item[keys[1]]
value: item[keys[1]],
avarage: item[keys[2]]
})
})
},
......@@ -96,7 +97,7 @@ export default {
window.addEventListener('resize', () => {
this.echartsPie.resize()
})
const _this = this
// 指定图表的配置项和数据
this.option = {
// tooltip: {
......@@ -125,7 +126,12 @@ export default {
fontSize: this.size,
fontWeight: 'bold',
color: '#fff',
formatter(param) {
formatter(params) {
const _dataIndex = params.dataIndex
const _avarage = _this.list[_dataIndex].averprice
console.log(_this.list, _avarage);
if (_avarage) return `${params.name}\n均价¥${_avarage || ''}`
return `${params.name}`
}
}
},
......
......@@ -70,7 +70,7 @@ export default {
this.openMessage('获取采购进度占比失败')
return
}
this.progressData = res.data.dataList.slice(0, 3) || []
this.progressData = res.data.dataList || []
})
}
}
......
......@@ -23,7 +23,7 @@ export default {
// 采购占比饼图结构
propertionChart: {
id: 'propertion',
keys: ['goodsname', 'purchaseamount'],
keys: ['goodsname', 'purchaseamount', 'averprice'],
height: '15.34vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!