This commit is contained in:
熊丽君
2021-12-09 10:15:29 +08:00
parent 0905e4f5bd
commit cb3aedd130
3 changed files with 147 additions and 59 deletions

View File

@ -5,30 +5,30 @@
<rocketTit class="tit">全年目标</rocketTit>
<div class="data">
<div class="data-item">
<div><img src="./icon1.png" alt="" /><span>收入</span></div>
<div><img src="./icon1.png" alt="" /><span style="font-weight: bold">收入</span></div>
<div class="box"><i>3380/</i><i class="num">12342</i><span class="num2"></span></div>
<div style="padding: 0 15px">
<div>
<progressBar :percentage="70" />
</div>
</div>
<div class="data-item">
<div><img src="./icon2.png" alt="" /><span>利润</span></div>
<div><img src="./icon2.png" alt="" /><span style="font-weight: bold">利润</span></div>
<div class="box"><i>380/</i><i class="num">12342</i><span class="num2"></span></div>
<div style="padding: 0 15px">
<div>
<progressBar :percentage="70" />
</div>
</div>
<div class="data-item">
<div><img src="./icon3.png" alt="" /><span>装药量</span></div>
<div><img src="./icon3.png" alt="" /><span style="font-weight: bold">装药量</span></div>
<div class="box"><i>999/</i><i class="num">12342</i><span class="num2">万件</span></div>
<div style="padding: 0 15px">
<div>
<progressBar :percentage="70" />
</div>
</div>
<div class="data-item">
<div><img src="./icon4.png" alt="" /><span>交付数量</span></div>
<div><img src="./icon4.png" alt="" /><span style="font-weight: bold">交付数量</span></div>
<div class="box"><i>999/</i><i class="num">12342</i><span class="num2">万件</span></div>
<div style="padding: 0 15px">
<div>
<progressBar :percentage="70" />
</div>
</div>
@ -74,12 +74,17 @@ export default {
}
.data {
display: flex;
margin: 0 15px;
justify-content: space-evenly;
margin: 0 30px;
background: rgba(2, 18, 63, 0.33);
color: #ffffff;
font-size: 18px;
.data-item {
flex: 1;
// flex: 1;
width: 20%;
display: flex;
flex-direction: column;
align-items: flex-start;
> div {
margin: 5px 0;
text-align: center;

View File

@ -49,7 +49,16 @@ export default {
},
data() {
return {
index: 0,
data: [
{ value: 154, name: '类别一' },
{ value: 775, name: '类别二' },
{ value: 679, name: '类别三' },
{ value: 679, name: '类别四' },
{ value: 679, name: '类别五' },
{ value: 679, name: '类别六' },
{ value: 679, name: '类别七' },
{ value: 679, name: '类别八' },
],
}
},
mounted() {
@ -65,6 +74,10 @@ export default {
this.setOptions()
},
setOptions() {
const calcAverageValue = (data, name) => {
const items = data.filter(d => d.name === name)
return items.length ? items.reduce((a, b) => a + b.value, 0) / items.length : '-'
}
this.chart.setOption({
tooltip: {
trigger: 'item',
@ -81,6 +94,9 @@ export default {
color: '#fff',
fontSize: 16,
},
// formatter: value => {
// return value + calcAverageValue(this.data, value)
// },
},
series: [
{
@ -89,23 +105,14 @@ export default {
radius: [0, '85%'],
center: ['35%', '50%'],
label: {
formatter: '{d}%',
formatter: '',
position: 'inner',
fontSize: 14,
},
labelLine: {
show: false,
},
data: [
{ value: 154, name: '类别一' },
{ value: 775, name: '类别二' },
{ value: 679, name: '类别三' },
{ value: 679, name: '类别四' },
{ value: 679, name: '类别五' },
{ value: 679, name: '类别六' },
{ value: 679, name: '类别七' },
{ value: 679, name: '类别八' },
],
data: this.data,
},
],
})
@ -118,22 +125,37 @@ export default {
this.chart.setOption({
tooltip: {
trigger: 'axis',
formatter: '{a1}<br/>{b1}{c1}%',
formatter: '{a1}<br/>{b1}{c1}',
},
legend: {
data: ['收入', '实际', '目标'],
textStyle: {
color: '#fff', //legend字体颜色
},
// selectedMode: false,
},
grid: {
containLabel: true,
left: 50,
left: 20,
right: 10,
top: 30,
bottom: 50,
},
xAxis: {
data: ['2021-01', '2021-02', '2021-03', '2021-04', '2021-05', '2021-06', '2021-07', '2021-08'],
data: [
'2021-01',
'2021-02',
'2021-03',
'2021-04',
'2021-05',
'2021-06',
'2021-07',
'2021-08',
'2021-09',
'2021-10',
'2021-11',
'2021-12',
],
axisLine: {
lineStyle: {
color: 'rgb(255, 255, 255)',
@ -146,7 +168,9 @@ export default {
end: 50,
},
color: ['#ccc', 'red'],
yAxis: {
yAxis: [
{
name: '件',
splitLine: {
show: true,
// 改变轴线颜色
@ -156,7 +180,7 @@ export default {
},
},
axisLabel: {
formatter: '{value}%',
formatter: '{value}',
},
axisLine: {
lineStyle: {
@ -164,6 +188,27 @@ export default {
},
},
},
{
type: 'value',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value} %',
},
splitLine: {
show: false, //不显示网格线
},
splitArea: {
show: false, //不显示网格区域
},
axisLine: {
lineStyle: {
color: 'rgb(255, 255, 255)',
},
},
},
],
series: [
{
name: '收入',
@ -184,7 +229,7 @@ export default {
itemStyle: {
color: 'rgba(90, 216, 166, 0.85)',
},
data: [5, 20, 36, 10, 10, 20, 80, 80, 95, 95, 95, 95],
data: [5, 20, 36, 10, 10, 20, 10, 20, 30, 10, 70, 75],
},
{
name: '目标',
@ -196,7 +241,7 @@ export default {
itemStyle: {
color: '#F6D97E',
},
data: [10, 20, 36, 10, 10, 20, 10, 20, 36, 10, 10, 20],
data: [20, 30, 45, 20, 20, 30, 20, 30, 40, 20, 90, 90],
},
],
})

View File

@ -125,22 +125,37 @@ export default {
this.chart.setOption({
tooltip: {
trigger: 'axis',
formatter: '{a1}<br/>{b1}{c1}%',
formatter: '{a1}<br/>{b1}{c1}',
},
legend: {
data: ['预测', '实际', '目标'],
textStyle: {
color: '#fff', //legend字体颜色
},
// selectedMode: false,
},
grid: {
containLabel: true,
left: 50,
left: 20,
right: 10,
top: 30,
bottom: 50,
},
xAxis: {
data: ['型号一', '型号二', '型号三', '型号四', '型号五', '型号六', '型号七', '型号八'],
data: [
'型号一',
'型号二',
'型号三',
'型号四',
'型号五',
'型号六',
'型号七',
'型号八',
'型号九',
'型号十',
'型号十一',
'型号十二',
],
axisLine: {
lineStyle: {
color: 'rgb(255, 255, 255)',
@ -153,7 +168,9 @@ export default {
end: 50,
},
color: ['#ccc', 'red'],
yAxis: {
yAxis: [
{
name: '件',
splitLine: {
show: true,
// 改变轴线颜色
@ -163,7 +180,7 @@ export default {
},
},
axisLabel: {
formatter: '{value}%',
formatter: '{value}',
},
axisLine: {
lineStyle: {
@ -171,11 +188,32 @@ export default {
},
},
},
{
type: 'value',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value} %',
},
splitLine: {
show: false, //不显示网格线
},
splitArea: {
show: false, //不显示网格区域
},
axisLine: {
lineStyle: {
color: 'rgb(255, 255, 255)',
},
},
},
],
series: [
{
name: '预测',
type: 'bar',
z: '-1',
// z: '-1',
barGap: '-75%',
barWidth: 30,
itemStyle: {