Jelajahi Sumber

warehouseecharts

qinhouyu 2 tahun lalu
induk
melakukan
b607bbe9f9
2 mengubah file dengan 76 tambahan dan 0 penghapusan
  1. 1 0
      src/views/bigdata/chart-team.vue
  2. 75 0
      src/views/bigdata/chart-warehouse.vue

+ 1 - 0
src/views/bigdata/chart-team.vue

@@ -21,6 +21,7 @@ export default {
           trigger: 'item'
         },
         legend: {
+          show: false, // 移除筛选按钮
           left: 'center',
           top: '85%'
         },

+ 75 - 0
src/views/bigdata/chart-warehouse.vue

@@ -0,0 +1,75 @@
+<template>
+  <div class="chart-container">
+    <div id="warehouseecharts" style="width: 100%; height:24vh;">
+    </div>
+  </div>
+</template>
+<script>
+import * as echarts from 'echarts';
+import request from "@/utils/request";
+import {getBigDataForQ} from '@/api/bigdata.js'
+
+export default {
+  data(){
+    this.myChart = null;
+    return{}
+  },
+  methods:{
+    drawECharts(dataList) {
+      this.myChart.setOption({
+        tooltip: {
+          trigger: 'item'
+        },
+        legend: {
+          show: false, // 移除筛选按钮
+          left: 'center',
+          top: '85%'
+        },
+        series: [
+          {
+            type: 'pie',
+            radius: ['30%', '60%'],
+            avoidLabelOverlap: false,
+            itemStyle: {
+              borderRadius: 10,
+              borderColor: '#fff',
+              borderWidth: 2
+            },
+            label: {
+              show: true,
+              position: 'outer'
+            },
+            emphasis: {
+              label: {
+                show: false,
+                fontSize: 15,
+                fontWeight: 'bold'
+              }
+            },
+            labelLine: {
+              show: true
+            },
+            data: dataList.map((item)=>{
+              return{name:item.dept_name,value:item.count}
+            })
+          },
+        ]
+      });
+    },
+    getList() {
+      getBigDataForQ('warehouse').then(resp =>{
+        this.myChart = echarts.init(document.getElementById('warehouseecharts'));
+        this.drawECharts(resp.data!=null?resp.data:[]);
+      })
+    },
+
+  },
+  mounted() {
+    this.getList();
+  }
+}
+</script>
+<style>
+
+</style>
+