import echarts from 'echarts'
-import './wonderland.js'
+import 'echarts/theme/macarons'
export default {
props: {
className: {
type: String,
- default: 'chart',
},
id: {
type: String,
@@ -27,12 +43,33 @@ export default {
type: String,
default: '300px',
},
+ data: {
+ type: Array,
+ default: () => ([]),
+ },
+ title: {
+ type: String,
+ default: '大标题',
+ },
+ subtitle: {
+ type: String,
+ default: '',
+ },
},
data() {
return {
chart: null,
}
},
+ computed: {
+ legand() {
+ const arr = []
+ this.data.forEach((item) => {
+ arr.push(item.name)
+ })
+ return arr
+ },
+ },
mounted() {
this.initChart()
this.chart = null
@@ -48,11 +85,13 @@ export default {
initChart() {
this.chart = echarts.init(document.getElementById(this.id), 'macarons')
+
this.chart.setOption({
title: {
- text: '测试',
+ text: this.title,
+ subtext: this.subtitle,
left: '29%',
- top: '40%',
+ top: '43%',
textAlign: 'center',
textStyle: {
fontSize: 14,
@@ -74,22 +113,8 @@ export default {
textStyle: {
fontSize: 12,
},
- // formatter: function (name) {
- // let value = "";
- // for (let k in this.FilingChartData) {
- // let obj = this.FilingChartData[k];
- // if (obj.name == name) {
- // value = obj.value;
- // break;
- // }
- // }
- // if (name.length > 8) {
-
- // name = name.substring(0, 8) + "\n" + name.substring(8, name.length);
- // }
- // return name + " : " + value + "人";
- // },
- data: ['信访举报', '上级交办', '监督检查中发现', '审查调查中发现', '审计中发现', '巡视巡察中发现', '公检法机关移送', '其他行政执法机关移送', '其他'],
+
+ data: this.legand,
},
@@ -99,7 +124,7 @@ export default {
type: 'pie',
radius: ['50%', '80%'],
center: ['30%', '50%'],
- data: JSON.parse('[{ "name": "信访举报", "value":"104"},{ "name": "上级交办", "value":"3"},{ "name": "监督检查中发现", "value":"7"},{ "name": "审查调查中发现", "value":"125"},{ "name": "审计中发现", "value":"24"},{ "name": "巡视巡察中发现", "value":"6"},{ "name": "公检法机关移送", "value":"6"},{ "name": "其他行政执法机关移送", "value":"6"},{ "name": "其他", "value":"1"}]'),
+ data: this.data,
label: {
normal: {
textStyle: {
@@ -127,6 +152,10 @@ export default {
},
],
})
+
+ window.onresize = function () {
+ this.chart.resize()
+ }
},
},
}
diff --git a/src/styles/index.scss b/src/styles/index.scss
index 1db8634..52d09a8 100644
--- a/src/styles/index.scss
+++ b/src/styles/index.scss
@@ -168,7 +168,7 @@ code {
.widget-box{
- background: #fff;
+ background: #fff!important;
margin-bottom: 1.875rem;
padding:1.875rem;
box-shadow: 0 4px 70px -18px #707070;
diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue
index db56d85..24c5614 100644
--- a/src/views/dashboard/index.vue
+++ b/src/views/dashboard/index.vue
@@ -1,9 +1,40 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
@@ -15,14 +46,19 @@