|
@@ -6,6 +6,7 @@
|
|
|
|
|
|
<script>
|
|
|
import * as echarts from "echarts";
|
|
|
+import {loadCategoryData} from '@/api/api';
|
|
|
|
|
|
|
|
|
export default {
|
|
@@ -14,14 +15,13 @@ export default {
|
|
|
return {
|
|
|
a: [],
|
|
|
b: [],
|
|
|
+ sjyt: [],
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
|
- resultXData: {
|
|
|
-
|
|
|
- },
|
|
|
- seriesName:{
|
|
|
- type:String,
|
|
|
+ resultXData: {},
|
|
|
+ seriesName: {
|
|
|
+ type: String,
|
|
|
},
|
|
|
titleText: {
|
|
|
type: String,
|
|
@@ -31,14 +31,18 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.initDictConfig()
|
|
|
/*setTimeout(() => {
|
|
|
this.getPie();
|
|
|
}, 1000)*/
|
|
|
},
|
|
|
+ created() {
|
|
|
+
|
|
|
+ },
|
|
|
watch: {
|
|
|
resultXData: {
|
|
|
handler(newVal) {
|
|
|
- this.$nextTick(function() {
|
|
|
+ this.$nextTick(function () {
|
|
|
this.resultYData = newVal
|
|
|
this.getPie()
|
|
|
})
|
|
@@ -49,9 +53,16 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
+ initDictConfig() {
|
|
|
+ loadCategoryData({code: 'A04'}).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.sjyt = res.result
|
|
|
+ console.log(77777777777, this.sjyt)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
getPie() {
|
|
|
- var _this= this;
|
|
|
+ var _this = this;
|
|
|
// 绘制图表
|
|
|
/* this.$nextTick(() => {*/
|
|
|
var option = {
|
|
@@ -145,14 +156,15 @@ export default {
|
|
|
|
|
|
// 使用刚指定的配置项和数据显示图表。
|
|
|
var myChart = echarts.init(this.$refs.dom)
|
|
|
- myChart.on('click',(params)=>{
|
|
|
- _this.$emit('visible',{sjyt:params.data.name});
|
|
|
+ myChart.on('click', (params) => {
|
|
|
+ for (const param of this.sjyt) {
|
|
|
+ if (param.title == params.name){
|
|
|
+ _this.$emit('visible', {sjyt: param.value});
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
})
|
|
|
myChart.setOption(option)
|
|
|
- /*window.addEventListener("resize", myChart.resize);*/
|
|
|
-
|
|
|
- // })
|
|
|
|
|
|
}
|
|
|
},
|