securityAlarmManageDistribute.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <script>
  2. import apiSecurityAlarmMgr from "@/api/security/apiSecurityAlarmMgr";
  3. export default {
  4. data() {
  5. return {
  6. option: {
  7. color: ['#80D4FF', '#A6A6FF', '#FFB580', '#FFDF80', '#79F2E8'],
  8. tooltip: {
  9. trigger: 'item'
  10. },
  11. legend: {
  12. bottom: '10%',
  13. icon: 'circle'
  14. },
  15. series: [
  16. {
  17. name: '告警次数',
  18. type: 'pie',
  19. radius: '50%',
  20. center: ['50%','40%'],
  21. data: [
  22. ],
  23. emphasis: {
  24. itemStyle: {
  25. shadowBlur: 10,
  26. shadowOffsetX: 0,
  27. shadowColor: 'rgba(0, 0, 0, 0.5)'
  28. }
  29. }
  30. }
  31. ]
  32. }
  33. }
  34. },
  35. props: {
  36. height: Number,
  37. queryData: Object
  38. },
  39. mounted() {
  40. this.$nextTick(()=>{
  41. this.initChart()
  42. })
  43. },
  44. methods: {
  45. initChart() {
  46. let chart = this.$echarts.init(this.$refs.myChart)
  47. this.chart = chart;
  48. this.$util.chartsResize(this.chart);
  49. this.getData();
  50. },
  51. getData() {
  52. return apiSecurityAlarmMgr.getFloorAlarmDistribution(this.queryData).then(res=>{
  53. this.option.series[0].data = res;
  54. this.chart.setOption(this.option);
  55. })
  56. }
  57. }
  58. }
  59. </script>
  60. <template>
  61. <div style="width: 100%" :style="{height: height+'px'}" ref="myChart"></div>
  62. </template>
  63. <style lang="less" scoped>
  64. </style>