A 2022-07-14 22:08:34 +08:00
commit 5614ef750c
1 changed files with 53 additions and 52 deletions

View File

@ -54,34 +54,35 @@ export default {
methods: { methods: {
// //
getOption() { getOption() {
// //
let isAllZero = this.dataList.every(item => { let isAllZero = this.dataList.every(item => {
// console.log(item,"item") // console.log(item,"item")
return item.value == 0 return item.value == 0
}) })
console.log(isAllZero,"isAllZero") console.log(isAllZero, "isAllZero")
let option=null let option = null
if(isAllZero==true){ if (isAllZero == true) {
for(let i =0;i<this.dataList.length;i++){ for (let i = 0; i < this.dataList.length; i++) {
this.dataList[i].name = this.dataList[i].name+" 已完成工作项:"+this.dataList[i].value+"项" this.dataList[i].name = this.dataList[i].name + " 已完成工作项:" + this.dataList[i].value + "项"
} }
console.log(this.dataList,"this.dataListgroup") console.log(this.dataList, "this.dataListgroup")
option = { option = {
tooltip: { tooltip: {
trigger: 'item' trigger: 'item'
}, },
// //
// graphic:{ // graphic:{
// type:'text', // type:'text',
// left:'27%', // left:'27%',
// top:'50%', // top:'50%',
// style:{ // style:{
// text:'', // text:'',
// textAlign:'center', // textAlign:'center',
// fill:'#000', // fill:'#000',
// } // }
// }, // },
series: [ series: [
{ {
name: '统计', name: '统计',
@ -113,39 +114,39 @@ export default {
} }
] ]
}; };
}else{ } else {
for(let i =0;i<this.dataList.length;i++){ for (let i = 0; i < this.dataList.length; i++) {
this.dataList[i].name = this.dataList[i].name+""+this.dataList[i].value+"人" this.dataList[i].name = this.dataList[i].name + "" + this.dataList[i].value + "人"
} }
option = { option = {
tooltip: { tooltip: {
trigger: 'item' trigger: 'item'
}, },
series: [ series: [
{ {
name: '统计', name: '统计',
type: 'pie', type: 'pie',
center: ['35%', '55%'], center: ['35%', '55%'],
// radius: ['40%', '70%'], // radius: ['40%', '70%'],
avoidLabelOverlap: false, avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: { label: {
show: false, show: false,
fontSize: '40', position: 'center'
fontWeight: 'bold' },
} emphasis: {
}, label: {
labelLine: { show: false,
show: false fontSize: '40',
}, fontWeight: 'bold'
data: this.dataList }
} },
] labelLine: {
}; show: false
},
data: this.dataList
}
]
};
} }
@ -183,7 +184,7 @@ export default {
// //
updateEcharts() { updateEcharts() {
this.myChart.setOption(this.getOption(), true); this.myChart.setOption(this.getOption(), true);
console.log( this.dataList," this.dataList") console.log(this.dataList, " this.dataList")
} }
} }
} }