Merge branch 'dev-jack' into shenzhen-dev
This commit is contained in:
commit
e2c96a90f5
@ -1,19 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<Card :title="title">
|
<Card :title="title">
|
||||||
<JProblemChart
|
<JNestedRingChart :title="{ text: 652, subTitle: '本周总任务' }" :series="series" />
|
||||||
:title="{ text: 654, subTitle: '本周总任务', y: '35%' }"
|
|
||||||
:color="['#3cabfd', '#57ec72', '#f294c6', '#f43a8d', '#6ee4f0']"
|
|
||||||
:data="data"
|
|
||||||
:centerPie="centerPie"
|
|
||||||
/>
|
|
||||||
</Card>
|
</Card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Card from '../components/Card.vue'
|
import Card from '../components/Card.vue'
|
||||||
import JProblemChart from '../jChart/pie/JProblemChart.vue'
|
import JNestedRingChart from '../jChart/pie/JNestedRingChart.vue'
|
||||||
export default {
|
export default {
|
||||||
components: { Card, JProblemChart },
|
components: { Card, JNestedRingChart },
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -22,18 +17,25 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
data: [
|
series: [
|
||||||
{ value: 45, name: '未开始' },
|
{
|
||||||
{ value: 5, name: '未开始延期' },
|
color: ['#3CABFD', '#F43A8B', '#F294C6', '#56EC6F', '#786FF0', '#6EE4EE'],
|
||||||
{ value: 15, name: '进行中' },
|
data: [
|
||||||
{ value: 10, name: '执行中延期' },
|
{ value: 45, name: '未戴安全帽' },
|
||||||
{ value: 45, name: '完成' }
|
{ value: 5, name: '危险区域闯入' },
|
||||||
],
|
{ value: 15, name: '人员聚集报警' },
|
||||||
centerPie: {
|
{ value: 10, name: '未穿反光衣' },
|
||||||
color: ['#0B1B35', '#244D8F'],
|
{ value: 45, name: '明火监测报警' },
|
||||||
radius: ['10%', '12%'],
|
{ value: 45, name: '烟雾监测报警' }
|
||||||
data: [30, 40, 30, 40]
|
]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
roseType: 'area',
|
||||||
|
radius: ['58%', '54%'],
|
||||||
|
color: ['#0B1B35', '#244D8F'],
|
||||||
|
data: [30, 40, 30, 40]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,97 @@
|
|||||||
|
<template>
|
||||||
|
<div class="j-nested-ring-chart" ref="jNestedRingChart"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import echarts from 'echarts4'
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
title: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({
|
||||||
|
text: '',
|
||||||
|
subTitle: '',
|
||||||
|
x: '48%',
|
||||||
|
y: '36%'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
series: {
|
||||||
|
required: true,
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.jNestedRingChart = echarts.init(this.$refs.jNestedRingChart)
|
||||||
|
this.createChart()
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
jNestedRingChart: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createChart() {
|
||||||
|
const { title, series } = this
|
||||||
|
const setSeries = (series => {
|
||||||
|
return series.map(item => ({
|
||||||
|
type: 'pie',
|
||||||
|
label: false,
|
||||||
|
center: ['30%', '50%'],
|
||||||
|
radius: item.radius || ['65%', '80%'],
|
||||||
|
roseType: item.roseType,
|
||||||
|
color: item.color,
|
||||||
|
data: item.data
|
||||||
|
}))
|
||||||
|
})(series)
|
||||||
|
|
||||||
|
const option = {
|
||||||
|
title: {
|
||||||
|
text: title.text,
|
||||||
|
subtext: title.subTitle,
|
||||||
|
x: title.x || '29%',
|
||||||
|
y: title.y || '35%',
|
||||||
|
show: true,
|
||||||
|
textAlign: 'center',
|
||||||
|
textStyle: {
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: 'normal',
|
||||||
|
color: '#fff'
|
||||||
|
},
|
||||||
|
subtextStyle: {
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: 'normal',
|
||||||
|
color: '#fff'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'item'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
type: 'scroll',
|
||||||
|
orient: 'vertical',
|
||||||
|
right: 50,
|
||||||
|
top: 'center',
|
||||||
|
itemWidth: 10,
|
||||||
|
itemHeight: 10,
|
||||||
|
selectedMode: false,
|
||||||
|
icon: 'circle',
|
||||||
|
textStyle: {
|
||||||
|
color: '#ffffff',
|
||||||
|
fontSize: 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
series: setSeries
|
||||||
|
}
|
||||||
|
this.jNestedRingChart.setOption(option)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.j-nested-ring-chart {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user