Browse Source

统计分析

王通 2 years ago
parent
commit
fa1eb85e61

+ 16 - 20
src/views/bigdata/chart-equipmentDistribution.vue

@@ -12,7 +12,7 @@
 
 <script>
   import * as echarts from 'echarts';
-  import {getSbfb,selectDeviceType} from '@/api/bigdata'
+  import {selectDeviceType} from '@/api/bigdata'
 
   export default {
     name: 'camera',
@@ -23,26 +23,26 @@
       }
     },
     mounted() {
-      this.sbfb()
+      this.selectDeviceType1()
       // this.myEcharts1();
-      this.myEcharts2();
+      //this.myEcharts2();
       // this.myEcharts3();
 
     },
 
     methods: {
-      sbfb() {
-          let that = this
-          selectDeviceType().then(res => {
-            res.data.forEach(item=> {
-              const param = Object.assign({})
-              param.name = item.deviceName
-              param.数量=item.deviceCount
-              this.source.push(param)
-            })
-            that.myEcharts2()
+      selectDeviceType1() {
+        let that = this
+        selectDeviceType().then(res => {
+          res.data.forEach(item => {
+            const param = Object.assign({})
+            param.name = item.deviceName
+            param.数量 = item.deviceCount
+            that.data_sbfb.push(param)
           })
-        },
+          that.myEcharts2()
+        })
+
       },
       // 出处 http://192.144.199.210:8080/editor/index.html?chart_id=TMyJh73uiXkeu3_v
       myEcharts1() {
@@ -77,7 +77,7 @@
           },
           tooltip: {
             trigger: 'item',
-            position: function (point, params, dom, rect, size) {
+            position: function(point, params, dom, rect, size) {
               const x = point[0];
               const y = point[1];
               const viewWidth = size.viewSize[0];
@@ -376,17 +376,13 @@
               value: [4300, 10000, 28000, 35000, 50000, 19000, 21000],
               name: '型号统计',
 
-
             }]
           }]
         };
         option && myChart.setOption(option);
       },
 
-
-    },
-
-
+    }
   }
 </script>
 

+ 22 - 11
src/views/bigdata/chart-equipmentType.vue

@@ -8,7 +8,7 @@
 
 <script>
   import * as echarts from 'echarts';
-  import {getShlxtj} from '@/api/bigdata'
+  import {getShlxtj,selectDeviceType} from '@/api/bigdata'
 
   export default {
     name: 'enterprise',
@@ -36,16 +36,27 @@
       },
       sblxtj() {
         let that = this
-        getShlxtj().then(resp => {
-          that.data_deviceCount = resp.data.deviceCount
-          that.data_deviceType = resp.data.deviceType
-          for (let i = 0; i < resp.data.deviceCount.length; i++) {
-            that.deviceTypeCount.push({
-              value: resp.data.deviceCount[i],
-              name: resp.data.deviceType[i],
-              itemStyle: {color: that.color16()}
-            })
-          }
+        // getShlxtj().then(resp => {
+        //   that.data_deviceCount = resp.data.deviceCount
+        //   that.data_deviceType = resp.data.deviceType
+        //   for (let i = 0; i < resp.data.deviceCount.length; i++) {
+        //     that.deviceTypeCount.push({
+        //       value: resp.data.deviceCount[i],
+        //       name: resp.data.deviceType[i],
+        //       itemStyle: {color: that.color16()}
+        //     })
+        //   }
+            selectDeviceType().then(resp => {
+              resp.data.forEach(item=>
+              {
+                that.data_deviceCount.push(item.deviceCount)
+                that.data_deviceType.push(item.deviceName)
+                that.deviceTypeCount.push({
+                  value: item.deviceCount,
+                  name: item.deviceName,
+                  itemStyle: { color: that.color16() }
+                })
+              })
           that.myEcharts()
         })
       },

+ 10 - 4
src/views/bigdata/tabbar.vue

@@ -20,7 +20,7 @@
 </template>
 
 <script>
-  import {getZhxx} from '@/api/bigdata'
+  import {getZhxx,selectDeviceType} from '@/api/bigdata'
 
   export default {
     data() {
@@ -148,9 +148,15 @@
           that.regionNum = [];
           that.regionNum.push(...resp.data.event)
           that.regionNum.push(...resp.data.data)
-          for(let i in resp.data.device){
-            that.regionNum.push({value: resp.data.device[i].deviceCount,name: resp.data.device[i].deviceName})
-          }
+          selectDeviceType().then(res => {
+            res.data.forEach(item=>
+            {
+              that.regionNum.push({value: item.deviceCount,name: item.deviceName})
+            })
+          })
+          // for(let i in resp.data.device){
+          //   that.regionNum.push({value: resp.data.device[i].deviceCount,name: resp.data.device[i].deviceName})
+          // }
         })
       },