Files

326 lines
6.5 KiB
Vue
Raw Normal View History

2021-11-22 09:17:41 +08:00
<template>
2021-12-08 14:13:08 +08:00
<div>
<container2 title="经营责任书完成概况">
<div class="wrap">
<el-row class="content1">
<el-col :span="24">
<div id="left1" ref="left1" class="chart1"></div>
</el-col>
</el-row>
2021-12-08 22:58:15 +08:00
<div class="box">
<span style="font-size: 25px; margin-right: 3px">·</span>
<span>总完成任务/完成率</span>
<i class="num">55/80%</i>
<progressBar :percentage="70" />
</div>
2021-12-08 14:13:08 +08:00
</div>
</container2>
<container2 title="收入概况" style="margin-top: 10px">
2021-12-08 22:58:15 +08:00
<div style="height: 100%; width: 100%" ref="left2"></div>
<!-- <div class="wrap">
2021-12-08 14:13:08 +08:00
<el-row class="content2">
2021-12-08 22:58:15 +08:00
<el-col :span="24" style="height: 100%">
2021-12-08 14:13:08 +08:00
<div id="left2" ref="left2" class="chart2"></div>
</el-col>
</el-row>
2021-12-08 22:58:15 +08:00
</div> -->
2021-12-08 14:13:08 +08:00
</container2>
</div>
2021-11-22 09:17:41 +08:00
</template>
<script>
2021-12-08 14:13:08 +08:00
import rocketTit from '../components/rocketTit/index.vue'
import container2 from './components/container2/index.vue'
import bigScreenTabs from '../components/bigScreenTabs/index.vue'
2021-12-08 22:58:15 +08:00
import progressBar from '@/views/bigScreen/components/progress/index.vue'
2021-12-09 10:27:09 +08:00
import colorList from '@/utils/colorPalette'
2021-12-08 08:44:16 +08:00
// import {Liquid} from '@antv/g2plot';
// import resize from '../../dashboard/mixins/resize'
2021-12-08 22:58:15 +08:00
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
2021-11-22 09:17:41 +08:00
export default {
2021-12-08 14:13:08 +08:00
// mixins: [resize],
name: 'left1',
components: {
rocketTit,
container2,
bigScreenTabs,
2021-12-08 22:58:15 +08:00
progressBar,
2021-12-08 14:13:08 +08:00
},
data() {
return {
2021-12-09 10:15:29 +08:00
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: '类别八' },
],
2021-12-09 10:27:09 +08:00
colorList,
2021-12-08 14:13:08 +08:00
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
this.initLine()
})
},
beforeDestroy() {},
methods: {
initChart() {
2021-12-08 22:58:15 +08:00
this.chart = echarts.init(this.$refs.left1, 'macarons')
this.setOptions()
},
setOptions() {
2021-12-09 10:15:29 +08:00
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 : '-'
}
2021-12-08 22:58:15 +08:00
this.chart.setOption({
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b}: {c} ({d}%)',
},
2021-12-09 10:27:09 +08:00
color: this.colorList,
2021-12-08 14:13:08 +08:00
legend: {
2021-12-08 22:58:15 +08:00
data: ['类别一', '类别二', '类别三', '类别四', '类别五', '类别六', '类别七', '类别八'],
orient: 'vertical',
// left: '60%',
right: '2%',
y: 'center',
textStyle: {
//图例文字的样式
color: '#fff',
fontSize: 16,
},
2021-12-09 10:15:29 +08:00
// formatter: value => {
// return value + calcAverageValue(this.data, value)
// },
2021-12-08 22:58:15 +08:00
},
series: [
{
name: '概括',
type: 'pie',
radius: [0, '85%'],
center: ['35%', '50%'],
label: {
2021-12-09 10:15:29 +08:00
formatter: '',
2021-12-08 22:58:15 +08:00
position: 'inner',
fontSize: 14,
2021-12-08 14:13:08 +08:00
},
2021-12-08 22:58:15 +08:00
labelLine: {
show: false,
2021-12-08 14:13:08 +08:00
},
2021-12-09 10:15:29 +08:00
data: this.data,
2021-12-08 14:13:08 +08:00
},
2021-12-08 22:58:15 +08:00
],
})
},
initLine() {
this.chart = echarts.init(this.$refs.left2)
this.setOptions2()
},
setOptions2() {
this.chart.setOption({
tooltip: {
trigger: 'axis',
2021-12-09 10:15:29 +08:00
formatter: '{a1}<br/>{b1}{c1}',
2021-12-08 22:58:15 +08:00
},
legend: {
data: ['收入', '实际', '目标'],
textStyle: {
color: '#fff', //legend字体颜色
},
2021-12-09 10:15:29 +08:00
// selectedMode: false,
2021-12-08 22:58:15 +08:00
},
grid: {
containLabel: true,
2021-12-09 10:15:29 +08:00
left: 20,
right: 10,
2021-12-08 22:58:15 +08:00
top: 30,
bottom: 50,
},
xAxis: {
2021-12-09 10:15:29 +08:00
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',
],
2021-12-08 22:58:15 +08:00
axisLine: {
lineStyle: {
color: 'rgb(255, 255, 255)',
2021-12-08 14:13:08 +08:00
},
},
2021-12-08 22:58:15 +08:00
},
dataZoom: {
type: 'slider',
start: 0,
end: 50,
},
color: ['#ccc', 'red'],
2021-12-09 10:15:29 +08:00
yAxis: [
{
name: '件',
splitLine: {
show: true,
// 改变轴线颜色
lineStyle: {
// 使用深浅的间隔色
color: ['rgba(255, 255, 255,.5)'],
},
},
axisLabel: {
formatter: '{value}',
},
axisLine: {
lineStyle: {
color: 'rgb(255, 255, 255)',
},
2021-12-08 14:13:08 +08:00
},
2021-12-08 22:58:15 +08:00
},
2021-12-09 10:15:29 +08:00
{
type: 'value',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value} %',
},
splitLine: {
show: false, //不显示网格线
},
splitArea: {
show: false, //不显示网格区域
},
axisLine: {
lineStyle: {
color: 'rgb(255, 255, 255)',
},
2021-12-08 14:13:08 +08:00
},
},
2021-12-09 10:15:29 +08:00
],
2021-12-08 22:58:15 +08:00
series: [
{
name: '收入',
type: 'bar',
z: '-1',
barGap: '-75%',
barWidth: 30,
itemStyle: {
color: 'rgba(85, 197, 162, .3)',
},
data: [80, 80, 95, 95, 95, 95, 80, 80, 95, 95, 95, 95],
2021-12-08 14:13:08 +08:00
},
2021-12-08 22:58:15 +08:00
{
name: '实际',
type: 'bar',
barWidth: 15,
position: [0, 0],
itemStyle: {
color: 'rgba(90, 216, 166, 0.85)',
},
2021-12-09 10:15:29 +08:00
data: [5, 20, 36, 10, 10, 20, 10, 20, 30, 10, 70, 75],
2021-12-08 22:58:15 +08:00
},
{
name: '目标',
type: 'scatter',
symbol: 'rect',
symbolSize: [30, 4],
symbolOffset: [3, 0],
position: [0, 0],
itemStyle: {
color: '#F6D97E',
},
2021-12-09 10:15:29 +08:00
data: [20, 30, 45, 20, 20, 30, 20, 30, 40, 20, 90, 90],
2021-12-08 22:58:15 +08:00
},
],
2021-12-08 14:13:08 +08:00
})
},
},
2021-11-22 09:17:41 +08:00
}
</script>
<style lang="scss" scoped>
2021-12-08 08:44:16 +08:00
.wrap {
2021-12-08 14:13:08 +08:00
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
2021-12-08 22:58:15 +08:00
.box {
padding: 0 0 5px 15px;
display: flex;
align-items: center;
.num {
font-size: 24px;
font-weight: 600;
margin: 0 10px;
}
}
2021-12-08 08:44:16 +08:00
}
.content1 {
2021-12-08 14:13:08 +08:00
// height: 200px;
height: 100%;
.chart1 {
margin: 0 auto;
width: 100%;
height: 192px;
background: transparent;
}
2021-12-08 08:44:16 +08:00
}
2021-11-22 09:17:41 +08:00
.num {
2021-12-08 14:13:08 +08:00
font-size: 30px;
font-family: Roboto-BlackItalic, Roboto;
font-weight: normal;
color: #91d5fe;
vertical-align: sub;
// margin-right: 3px;
2021-11-22 09:17:41 +08:00
}
2021-12-08 08:44:16 +08:00
.content2 {
2021-12-08 14:13:08 +08:00
padding: 20px;
flex: 1;
2021-12-08 22:58:15 +08:00
height: 100%;
2021-12-08 14:13:08 +08:00
box-sizing: border-box;
display: flex;
flex-direction: column;
2021-12-08 22:58:15 +08:00
.chart2 {
2021-12-08 14:13:08 +08:00
height: 100%;
}
2021-12-08 08:44:16 +08:00
2021-12-08 14:13:08 +08:00
.tit {
font-size: 16px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #ffffff;
line-height: 22px;
position: relative;
padding-left: 15px;
}
.tit::after {
content: '';
display: block;
position: absolute;
top: 3px;
left: 0px;
width: 4px;
height: 16px;
background: #00ffff;
}
2021-11-22 09:17:41 +08:00
}
2021-12-08 14:13:08 +08:00
</style>